NetBeans with Oracle's Java

Mar 25, 2012·
Julio Batista Silva
Julio Batista Silva
· 2 min read
blog Linux

This semester I took two courses with a professor who is very fond of Java: all the material is delivered in Java, and on top of that some plugins we use for testing only exist in NetBeans. That is not a problem in class, since every computer in the labs has NetBeans installed, but to study at home and do assignments I had to install it on my laptop.

While installing NetBeans on Arch Linux, I had to choose to install some open source version of Java:

julio@julio-acer ~> sudo pacman -S netbeans
resolving dependencies...
:: There are 2 providers available for java-environment:
:: Repository extra
   1) jdk7-openjdk  2) openjdk6

Enter a number (default=1):

But unfortunately I could not do that, because Banco do Brasil requires Oracle’s proprietary Java to access the site, and there is no way to install both versions at the same time*.

To solve this problem, just install the JRE and the JDK from the AUR and install NetBeans ignoring the dependencies:

julio@julio-acer ~> sudo pacman --nodeps --nodeps -S netbeans
looking for inter-conflicts...
Targets (1): netbeans-7.1.1-1
Total Installed Size:   500.73 MiB
Proceed with installation? [Y/n]

And that is it — NetBeans should now work with Oracle’s Java.

Notes:

  1. If you try to create a new Java project in NetBeans and get the following error:

    The JDK is missing and is required to run some NetBeans modules Please use the –jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information.

    it is because you probably only have the JRE. To run NetBeans you also need to install the JDK, available on the AUR.

    Install the JDK and log out and back in to add it to $PATH.

  2. If you use a tiling window manager such as Awesome, opening NetBeans will show only a grey screen. To fix that, run the following command:

    julio@julio-acer ~> wmname LG3D
    
  3. The same applies to Eclipse


* It may be possible with jdk7-compat, but keeping two versions of Java on the computer is a waste of space.

Julio Batista Silva
Authors
Senior Cloud Developer

I’m a Brazilian computer engineer based in Germany, passionate about tech, science, photography, and languages.

I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.

I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, mentoring, and contributing with code and translations.

On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.

Browse my gallery for some of my photography.

Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.

Always happy to connect! 🙂

comments powered by Disqus