JAVA: JAVA_HOME should point to a JDK not a JRE

Today when I was updating our JIRA instance I got the following error when I tried to start it:

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

This made no sense since I had Java installed so I did the right thing and checked my JAVA_HOME environment variable:

C:\>echo %JAVA_HOME%
C:\Program Files (x86)\Java\jdk1.6.0_25

So… the JAVA_HOME variable was pointing in the right direction. The problem turned out to be that the path to the JDK folder contained spaces (in Program Files (x86)). So I went to C:\ and ran the command dir/x to see what the sort name for Program Files (x86) was:

Volume in drive C is OS
Volume Serial Number is [none of you business]

Directory of C:\

21/08/2013 19:27 DIR eclipse
10/08/2012 17:09 DIR inetpub
22/03/2013 20:21 DIR NVIDIA
26/07/2012 09:33 DIR PerfLogs
23/07/2013 17:44 DIR PROGRA~1 Program Files
23/08/2013 09:14 DIR PROGRA~2 Program Files (x86)
08/07/2013 18:04 DIR Projects
14/07/2013 09:27 DIR Users
18/08/2013 17:38 DIR Windows
3 File(s) 14,643 bytes
12 Dir(s) 1,797,314,781,184 bytes free

The short hand version of Program Files (x86) was, as we can see, PROGRA~2. So I changed the environment variable to C:\PROGRA~2\Java\jdk1.6.0_25 by right clicking My Computer and selecting properties, then Advanced System Settings, Advanced tab, Environment Variables and locating it in the list (I’m using Windows 8 btw). That seems to have solved it.

Eclipse: annoying 32/64-bit installation issues

I just installed Eclipse on my new computer that’s running windows 8 and I ran into some problems. First I got the following error message:

A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
javaw.exe in your current PATH

This was due to the fact that I had actually forgotten to install java which was needed 🙂
I installed java and changed the eclipse ini-file to include the path to the JRE:

C:\Program Files(x86)\Java\jre7\bin\javaw.exe

I then got the following error message:

Java was started but returned exit code=13
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-jar C:\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
-os win32
-ws win32
-arch x86_64
-showsplash C:\eclipse\\plugins\org.eclipse.platform_4.3.0.v20130605-2000\splash.bmp
-launcher C:\eclipse\eclipse.exe
-name Eclipse
--launcher.library C:\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130521-0416\eclipse_1503.dll
-startup C:\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
-exitdata 1868_44
-product org.eclipse.epp.package.standard.product
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-jar C:\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar

I searched the internet and I found out that I had, for some inexplicable reason, installed a 32-bit version of Java on my 64-bit system. Why? Well, it turned out that my browser was a 32-bit version of Chrome and so when I entered and downloaded the installation package they handed me a 32-bit package which I installed. The fact that the path to the JRE included “Program Files(x86)” should probably have been a clue, but no.
I read up and it turned out I had to install both a 32-bit version and a 64-bit version and feed eclipse, which I downloaded as a 64-bit version, the path to the 64-bit JRE installation.

Then it worked fine 🙂

Eclipse: Adding FTP support

As I’m trying to use Eclipse for my PHP development instead of Notepad++ I’m going to have to get some kind of FTP plugin to Eclipse. The Notepadd++ plugin NppFTP is really just a perfect FTP plugin for the application and what I want for Eclipse is basically the same kind of support.
Well, there are two options; the first option is to install the Aptana Plugin (which according to a lot of people ruins your Eclipse installation and is impossible to uninstall) or install the Remote System Explorer End-User Runtime plugin (which is lightweight and does exactly what you want without bloating your install). We’re gonna go with the latter one.

To install the plugin, do the following:

  • Go to Help => Install New Software
  • Select your current Eclipse version´s release site (Helios for me)
  • In the filter textbox enter “remote”
  • Select the Remote System Explorer End-User Runtime

  • Click next and run the install (and restart Eclipse)
  • Go to Window => Open Perspective => Other => Remote System Explorer
  • Right-click in the perspective and select New => Connection

  • Click Next and fill in your FTP information
  • You’ll see your FTP in the Remote System Perspective and if you open up the nodes to your root you’ll be prompted for a FTP login
  • Done!



If you are using Java 7 then you will probably see errors such as this:

Operation failed. File system input or output error
Message reported from file system: Operation failed due to network I/O error ‘ Read timed out’

This seems to be a Java7 specific error and I keep getting it on one of my computer. The solution is as far as I can tell to downgrade to Java 6 which sucks…

Java: adding references to other projects in the same workspace

Coming from a C# background I couldn’t quite figure out how to reference projects in the same workspace in Java. In C# ( and Visual Studio) it’s as easy as cake to make a reference to a project in the same solution and I figured it had to work in Java as well. Eclipse turned out to have a feature that handles this and I thought I’d just write it down in case I forget and in case you who are reading this need to know :).

If you have a workspace with a couple of projects representing a layer each in a larger application it might look something like this:


Now, to make a reference to Test.Core in Test.Data (in order to use the Person class) you simply right click on Test.Data and go to Build Path => Configure Build Path and you will see the following window:

Select the Projects tab
Select the Projects tab

Select the projects tab and click the Add button and you should see the next window, select the project to reference and click Ok:


That’s it, now you have a reference to that project! I have yet to figure out where the references are stored and if Eclipse displays them or if you have to go to the output directory to check them out, but there you are. Good luck!