0

Hello again,

I've been around some threads here, some interesting, some piqued my interest. Like, forgive my ignorance, but how does one run a jar file. What special is required to run such a file? All I know is winrar a jar file and you get all these coded .class files, which has no meaning with a code, from my point of view. Please someone explain I can run a jar file without the actual source code.

Ronica

3
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by stephen84s
0

if the jar you have is an executable jar, just doubling clicking on it should make it run, However if that doesn't work the at the command line type:

java -jar filename.jar

If that too doesn't work (which means the manifest file was not properly included with the jar), you will have to give specify the Main class of your jar. For example if the main class is Alpha inside the package "daniweb" which in turn is inside the package "com", you will have to type:

java -cp filename.jar com.daniweb.Alpha

Also here is the chapter from The Java Tutorials covering the basics and uses of Jar files.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.