• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in executing jar with windows 7 64 bit

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the .jar file was created, which JDK did you use, 32 bit or 64 bit?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then why is there a different installable for JDK for 32 bit and 64 bit platforms?
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean to say that the Java compiler is implemented in native language (like C , C++ etc.). Cool..
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic