Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Beginning Java and the fly likes Executing a class in a Jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Executing a class in a Jar" Watch "Executing a class in a Jar" New topic

Executing a class in a Jar

Srihari Injeti
Ranch Hand

Joined: Jan 05, 2001
Posts: 31
I would like to execute a compiled class which is part of a jar from command line. The class has a main method.

Srihari Injeti<BR>SCJP2 MCP CIW
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Create a manifest and get it into the jar also. The manifest is what gives the JVM a clue as to which class to look in to find the main method.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
You may want to take a look at this introduction to creating an executable JAR file.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Executing a class in a Jar