This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Java Executable file help? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Executable file help?" Watch "Java Executable file help?" New topic
Author

Java Executable file help?

Cheikh Sow
Greenhorn

Joined: May 23, 2005
Posts: 11
I hava created a jar file i can run it from my computer doing the following

java -jar filename.jar

But this same program when I click it on a windows machine it does not work saying it cant find main is that a normal behavior.

Note the windows XP machine has only JRE

Also I have only one class and the main method is inside of it.
in the manifest line I just write the name of my class.
thanks
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi,

Your manifest file should be something like this.


Main-Class: MyClass


and make sure that the text file(Manifest.txt) must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return

cheers,
Shankar.


"Failure is not when you fall down; its only when you fail to get up again."
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

You need to associate the .jar extension with the java (or, more likely, the javaw) command.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
jQuery in Action, 2nd edition
 
subject: Java Executable file help?
 
Similar Threads
xxxx.jar seen as xxxx.zip on desktop and won't run
Problem running jar on new Windows 7 install
Jar - more than 1 main
jar niggles
Converting .class to .com