If you want to check if your -vm eclipse.ini
option worked correctly you can use this to see under what JVM the IDE itself runs: menu Help > About Eclipse > Installation Details > Configuration tab. Locate the line that says: java.runtime.version=...
.
String runtimeVersion = System.getProperty("java.runtime.version");
should return you a string along the lines of:
1.5.0_01-b08
That's the version of Java that Eclipse is using to run your code which is not necessarily the same version that's being used to run Eclipse itself.
Eclipse uses the default Java on the system to run itself. This can also be changed in the eclipse.ini file in your eclipse install folder.
To find out the version of java that your eclipse project is using, see Project->properties->build path->Libraries tab and see the JRE system library thats being used. You can also check it out at Window->Preferences->Java->Installed JREs. This is a list of all JREs that eclipse knows about
To find out using code, use the System.getProperty(...) method. See http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#getProperties() for supported properties.
Under the help menu, there should be a menu item labeled "About Eclipse" I can't say with absolute precision because I'm using STS which is the same thing but my label is different.
In the dialog box that opens after you click the relevant about menu item there should be an installation details button in the lower left hand corner.
The version of Java that you're running Eclipse against ought to be in "System properties:" under the "Configuration" tab.
Don't about the code but you can figure it out like this way :
Go into the 'window' tab then preferences->java->Installed JREs. You can add your own JRE(1.7 or 1.5 etc) also.
For changing the compliance level window->preferences->java->compiler. C Change the compliance level.
try this :
public class vm
{
public static void main(String[] args)
{
System.getProperty("sun.arch.data.model")
}
}
compile and run. it will return either 32 or 64 as per your java version . . .
There are various options are available to test which java version is using your eclipse. The best way is to find first java installed in your machine.
run java -version command on terminal
then to check whether your eclipse pointing to the right version or not.
For that go to
Eclipse >> Preferences >>Java >>Installed JREs
Source: Stackoverflow.com