Recently, I was thrust semi-willingly into the dark and musky world of Java development. That’s not a bad thing, as I’ve found myself learning a lot about Java development and in general, learning is not especially a bad thing. I’ve chosen upon using Netbeans as my development environment of choice. Partially because it’s the most mature Java development environment, and I have experience in using it with PHP (another language I’ve recently found myself thrust into). Mostly because JDeveloper doesn’t run on Linux and Eclipse is crap.
Anyway, getting Netbeans working is a bit of a challenge. At least in Fedora. 17, which is my distro of choice.
So, first off, you’re going to want to get the latest version of the JDK. This is available from Oracle’s website. Download it and install it either through the GUI or with the following command:
rpm -i <filename of latest JDK RPM>.
Installing it should be pretty painless, and once it’s all over and done with, you’re going to want to do the same with Netbeans. Now, Netbeans isn’t entirely GPL licensed (of course it isn’t. It’s owned by Oracle), so Fedora refuse to allow it in their repositories. That’s OK though, because it’s not exactly difficult to install it.
Download the latest version of netbeans from the website. Once you’ve got it, open up a terminal session and get root. Traverse to the directory and give it executable permissions with the following command.
chmod +x <netbeans file name>.
Once you’ve given it executable permissions. run the Netbeans shell script you just downloaded. The command to do that is :
./<netbeans file name>
Press ‘next’ a few times. Accept a few license agreements. Go get a coffee. In about 10 minutes, it should have finished installing. Cool.
Now, try and create a new Java project. Odds are good (particularly if you have the open JDK knocking about on your system, it’ll whinge about not having the right JDK installed. The right one being (of course) the official Oracle one. Now, given that you just installed the Oracle JDK, you should probably find this a wee bit suspect.
Now, there’s a fairly easy way to deal with this. Open up a terminal. Provided that you’ve not messed around with the installation paths of Netbeans, or moved stuff around, this should work.Navigate to the /bin folder of your Netbeans installlation. Your netbeans installation is located within /usr/local/.Run the following command, substituting <folder of JDK> with the folder of your JDK installation:
./netbeans –jdkhome /usr/java/<folder of JDK>
Bear in mind, whenever you want to use Netbeans to work on a Java project, you’ll have to execute that command, so you might want to put it in a nice little shell script on your desktop.
If you liked this article and need the use of a VPS, Linode come highly recommended. They’re cheap, fast, have incredible support and support a huge range of Linux distributions including Fedora, Centos and Ubuntu. And, if you sign up with this referral link, I get a nice kickback. Everybody wins!