aspose file tools*
The moose likes Beginning Java and the fly likes Creating a jar file from the command line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Creating a jar file from the command line" Watch "Creating a jar file from the command line" New topic
Author

Creating a jar file from the command line

leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
I have a swing based application in a package called moiveJava2. My moment interval class, WindowGUIMI, has one main method which instantiates the rest of the application from another class called WindowGUI.
I have created a manifest file called MovieJava2.MF which has one line equal to:
Main-Class: WindowGUIMI //plus a carriage return
My dos command lines thus far have been:
C:\java_programs\MovieJava>jar cvf MovieJava2.jar movieJava2\*
C:\java_programs\MovieJava>jar cmf MovieJava2.MF MovieJava2.jar movieJava2\*.class
When I double click on the jar file I get a JVM Launcher error dialog which says: "Could not find the main class. Program will exit".
What have I done wrong here?


Thanks, leo
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

how about trying to change your Main class def'n to:
Main-Class: moiveJava2.WindowGUIMI //plus carriage return
so it specifies the fully qualified class name of your application?


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
Jessica,
You are the best! That worked. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a jar file from the command line
 
Similar Threads
Compiling and running two source files
manifest file question
Problem with JAR file
jar executable won't work when copied into desktop
Can't get a jar to run with dependencies