How-To Session: Installing Netbeans with JRE and JDK

netbeans

Warning: Do NOT follow this guide if the default installation of NetBeans works for you, this is meant as a guide if NetBeans will not work due to conflicting packages such as JRE (java runtime enviroment) and JDK (java development kit)

I currently use Arch Linux as my main GNU\Linux distribution. That said this may apply only to Arch Linux, but I feel it applies to all distros, as I have tested it on others as well. By default, the installation of NetBeans will fail to start for many due to the fact it cannot find Java and tells you to: “Cannot find java. Please use the –jdkhome switch.” Of course this is ludacris, so I search forums and returned the following useful pages:

Suns Recommendations (see below)
Arch Linux Forum Post

With the first link, I found that at least under Arch, that directory DOES NOT exist. The config file is actually located in “/usr/share/netbeans/bin/netbeans/etc/netbeans.conf” That was error number one. Error number two was Sun telling you to “unmark netbeans_jdkhome” and to ” link to JDK location e.g. /usr/local/share/java/jdk1.6.0_07/” in that “netbeans.conf” file. WRONG again (again, at least for Arch Linux). This could be fixed via the second link provided above, running “netbeans – -jdkpath /opt/java/jre” but for most users, they do not want to type this EVERY time then run netbeans right?

To fix this after netbeans is installed, ensure you have both “jre” and “jdk” installed on your respective distribution. After that follow these steps:

  1. open up Terminal
  2. cd to “/usr/share/netbeans/etc”
  3. type “nano netbeans.conf” or “vim netbeans.conf”
  4. Unlike what SUN told you, instead or editing the “netbeans_jdkhome” line, go to the line that reads “command line switches”
  5. Append the option like so “–jdkpath /opt/java/jre” to the END of the “netbeans_default_options=” block. You MUST leave a space after the previous option as such: “PREVIOUS-OPTION –jdkpath /opt/java/jre”
  6. save the file and exit Terminal
  7. Note: infront of “jdkpath those are (2) “dashes” HTML just likes to make them appear as one line, but they are in fact – –

You now should be able to start Net Beans in Terminal by doing “netbeans” or via the GUI in you applications menu. Thats it! Enjoy!

_Nano

Advertisements

About professorkaos64

www.libregeek.org

Posted on 20090404, in How-To, Programming, Software. Bookmark the permalink. 1 Comment.

  1. Something has changed. It works with the following option:

    –jdkhome /opt/java/jre

    two dashes and jdkhome instead of jdkpath

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s