1

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

rahulsri
  • 2,271
  • 3
  • 14
  • 11
  • Huh? Please rephrase your question: what exactly are you trying to do? – paulsm4 Feb 02 '12 at 06:36
  • More to explain: I have a program which does not work in 64 bit version of eclipse and it needs another snippet of code so i want to put a check whether eclipse is of 32 bit version or 64 bit version. – rahulsri Feb 02 '12 at 07:09
  • Java is meant to be architecture-independent: it should work exactly the same on 32-bit or 64-bit architectures. (If you're using native functions or something extremely complex, it might be a different story, but this seems unlikely.) – Louis Wasserman Feb 02 '12 at 07:19
  • 1
    This is a duplicate of http://stackoverflow.com/questions/5103366/how-to-find-out-if-an-installed-eclipse-is-32-or-64-bit-version – SDS Aug 12 '14 at 15:42

4 Answers4

2

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.

1

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.

fikovnik
  • 3,133
  • 2
  • 24
  • 29
0

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.

Stephen C
  • 632,615
  • 86
  • 730
  • 1,096
  • I have got these two org.osgi.framework.processor and osgi.arch in help->about>installation detail-> configuration, but how i can read these information through programming. – rahulsri Feb 02 '12 at 08:31
  • I think they should have been added to the System Properties object. – Stephen C Feb 02 '12 at 15:38
0

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.

rahulsri
  • 2,271
  • 3
  • 14
  • 11