Skip to main content

Ubuntu Linux: Changing From OpenJDK to Oracle JDK

Posted on September 25, 2013 by TerryCoxTerryCox

Oracle, Oracle, Oracle… why oh why did you buy Sun just to kill off Java? Sigh… As much as we might like to punt completely when it comes to Java in general, a large number of corporations have server and applications that are built on it. In fact, as a language, I love Java and have been using it since the pre-release version was called “Oak”. Since we need to run “real” Java and not the incomplete attempt to include a re-engineered JVM to avoid the non-open source licensing Oracle Java, we need to talk about how to replace it on a system that is running OpenJDK. So let’s have a go at it below.

So Where Exactly Is OpenJDK Installed?
The best way to use Linux tools on a Windows system is to, well, use Linux. If your system can support it, I recommend Oracle’s VirtualBox virtual platform. It’s easy to install, a cinch to configure and supports all modern 32/64bit distributions right out of the box. Once you download it, it can be installed like any Windows application.
This will get things going (you will have to reboot since it installs some virtual network device drivers in the TCP stack). Once you are done, you should see something like this:

VirtualBox With Ubuntu Running

Installing Ubuntu Linux in particular is a five minute process on any decent modern PC or laptop. Give it at least 2gb of memory and 1CPU when you set it up and it will run like a champ. Boot it to command prompt using GRUB for a Linux based terminal with everything you could need (coding, scripting and/or remote management).
Command Line and XWindows Server
If your system is a little less “beefy” and running a full virtual operating system on it might be too much for it to handle and still perform acceptably, we have another alternative that used to be extremely popular but has lost steam in the last couple of years because of a few stability and feature incomplete issues, but still a viable full “Linux-like” environment – CygWin.
Now, installation of Cygwin is a little more complex than VirtualBox since you will have to answer some questions. You will download and run a very small setup program (literally, called setup.exe) that will get things going. You will be asked to pick a mirror to begin downloading the catalog file from, which will then ask you what type of installation you want. I would stay away from the ‘custom’ installation type since there are a LOT of dependencies to keep track of and you may end up with an incomplete installation if you don’t get them all (or the installation script dependency script fails). The two best choices are “minimal” which will install common command line Linux utilities, shells and environment variables and then “full/complete” which installs everything, including the X Windows tools, terminals and X Server. I seem to have more luck by downloading all the packages first and then re-running setup and pointing it at the download directory. In either case, as a word of caution, this installation will take quite awhile, regardless of how beefy your system is. In addition to setting up the environment, there are a ton of post-install scripts for all the packages that have to be run before everything is said and done.
When it’s finally complete, you will have a number of menu entries in the Windows menu. You should have several categories including shell prompts and an XWindows menu. In this menu, you will find a shortcut to start a local XWindows server. Once it successfully starts, you will also get an xterm window to show that it works. This is great because now you can use SSH to tunnel remote X commands from other Linux systems and see them run locally. See below for an example:

Cygwin Connected to Linux Running KDE

Cygwin does have a few stability issues and only just recently was updated for Windows 8, but everything appears to have been ironed out. I run a full installation on my Windows 8 laptop and have only have problems when trying to run a full Linux desktop remotely, but that is as much because of system listeners that expect a full desktop to be run directly and not remotely. Window managers (like icebox and fvwm2) that are simpler run just fine (and surprisingly quick).
Scaling It Down
For any number of reasons, both of the options outlined above may simply be too much for your system (either because of resource constraints, corporate policies or a combination). Another alternative to getting a large amount of “Linux flexibility” can be had with a wonderful (and free to use) Windows application called MobaXterm.
Not only is this utility small (a single file that you can put wherever you want, no complex installation), but it is a fully contained remote management tool. It provides SSH command line access to anything you want of course, but it embeds the Cygwin X Window server (see above) so that you can tunnel X commands from your remote servers locally and see them display. It works every bit as well as the full Cygwin installation and doesn’t require the long installation. Once you fire it up, you will see something like this:

Mobaxterm Free Client

Why do I recommend this SSH client over Putty or any other number of terminal emulators? Well, because it is so much more in such a small footprint. It has SSH, X Windows support embedded, VNC client, RDP client AND Citrix Web client. You can save and configure it to run in the tabbed interface, full screen or windowed, whatever suits your fancy. The memory footprint is miniscule compared to any other client I have used and it’s fast and stable. You can pay for a customizable version of the application, for a reasonable $69 (about, that is the conversion as of the date of this article).
Final Thoughts
We have talked about a number of ways to get “Linux like” functionality on our Windows system. Using these tools and applications, you should be able to end up with a solution that you can live with regardless of your system specifications or corporate policies. On our desktop systems, we may have to live in a “Windows World”, but there is nothing that says that we can’t make ourselves comfortable in it!
Drop us a line in the comments below and describe how you get your Linux work done on a Windows system every day!

Comments are disabled for this article.