问题
I have just developed and exported a Runnable JAR using Eclipse on my 64 Bit Windows 7 Laptop. I have just been trying it on other computers and it works on another Windows 7 x64 laptop when you double click it. However, on a 32 Bit laptop I have in only starts if I run it from command line using java -jar "C:\Name of Jar.jar"
but throws no errors whatsoever.
Furthermore though, if I use the command javaw "C:\Name Of Jar.jar"
I get an error message saying "Could not find the main class C:\Name of Jar.jar. Program will exit."
Does anybody know why, and how to fix it? Thanks in advance
回答1:
Did you build it with JDK 1.7? Maybe you haven't installed JRE7 on the pc you try to run it. It's an odd bug I encountered several times.
回答2:
On your 32-bit machine right-click -> Open With on the JAR. If a JRE is listed, you can open with it, and make it the default program to run with.
I don't think it has to do with the 32 or 64-bit OS.
回答3:
Try javaw -jar jar_name
. I think that might do the trick.
来源:https://stackoverflow.com/questions/12288141/jar-compiled-on-64-bit-windows-wont-run-on-32-bit