如何更改 Eclipse 默认工作区?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5179328/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:00:14  来源:igfitidea点击:

How to change the Eclipse default workspace?

eclipse

提问by user496949

Where can I change the default workspace in Eclipse?

在哪里可以更改 Eclipse 中的默认工作区?

回答by Manrico Corazzi

If you mean "change workspace" go to File -> Switch Workspace

如果您的意思是“更改工作区”,请转到 File -> Switch Workspace

回答by jseals

I took this question to mean how can you change the Default workspace so that when Eclipse boots up the workspace you want is automatically loaded:

我认为这个问题的意思是如何更改默认工作区,以便在 Eclipse 启动时自动加载所需的工作区:

  • Go under preferences then type "workspace" in the search box provided to filter the list. Alternatively you can go to General>Startup and Shutdown>Workspaces.
  • There you can set a flag to make Eclipse prompt you to select a workspace at startup by checking the "Prompt for workspace at startup" checkbox.
  • You can set the number of previous workspaces to remember also. Finally there is a list of recent workspaces. If you just remove all but the one you want Eclipse will automatically startup with that workspace.
  • 进入首选项,然后在提供的搜索框中键入“工作区”以过滤列表。或者,您可以转到“常规”>“启动和关闭”>“工作区”。
  • 在那里您可以设置一个标志,使 Eclipse 通过选中“启动时提示工作区”复选框来提示您在启动时选择工作区。
  • 您还可以设置要记住的先前工作区的数量。最后是最近工作区的列表。如果您只删除除您想要的之外的所有内容,Eclipse 将自动使用该工作区启动。

回答by Frank

  1. Go to eclipse\configuration\
  2. Open the file "config.ini"
  3. Modify the line

    osgi.instance.area.default="F:/Workspace/Java"
    

    where "F:/Workspace/Java"should be your default workspace!

  1. eclipse\configuration\
  2. 打开文件 "config.ini"
  3. 修改行

    osgi.instance.area.default="F:/Workspace/Java"
    

    "F:/Workspace/Java"您的默认工作区应该在哪里!

回答by Tom Quarendon

If you are talking about changing the working directory for a java program that you launch from within eclipse, then there's a space for that in the run configuration. If you go to Run menu and select "Run Configurations..." then select your run configuration, then on the "Arguments" tab for a Java Application there is a place for you to edit the "Working directory". This alters the current directory that will be used for launching the java program.

如果您正在谈论更改从 eclipse 中启动的 java 程序的工作目录,那么在运行配置中有一个空间。如果您转到“运行”菜单并选择“运行配置...”,然后选择您的运行配置,然后在 Java 应用程序的“参数”选项卡上,您可以编辑“工作目录”。这将更改将用于启动 java 程序的当前目录。

See related question Default eclipse working directoryif this is what you are meaning.

如果这是您的意思,请参阅相关问题默认 eclipse 工作目录

回答by sowmia

Whatever Frank has suggested to change in config.ini is correct. In case, if that didn't help, you need to remove path from recent workspace as below.

Frank 建议在 config.ini 中更改的任何内容都是正确的。如果这没有帮助,您需要从最近的工作区中删除路径,如下所示。

  1. Go to eclipse\configuration\org.eclipse.ui.ide.prefs\
  2. Open the file "org.eclipse.ui.ide.prefs"
  3. Remove the first path in RECENT_WORKSPACES.

    MAX_RECENT_WORKSPACES=5RECENT_WORKSPACES=/Users/wrokspace1\n/Users/wrokspace2\n/Users/wrokspace3\n/Users/wrokspace4RECENT_WORKSPACES_PROTOCOL=3
    SHOW_WORKSPACE_SELECTION_DIALOG=false
    eclipse.preferences.version=1

  1. eclipse\configuration\org.eclipse.ui.ide.prefs\
  2. 打开文件 "org.eclipse.ui.ide.prefs"
  3. 删除RECENT_WORKSPACES.

    MAX_RECENT_WORKSPACES =5RECENT_WORKSPACES =/Users/wrokspace1\n/Users/wrokspace2\n/Users/wrokspace3\n/Users/wrokspace4RECENT_WORKSPACES_PROTOCOL =3
    SHOW_WORKSPACE_SELECTION_DIALOG =false
    eclipse.preferences.version=1

回答by Neets

File > Switch workspace > add the workspace you like > Eclipse will restart using the workspace you wanted.

文件 > 切换工作区 > 添加您喜欢的工作区 > Eclipse 将使用您想要的工作区重新启动。

回答by Dunaril

If you mean to change the directory in which the program execution will occur, go to "Run configurations" in the Run tab.

如果要更改程序执行的目录,请转到“运行”选项卡中的“运行配置”。

Then select your project and go to the "Arguments" tab, you can change the directory there. By default it is the root directory of your project.

然后选择您的项目并转到“参数”选项卡,您可以在那里更改目录。默认情况下,它是您项目的根目录。

回答by user2869735

Open a command prompt. Change to the eclipse home directory and type "eclipse -clean" e.g. C:/eclipse>eclipse -clean

打开命令提示符。切换到 eclipse 主目录并输入“eclipse -clean”,例如 C:/eclipse>eclipse -clean

This will ask for the workspace selection. It will also force to set it as the default workspace.

这将要求选择工作区。它还将强制将其设置为默认工作区。

Then, go to eclipsehome-->configuration-->settings folder.

然后,转到 eclipsehome-->configuration-->settings 文件夹。

open org.eclipse.ui.de.prefs in a notepad.

在记事本中打开 org.eclipse.ui.de.prefs。

set this property to true from false.

将此属性从 false 设置为 true。

SHOW_WORKSPACE_SELECTION_DIALOG=true

SHOW_WORKSPACE_SELECTION_DIALOG=真

You will be asked for a workspace selection everytime.

每次都会要求您选择工作区。

回答by Hadi Rasouli

If you want to change recent workspace manuallyin a configurationfile org.eclipse.ui.ide.prefs exists in

如果你想改变近期的工作空间manuallyconfiguration文件org.eclipse.ui.ide.prefs存在

eclipse > configuration > .settings > org.eclipse.ui.ide.prefs

open this file in an editor find RECENT_WORKSPACESin line #2and in this line you can see recent workspaces and can changeor even removethem.

打开在编辑器中找到这个文件 RECENT_WORKSPACES一致#2,并在此行中,你可以看到最近的工作区和罐头change,甚至remove他们。

回答by Jorgesys

In Eclipse, go to File-> Switch Workspace, choose or create a new workspace.

在 中Eclipse,转到File-> Switch Workspace,选择或创建一个新工作区。