Installing Java was pretty straightforward and easy this go-around. Since the runtime was so easy, we’ll let this post go through installing all the different pieces for a complete development environment: Eclipse, Android SDK, JavaFX SDK, etc.
So, here’s what I did…
Installing the JDK is easy from the Software Center. I just searched for OpenJDK or Java, and up it came. An easy click on the Install button is all it took!
Java in the Browser
I had to install the IcedTea Plugin to get Java working in Chrome. Again, installing from Software Center was pretty easy.
The cool part was that I didn’t even have to restart my browser. I just hit the Java Test page, and it started working!
Switching between java versions
You are probably going to end up with multiple versions of the JDK installed. Between version 6 and version 7, you also have OpenJDK and Oracle’s official version. So, you need to be able to easily switch between versions.
You can do so with:
sudo update-alternatives –config java
Note: I think this would be great as a configuration item in System Settings. Maybe one day I will get to trying to add something to the Gnome Control Center to manage this through the GUI. If anyone could point me in the right direction for contributing a tool, please comment below.
Installing the JDK
At this point, you will notice that the JDK hasn’t been installed. That’s the development kit. So, you can run Java programs, but you can’t compile your own. Javac, the compiler, isn’t anywhere to be found:
You won’t find the JDK in the Software Center unless you unhide the Technical Details. So, click that Show Technical Details link at the bottom, and then, you can find the JDK to install it.
If you are doing any development, you may want to install the source code. This could make debugging simpler. Click through the More Info button to find the Add ons.
Now, you should have javac installed on your computer:
Eclipse is a great IDE that I have used for a quite some time. Now, you can install it from the Software Center.
The Eclipse environment is in the main Software Center window, but it doesn’t include any of the plugins. If you want to develop with Java, you’ll need to install the Java Development Tools plugin. So, you may as well, click the Show Technical Details link again and install that first.
Then, I also installed the following plugins from the “Technical Details” list:
- eclipse-egit (Git version control tools inside of Eclipse)
The rest of the plugins, I had to install from inside Eclipse. So, I launched Eclipse (pick any workspace). Then, I went to Help > Install New Software… I selected “All available sites” for the Work with option.
It showed “Pending…” for a while, but eventually, it showed a list of available plugins. These are the ones that I chose:
- Collaboration > Mylyn Context Connector: Java Development
- Collaboration > Mylyn Task List
- Collaboration > Mylyn Task-Focused Interface
- General Purpose Tools > Swing Designer
- Web, XML, Java EE and OSGi Enterprise Development > Eclipse Web Developer Tools
- Web, XML, Java EE and OSGi Enterprise Development > Eclipse Java Web Developer Tools
- Web, XML, Java EE and OSGi Enterprise Development > Eclipse XML Editors and Tools
- Web, XML, Java EE and OSGi Enterprise Development > PHP Development Tools
Then, click next. It will check for dependencies and let you review your choices.
Finally, you have to agree to the licenses.
Now, clicking Finish should begin the Download.
When it is done, you will need to restart Eclipse (not your computer, this is Linux).
I downloaded the SDK from the Downloads page.
You can check your download with:
$ echo "6cd716d0e04624b865ffed3c25b3485c android-sdk_r18-linux.tgz" | md5sum -c –
I like the SDK in my ~/app directory (Application Development). So, I used the following commands to extract and put it there:
tar -xzvf android-sdk_r18-linux.tgz
mv android-sdk-linux ~/app/
Next, I had to install the CDT Plugin into Eclipse. So, I opened Eclipse, and went to Window > Preferences. Then, I went to Install/Update > Available Software Sites. I clicked the “Add…” button. I added the URL from the instructions:
Then, I went to Help > Install New Software. I picked the new site, and I checked the Developer Tools.
I had to agree to install unsigned content.
Then, I rebooted Eclipse.
Once it started back up, it asked me about installing the API.
It asked about usage statistics:
Then, I had to accept the packages to install:
I just noticed that they finally have an official release, although beta, for Linux. So, I would like to install JavaFX to see what I can do with it.
I downloaded the SDK from JavaFX Developer Preview.
Again, I extracted the contents of the zip file, and moved the folder to my ~/app/ directory.
I tried adding the following URL as a site in Eclipse. Unfortunately, Eclipse 3.7 is not supported yet.
When you try to install software from the site, you’ll get this:
According to Stack Overflow, you can use JavaFX with Eclipse simply by adding the Jar file to your class path: <JavaFX Home>/rt/lib/jfxrt.jar. I’ll have to experiment some more later.
- Ubuntu Documentation: Java
- Java.com: Java Test
- Ask Ubuntu: How do I install Oracle Java JDK 7?
- Web Upd8: INSTALL ORACLE JAVA (JDK) 7 IN UBUNTU VIA PPA REPOSITORY
- Android Developers: Installing the SDK
- JavaFX for Eclipse | Get Started
- StackOverflow: How to use JavaFX 2 SDK in Eclipse?
- Vis-A-Vis: Working with JavaFX 2.0 in Eclipse