[英]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. 我下载了一个java应用程序(来自android日志的桌面LogCat查看器),我正在尝试运行它。 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.
我的问题是我收到一个似乎暗示我无法在64位jvm上运行32位Java应用程序的错误。 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.
我需要知道如何配置我的jvm来运行jar。 I'm running in Windows 7.
我在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
A JAR is not 32-bit or 64-bit, it can run on either JVM. JAR不是32位或64位,它可以在任一JVM上运行。
However, a native shared library is either 32-bit or 64-bit and it can run only with a JVM with that bitness. 但是,本机共享库可以是32位或64位,只能使用具有该位数的JVM运行。 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.
这是应用程序在Windows和Linux(以及其他所有操作系统AFAIK)上运行的方式的限制。无法在32位JVm上加载64位库,反之亦然。 You need to match your sahred libraries versions with your JVM.
您需要将sahred库版本与JVM相匹配。
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) 我有一个类似的问题,我解决了通过在命令提示符中提供完整路径确保在正确的jvm上运行我的jar(我的系统中已经有两个版本的java)
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 ) 看来你也可以使用-d32或-d64开关,即使在我的系统中没有工作(请参阅此和其他替代方法是如何在Mac OSX 10.7 Lion上运行32位Java )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.