ewok
ewok

Reputation: 21443

how to run 32 bit jar on 64 bit jvm

I downloaded a java app (a desktop LogCat viewer from android logs) and am trying to run it. My problem is that I amm getting an error that seems to imply I cannot run a 32 bit java app on a 64 bit jvm. The stack trace is below.

I need to point out that I cannot change the source. I don't have access to it. I need to know how I can configure my jvm to run the jar. I'm running in Windows 7.

> java -jar LogcatOfflineViewer_20120505.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
        at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
        at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
        at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
        at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
        at com.logcat.offline.UIThread.runUI(UIThread.java:112)
        at com.logcat.offline.Main.main(Main.java:6)
        ... 5 more

Upvotes: 3

Views: 23081

Answers (2)

lib
lib

Reputation: 2956

I had a similar problem which I solved ensuring to run my jar on the correct jvm by giving the full path in the command prompt (I had already 2 versions of java in my system)

It seems that you can also use the -d32 or -d64 switch, even if in my system that didn't work (see this and other alternatives is How to run 32-bit Java on Mac OSX 10.7 Lion )

Upvotes: 1

Peter Lawrey
Peter Lawrey

Reputation: 533492

A JAR is not 32-bit or 64-bit, it can run on either JVM.

However, a native shared library is either 32-bit or 64-bit and it can run only with a JVM with that bitness. This is a limitation of the way application run on Windows and Linux (and every other OS AFAIK) There is no way to load a 64-bit library on a 32-bit JVm or visa-versa. You need to match your sahred libraries versions with your JVM.

Upvotes: 9

Related Questions