Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executable jars

 
Tom Triolo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created an application on a Windows Me machine, jar'ed the files and included a manifest.mf with the Main-Class: appWithMain (and a newline).
Windows Me doesn't recognize it as an executable but if I use the same jar file on a Win 98 machine, it starts. The Win Me machine pops up the old familiar, "Open With..." dialog.
What am I not doing right here?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom,
Do you have the JRE installed on the ME machine? If so then when it pops up the open with then select javaw and that should do the trick.
Hope this helps,
Michael Morris
 
Tom Triolo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jre is installed, this is the machine that I wrote and tested it on. I tried using javaw and it says it can't find the main class. My main class is listed in the third line of the mainifest.mf file which is in the meta-inf directory.
Manifest-Version: 1.0
Created-By: 1.4.0_01 (Sun Microsystems Inc.)
Main-Class: classWithMain
Directory structure is
two packages:
1) org.jakarta.apache.otherDirs
2) MyDir.myFiles
and the file with the classWithMain is not in a directory, but I guess you could say it is at the root of the jar file.

If I use java -jar jarFile, it starts but then it does throw an exception later when I try and do something else. Perhaps I have not included a file, or my structure is wrong.
Whhaadddyyaaa think?
Tom
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom,
You said in your first post the main was appWithMain but in your manifest you say classWithMain. Could that be the problem? Also what package is your main class in? If not in the default package that should be reflected int the manifest. You also need to be sure that you can't see any of the classes outside the jar (which may be in the jar) thru the CLASSPATH.
Hope this helps,
Michael Morris
 
Tom Triolo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is the class that contains main. It instantiates an object which is in the package that it imports. The classes in this package which is imported, themselves import classes from another package which is also in the jar file. The main class is not in any special package. I guess that may be the default package it is in then. And the manifest.mf file is in a meta-inf directory. I do not set any classpaths. It will start on a Win 98, as it is recognized as an executable. The Win Me does not recognize is as such.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic