• 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

Executable jars

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic