Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in executing jar with windows 7 64 bit

 
Gurumoorthy Doraiswamy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created a batch file which internally calls the jar and the start up class as below

java -cp "jars/JPLSyncApp-1.0-SNAPSHOT.jar;jars/*" Welcome.App.

I use Netbeans with JDK 1.6 as Default. This file works normally in windows 7 32 bit. But when i try the same with windows 7 64 bit which has JRE 1.7 and try to run the batch file as administrator then i receive the below error message
"could not find or load main class".

i tried to build the app with JDK 1.7 but that too does not work with the 64 bit machine. I am .NET Developer there we have build configuration where we can specify 32 bit or 64 bit. if an application is built against 32 bit it will normally work in 64 bit. But why does this happen here.

Do i need to set any classpath or do i need JRE 6 to run. Please advise.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the .jar file was created, which JDK did you use, 32 bit or 64 bit?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15359
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mansukhdeep Thind wrote:When the .jar file was created, which JDK did you use, 32 bit or 64 bit?

Whatever the answer to that question is, it doesn't matter. There is no 32-bit or 64-bit in the Java world; bytecode is not 32-bit or 64-bit, and class files compiled with a 32-bit JDK will run on a 64-bit JVM and vice versa without any changes.

The only thing I see that's a bit strange is that you use forward slashes / in your classpath, while Windows expects backslashes \ to separate elements in a path (although sometimes Windows seems to understand forward slashes too). You could try using backslashes:

java -cp "jars\JPLSyncApp-1.0-SNAPSHOT.jar;jars\*" Welcome.App

Note also that you have a dot "." after "Welcome.App", I don't know if you're really typing that dot or not. Leave it out. (Details are important!).
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then why is there a different installable for JDK for 32 bit and 64 bit platforms?
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 32 bit and 64 bit JVMs are different, hence different installables.
Also the Java compiler (.exe) in itself is native, so it has different version for 32 and 64 bit machines.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean to say that the Java compiler is implemented in native language (like C , C++ etc.). Cool..
 
Campbell Ritchie
Sheriff
Pie
Posts: 49396
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mansukhdeep Thind wrote:You mean to say that the Java compiler is implemented in native language (like C , C++ etc.). Cool..
I don’t think so. I think javac is implemented in Java, but I am not sure. The heap and stack are probably C, however.
Go to the openJDK website and you can download the whole of it and inspect it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic