Java 如何更改 Netbeans 6.9 中的默认项目目录(文件夹)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3077531/
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
How to change the default project directory (folder) in Netbeans 6.9?
提问by battistis
How to change the default project directory in Netbeans 6.9 for Java SE\ME\EE?
如何更改 Netbeans 6.9 中 Java SE\ME\EE 的默认项目目录?
采纳答案by Catchwa
I don't think you can make it module-specific but you can set it as follows:
我不认为您可以使其特定于模块,但您可以将其设置如下:
- Close NetBeans
- Find the
projectui.properties
file. For me (Windows) it was underC:\Documents and Settings\Catchwa\.netbeans\6.9\config\Preferences\org\netbeans\modules\projectui.properties
- The
projectsFolder=C:\\NetBeansProjects
variable is I think what you want to change.
- 关闭 NetBeans
- 找到
projectui.properties
文件。对我来说(Windows)它在C:\Documents and Settings\Catchwa\.netbeans\6.9\config\Preferences\org\netbeans\modules\projectui.properties
- 该
projectsFolder=C:\\NetBeansProjects
变量我想你想改变什么。
回答by donj
Under Windows 7, logged in under AD, the projectui.properties file's directory was under the parent folder listed in the USERPROFILE
environment variable (type set
in a command prompt window):
在 Windows 7 下,在 AD 下登录,projectui.properties 文件的目录位于USERPROFILE
环境变量中列出的父文件夹下(set
在命令提示符窗口中键入):
C:\Users\my_login_name\.netbeans.0\config\Preferences\org\netbeans\modules\projectui.properties
It was not in the directories pointed at by the HOME or APPDATA variables.
它不在 HOME 或 APPDATA 变量指向的目录中。
Changed projectsFolder
value to new location, restarted NetBeans and default folder for new projects was in the new location. It worked!
将projectsFolder
值更改为新位置,重新启动 NetBeans,新项目的默认文件夹位于新位置。有效!
回答by FirasR
I found mine in a slightly different location (Windows 7 64-bit using Netbeans 7.2):
我在一个稍微不同的位置找到了我的(使用 Netbeans 7.2 的 Windows 7 64 位):
C:\Users\UserName\AppData\Roaming\NetBeans\7.2\config\Preferences\org\netbeans\modules\projectui.properties
C:\Users\UserName\AppData\Roaming\NetBeans\7.2\config\Preferences\org\netbeans\modules\projectui.properties
回答by bogdotro
In windows 7 64 bit properties file can be found under c:\Users\user\AppData\Roaming\NetBeans\7.2.1\config\Preferences\org\netbeans\modules\ folder
在 windows 7 64 位属性文件可以在 c:\Users\user\AppData\Roaming\NetBeans\7.2.1\config\Preferences\org\netbeans\modules\ 文件夹下找到
回答by bcmoney
Slightly different way of doing it for NetBeans 7.3 latest release (at least for Windows 7, 64-bit). Search your system for netbeans.conf(from explorer window) or go to its default install location:
对于 NetBeans 7.3 最新版本(至少对于 64 位 Windows 7),这样做的方式略有不同。在您的系统中搜索netbeans.conf(从资源管理器窗口)或转到其默认安装位置:
C:\Program Files\NetBeans 7.3\etc\netbeans.conf
Look for netbeans.confon Mac OS X:
在 Mac OS X 上查找netbeans.conf:
find / -name "netbeans.conf" -print &
Look for netbeans.confin Linux:
在 Linux 中查找netbeans.conf:
sudo find / -name "netbeans.conf" 2> /dev/null
Then edit the netbeans.conffile to replace the userdirline:
然后编辑netbeans.conf文件以替换userdir行:
netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/7.3"
With your new projects directory/folder path:
使用您的新项目目录/文件夹路径:
netbeans_default_userdir="C:/APPS/netbeans/"
-OR-
-或者-
netbeans_default_userdir="\Applicatons\netbeans\"
(NOTE: if you have trouble in Windows in a network managed security environment, you'll need admin access to make this change. Open the file using your editor's ".exe" directly by right-clicking the launcher file and clicking "Run as Administrator", I had to do this for Notepad++ because it said "Another application is using the file", but in fact it was just locked to non-admin users).
(注意:如果您在网络管理的安全环境中的 Windows 中遇到问题,您将需要管理员访问权限才能进行此更改。通过右键单击启动器文件并单击“运行方式”直接使用编辑器的“.exe”打开文件管理员”,我必须为 Notepad++ 执行此操作,因为它说“另一个应用程序正在使用该文件”,但实际上它只是锁定给非管理员用户)。
This changes the default userdirwhich stores user-specific IDE settings, but not the default project folder/directory. Next, you need to open NetBeans IDE with the new IDE settings and start to create a new Java project (then cancel after second screen in project creation wizard). It will now create a new projectui.propertiesfile in the userdiryou set; this is the file that wasn't found before this workaround that you need to edit as per the other suggestions. Mine was located here after these changes:
这改变了默认的用户目录,其存储用户特定的IDE设置,而不是默认的项目文件夹/目录。接下来,您需要使用新的 IDE 设置打开 NetBeans IDE 并开始创建新的 Java 项目(然后在项目创建向导的第二个屏幕后取消)。现在它将在您设置的userdir 中创建一个新的projectui.properties文件;这是在此解决方法之前未找到的文件,您需要根据其他建议对其进行编辑。在这些更改后,我的位于此处:
C:\APPS\netbeans\config\Preferences\org\netbeans\modules
Finally, you've reached the finish line and can change the projectsFolderproperty value to the path you want, if you don't see a line for projectsFolderthen simply type or paste one in at the bottom of the file to point to your path where you want NetBeans to store projects by default, such as:
最后,您已经到达终点线,可以将projectsFolder属性值更改为您想要的路径,如果您没有看到projectsFolder的一行,那么只需在文件底部键入或粘贴一个以指向您的路径您希望 NetBeans 默认存储项目的位置,例如:
projectsFolder=C:/APPS/projects/
-OR-
-或者-
projectsFolder=\Applicatons\projects\
Wow, that's alot of settings changes but it finally works for me the way I wanted it to, being able to switch my IDE back and forth between a local workspace and a network workspace using my username space on the corporate LAN just by changing projectsFolderproperty value in the projectui.propertiesfolder.
哇,这是很多设置更改,但它最终以我想要的方式为我工作,只需更改项目文件夹属性,就可以使用公司 LAN 上的用户名空间在本地工作区和网络工作区之间来回切换我的 IDE projectui.properties文件夹中的值。
NOTE: On Linux or Mac you might not need the first step of modifying netbeans.confas the projectui.propertiesshould be as follows (may vary by OS version): $HOME/.netbeans/7.3/config/Preferences/org/netbeans/modules/projectui.properties
注意:在 Linux 或 Mac 上,您可能不需要修改netbeans.conf 的第一步,因为projectui.properties应如下所示(可能因操作系统版本而异): $HOME/.netbeans/7.3/config/Preferences/org/netbeans /modules/projectui.properties
回答by Sudhakar K
In linux/Ubuntu
在 Linux/Ubuntu 中
- View hidden files in home directory (press ctrl+H on /home folder).
- .netbeans\7.3\config\Preferences\org\netbeans\modules\projectui.properties
- 查看主目录中的隐藏文件(在 /home 文件夹上按 ctrl+H)。
- .netbeans\7.3\config\Preferences\org\netbeans\modules\projectui.properties
Update the following content in projectui.propertiesfile
更新projectui.properties文件中的以下内容
projectsFolder=/home/folder/NB
回答by Marcio Mazzucato
In newer versions, right-click on the project you want to move in the 'Projects' tab, and then click 'Move'. This will allow you to move the project to a new directory.
在较新的版本中,在“项目”选项卡中右键单击要移动的项目,然后单击“移动”。这将允许您将项目移动到新目录。