This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes help with running executable JAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help with running executable JAR" Watch "help with running executable JAR" New topic

help with running executable JAR

kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
...class files are packed in a JAR using
%jar -cvmf manifest.txt genApp GenApp.class

I can see icon for JAR, but when i double click, nothing happens. even using with..., JAR still doesn't open!
someone please help this beginner...!!!

Who dares, wins! (SAS motto)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

What's in For this to work, it would need to contain a line

Main-Class: GenApp

GenApp also needs to have a method named

public static void main(String[] argv)

You could type

java -jar genapp.jar

at the command line and you would get a (possibly informative) error message if it didn't work.

[Jess in Action][AskingGoodQuestions]
kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
manifest.txt has
Main-class: GenApp

when I run
java -jar genApp.jar
i get "NoClassDefFound" error. but when i run java GenApp, the program runs fine?
kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
i've figured it out. the problem was that when i ran the jar tool, i wrote
%jar -cvmf manifest.text genApp GenApp.class, instead of using *.class, so only one class was found, and not the other nested classes
[ July 23, 2005: Message edited by: kwame Iwegbue ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: help with running executable JAR
It's not a secret anymore!