views:

456

answers:

4

I have developed a Java swing application, then I have deployed it through a .jar package.

I run my application on my PC double-clicking over the .jar file and everything goes fine, everything goes fine from command line (dos prompt) too.

Here my problem. I have tried to run my app on another PC:

  • same OS (Windows XP)

  • same JRE (1.6.0_U13)

  • but Oracle JInitiator 1.3.1.18 installed (this is the only difference with my PC)

The app works fine only from command line, but not from gui!

Double-clicking over the .jar file I get this error:

`Could not find the main class. program will exit!`

Can this error be due to some conflict between JRE and JInitiator?

Does anybody had the same trouble?

Thanks


edit:

executing .jar files from gui is associated to the "javaw" command

+3  A: 

It is probably a conflict with JInit, which changes the association between jar files and the java command used to launch them.

See this thread.

Re-installed java and the problem has gone away.

VonC
java reinstalled before posting here, and nothing changed :(
Giancarlo
argh. Then can you double check the file association currently defined in Windows for jar file ?
VonC
+1  A: 

Have you checked your PATH/CLASSPATH/JAVA_PATH variables. It is possible that Jinitiator has installed the wrong version at the front.

MatthieuF
A: 

Possibly check your manifest entries. See if the MANIFEST.MF in the jar contains the Main-Class attribute set correctly to the class that is supposed to be invoked, if not try setting it.

Ram
manifest.mf contains the right main-class attribute...
Giancarlo
+1  A: 

A quick description might be - jinitiator installs as a fully implemented JRE with some additional features for cached downloads when dealing with applets.

As all the JRE installers I've seen lately do, regardless of if they are new or old, they replace several entries in the registry to become the active JRE. Whatever you installed last will be run unless you provide a full path to java.exe or change the registry to re point at a different JRE.

examine:

  • HKEY_CLASSES_ROOT\jarfile\shell\open\command and see if the path to javaw.exe is correct. (or even included)
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\java.exe and javaw.exe and javaws.exe to check the path there also.
Greg Domjan
thanks, I'll check this at work tomorrow :D
Giancarlo