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

Read this.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.