2

I have installed JDK 32 bit as well as JDK 64 bit. I have 2 eclipse installations; Helios for Android and Indigo for Java EE. Now the problem is that when I set the class path for 32 bit Indigo is not working and when I set the path for 64 bit Helios is not working.

The error I get is:

failed to load the jni shared library
Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140

2 Answers2

4

The problem is that you're trying to load e.g. a 32 bit DLL using the 64 bit JVM, but a 32 bit JVM can only load 32 bit libraries and the other way around for a 64 bit JVM.

  • You could uninstall the 32 bit eclipse version and re-install it as a 64 bit version so both programs can use the 64 bit JVM
  • You can open the eclipse.ini and edit the -vm parameter to point to your correct JVM installation. So you need a 32 bit JVM installed parallel to the 64 bit JVM.
Marc-Christian Schulze
  • 3,154
  • 3
  • 35
  • 45
  • ,thanks for reply u mean i cant have 2 (32bit & 64 bit)jdk at a time ? – Heartbreak-kid Aug 06 '12 at 07:06
  • 1
    Correct. You can have multiple JVMs installed at the same time but only one JVM (JRE or JDK) on your system's `PATH` variable - otherwise the system would pick up the `javac` command for example only from the first directory. But eclipse allows you to specify which JVM to use when loading (-> `eclipse.ini`). So you can have your 64 bit JDK on the `PATH` and specify the path to your 32 bit JDK in the `eclipse.ini`. – Marc-Christian Schulze Aug 06 '12 at 07:11
  • thanks . good knowledge i got. 1 more ques? how to set in eclipse.ini .this is eclipse.ini i hav . -startup plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810 -showsplash org.eclipse.platform --launcher.XXMaxPermSize 512m --launcher.defaultAction openFile -vmargs -Dosgi.framework.extensions=net.rim.ejde.preprocessing.hook -Xms40m -Xmx512M -XX:MaxPermSize=512m – Heartbreak-kid Aug 06 '12 at 07:23
  • 1
    `-vm C:/Program Files/Java/jdk1.7.0_02/bin/javaw.exe` take care of the newline between `-vm` and the rest. Adjust your path for your needs. – Marc-Christian Schulze Aug 06 '12 at 10:19
  • @coding.mof:A 64-bit can not load a 32-bit DLL? Why? – Cratylus Aug 06 '12 at 21:17
  • 1
    That problem is not related to the OS but to the JVM. I don't know why the JVM is throwing this exception but it does. I assume that the JNI (which is used to load SWT of eclipse) doesn't detect 32 bit DLLs on a 64 bit JVM. One workaround is to [check the architecture in the Java code and load different libraries](http://stackoverflow.com/questions/5449029/loading-32-or-64-bit-jni-library-in-java). But this works only if you can access the code. ;) – Marc-Christian Schulze Aug 07 '12 at 05:48
0

You don't say OS. But in Windows the 64-bit java would install under Program Files while the 32-bit java under Program Files (x86). If you updated the eclipse.ini accordingly to point to the appropriate java installation (32/64) I think you should be ok

Community
  • 1
  • 1
Cratylus
  • 52,998
  • 69
  • 209
  • 339