I want to know the bit type of eclipse installed on my machine whether it is of 32 bit or 64 bit version as i need a function in java which return the bit version of eclipse.
thanks
I want to know the bit type of eclipse installed on my machine whether it is of 32 bit or 64 bit version as i need a function in java which return the bit version of eclipse.
thanks
You can check it from eclipse.ini file present in eclipse Home directory.
Example:
if --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_641.1.200.v20130521-0416 then it is 64 bit and if --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x8632_1.1.200.v20130521-0416 then it is 32 bit.
There is also an Eclipse API for that.
You will need to add org.eclipse.core.runtime
dependency into your plugin and then in org.eclipse.core.runtime.Platform
class there is a static method getOSArch()
that returns the current system architecture. You can compare it to the constants defined in the same class (e.g. ARCH_X86_64
or ARCH_X86
).
As stated in the javadoc it will default to java.lang.System.getProperty("os.arch")
if the architecture is not specified on the command line.
Assuming that this program is going to run within Eclipse (e.g. is a plugin), then there will be a number of properties in the System Properties object that will tell you this. For instance:
java.vm.name contains the name of the current JVM which (for Hotspot at least) includes "32-Bit" or "64-Bit".
org.osgi.framework.processor tells you the "the Framework host-computer's processor name", which on my Eclipse is "x86-64".
osgi.arch tells you the "platform architecture" which on my Eclipse is "x86-64".
Now it is not entirely clear what the last two mean, so you should probably do some experiments.
If you need to do this externally to Eclipse, then you could try running the Linux / Unix "file" command on the Eclipse executable and picking apart the resulting string.
finally i think for plugin purpose System.getProperty("osgi.arch")
is perfect it returns x86 for 32 bit eclipse and x86_64 for 64 bit eclipse.