0

I develop plugins (to be honest I started not so long time ago) and test my plugins on different Eclipses. I have Eclipse 3.4, 3.5, 3.6 installed. in C:\Program Files\Java there are:

  • jdk1.5.0_22
  • jdk1.6.0_21
  • jre1.5.0_22
  • jre6

for all versions of Eclipses, in here (Windows -> Preferences -> Installed JREs) there is "jdk1.5.0_22" with the path "C:\Program Files\Java\jdk1.5.0_22"


So, can not figure out why for Eclipse 3.5 and 3.6 this

 System.getProperty("java.home")

prints

C:\Program Files\Java\jdk1.5.0_22\jre

but in Eclipse 3.4 it prints

C:\Program Files\Java\jre6

Could anyone give me a glue which value is used by System.getProperty("java.home")?

Koekiebox
  • 5,793
  • 14
  • 53
  • 88
JackBauer
  • 135
  • 1
  • 3
  • 10

3 Answers3

2

You can check your Project Build Path:

Example: alt text

Koekiebox
  • 5,793
  • 14
  • 53
  • 88
0

The java.home property returns the Java installation directory. In Windows, this is set either with the JAVA_HOME environmental variable or in the eclipse.ini file. It could be also given as a command parameter in the eclipse.exe.

You can read some instructions about running eclipse here.

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
  • The problem is that here http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F it says Eclipse DOES NOT consult the JAVA_HOME environment variable. And there is no -vm option in eclipse.ini files for all version (3.4, 3.5, 3.6), just verified. – JackBauer Dec 09 '10 at 07:30
  • "java.home" is a system property (http://www.mindspring.com/~mgrand/java-system-properties.htm), and, as I can guess, depends ONLY on installed version of Java. So, it is very strange that the its value is different on the same PC for different Eclipse versions. – JackBauer Dec 10 '10 at 01:48
0

Here, there is explanation how to solve similar problem http://tech.karolzielinski.com/m2eclipse-eclipse-is-running-in-a-jre-but-a-jdk-is-required In my case it was enough to add -vm option to eclipse.ini file for Eclipse 3.4.

-vm
C:\Progra~1\Java\jdk1.5.0_22\jre\bin\javaw

Thanks everyone!

JackBauer
  • 135
  • 1
  • 3
  • 10