티스토리 뷰

Show

Set JDK for NetBeans

Hide Code 2018. 9. 30. 08:35

How to set the JDK Netbeans runs on?
https://stackoverflow.com/questions/6950960/how-to-set-the-jdk-netbeans-runs-on

Thanks to KasunBG's tip, I found the solution in the "suggested" link, update the following file (replace 7.x with your Netbeans version) :

C:\Program Files\NetBeans 7.x\etc\netbeans.conf

Change the following line to point it where your java installation is :

netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"

You may need Administrator privileges to edit netbeans.conf


Go to Tools -> Java Platforms. There, click on Add Platform, point it to C:\Program Files (x86)\Java\jdk1.6.0_25. You can either set the another JDK version or remove existing versions.

Another solution suggested in the oracle (sun) site is,

netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"

I tried this on 6.9.1. You may change the JDK per project as well. You need to set the available JDKs via Java Platforms dialog. Then, go to Run -> Set Project Configuration -> Customize. After that, in the opened Dialog box go to Build -> Compile. Set the version.


Can I specify the JDK to run NetBeans on?
http://wiki.netbeans.org/FaqJdkHome

 

FaqJdkHome

Can I specify the JDK to run NetBeans on?

Yes, use the --jdkhome <path> option when starting NetBeans. <path> is the root of the JDK installation.

The NetBeans installer looks for suitable JDK installations available on user's system and allows the user to select the one she wants to run NetBeans with. For the installer (6.0-M10) itself use --javahome <path>. However, the setting may become obsolete when the user installs a new JDK later, or may be inconvenient when you want to run the IDE with another JDK. That's where the --jdkhome swich comes handy.

If you want to set the option permanently, you can do so in the netbeans.conf file.


Examples

  • Windows
netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"
  • Unix
netbeans --jdkhome /usr/bin/jdk1.6.0_20

Applies to: NetBeans 3.6, 4.x, 5.x, 6.x, 7.x, 8.x

Platforms: All


 

http://wiki.netbeans.org/FaqNetbeansConf

FaqNetbeansConf

How do I make my custom startup parameters permanent?

To make start-up parameters from the command line permanent, you add them to the netbeans.conf file. You may use this plugin to edit the netbeans.conf file more easily (thanks to Claudio Miranda).

If you want NetBeans to always start with some specific options such as --userdir , --cachedir , --jdkhome , --fontsize , etc., you might be tempted to write a wrapper script around the NetBeans launcher so that you don't have to type them on the command line. A wrapper script will work, of course, but a better way is to put your custom options into the NetBeans configuration file -- netbeans.conf.

Finding the Configuration File

There are actually two versions of the netbeans.conf file, a global and a local one.

Global: If you want to change the settings globally for all users using a shared NetBeans installation, modify the global instance of the file. You find it in the NetBeans installation directory:

${nb-install}/etc/netbeans.conf

Local: To make individual changes that will apply only to a specific user, put them into the etc/netbeans.conf file in the user's userdir .

${userdir}/etc/netbeans.conf

The local file does not exist by default! If you don't see a ${userdir}/etc directory you have to create the file yourself. The easiest way to do that is to copy the global netbeans.conf file from the NetBeans installation folder to the local ${userdir}/etc folder, and then make the desired changes.

Examples of the netbeans.conf file path:

On Mac OS X: Ctrl-click /Applications/NetBeans/NetBeans IDE 6.5.app in the Finder and choose 'show package contents', then browse to /Applications/NetBeans/NetBeans\ IDE\ 6.5.app/Contents/Resources/NetBeans/etc/netbeans.conf.

On Windows: C:\Program Files\Netbeans\etc\netbeans.conf

On Linux the installer lets the user choose where you want to install NetBeans. You may find it under /home/yourname/netbeans/etc/netbeans.conf or /opt/netbeans/etc/netbeans.conf. Latest versions install it on /usr/local/netbeans-x.0/etc/netbeans.conf being x.0 the version.


Editing the Configuration File

The netbeans.conf file can include the following entries:

netbeans_default_userdir
The default location and name of the userdir . Note that this entry is only valid in the global configuration file. (It cannot be redefined in the local netbeans.conf file, because the launcher already needs to know the location of the userdir when the local netbeans.conf file is being processed.)
netbeans_default_cachedir (Since 7.2)
The default location and name of the cachedir . Note that this entry is only valid in the global configuration file. (It cannot be redefined in the local netbeans.conf file, because the launcher already needs to know the location of the cachedir when the local netbeans.conf file is being processed.)
netbeans_default_options
Any parameters passed to the JVM or NetBeans during start-up, such as memory configuration parameters, debugging options, --fontsize , Look and Feel switches, various experimental switches, etc..
netbeans_jdkhome
The default location of the JDK to run NetBeans on. Can be overriden with the --jdkhome option.
netbeans_extraclusters
The paths to additional NetBeans clusters separated by colons (Unix, Macintosh OS X), or semicolons (Microsoft Windows).

When you need to embed spaces or quotes inside a command-line option, use a backslash escape character before each quote. For example, netbeans_default_options="-J-client ... -J-XX:OnError=\"userdump %p\""

Any line in netbeans.conf starting with '#' is a comment. Comments are ignored during processing.

The startup options and settings passed into NetBeans via the command-line and the ones found in configuration files may overlap. The conflicting options are resolved by the following rules:

  1. Settings in local version of netbeans.conf override the same settings in the global copy of the file.
  2. Command-line options override settings in either of the configuration files.

Examples of the netbeans.conf file content:

A typical content of the global netbeans.conf file may look like this:

# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/6.9"

# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m 
-J-Dapple.laf.useScreenMenuBar=true -J-Dnetbeans.winsys.statusLine.in.menuBar=true -J-Dsun.java2d.noddraw=true"

# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_20"

# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"

Applies to: NetBeans IDE 4.x, 5.x, 6.x, 7.x

Platforms: All


Links


 

 

'Show' 카테고리의 다른 글

[Nexus 7] Remove Blank Screens  (0) 2019.03.19
엄마표 영어  (0) 2018.10.03
install eclipse & set eclipse.ini  (0) 2018.09.30
[Python] Extending, Embedding and Integrating  (0) 2018.07.28
SQL Server 2017 Machine Learning Services  (0) 2018.06.21
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함