JackBauer
JackBauer

Reputation: 135

Why System.getProperty("java.home") works different for Eclipse 3.4, 3.5, 3.6?

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:

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")?

Upvotes: 0

Views: 6317

Answers (3)

JackBauer
JackBauer

Reputation: 135

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!

Upvotes: 0

Koekiebox
Koekiebox

Reputation: 5963

You can check your Project Build Path:

Example: alt text

Upvotes: 2

kgiannakakis
kgiannakakis

Reputation: 104188

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.

Upvotes: 0

Related Questions