aspose file tools*
The moose likes Java in General and the fly likes Running a runnable jar File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Running a runnable jar File " Watch "Running a runnable jar File " New topic
Author

Running a runnable jar File

Maya sekar
Ranch Hand

Joined: Sep 22, 2011
Posts: 70
Hi guys,

I recently created a runnable jar file, successfully. When I deploy it though command prompt I get the output like i ought to. But when I build the runnable jar into the lib folder of a web application project and run it though the server I cannot get it to deploy. I have defined the main class and the class path in the manifest file of the web app project as well. So why is it not working?

Any help is much appreciated.

Thanks and have a nice day
tsaowe cao
Greenhorn

Joined: Jul 14, 2011
Posts: 5

have you include your jar in your build path ? if you use eclipse,right click the jar and select build path - > configure build path , then add your external jar into the project,may it help
Maya sekar
Ranch Hand

Joined: Sep 22, 2011
Posts: 70
Hi tsaowe,

thank you for your response. and by build path you mean adding the jar to the lib folder under WEB-INF where rest of the referenced jar files are added? Then yes, I had done it.... But I still can't get it to work... I so desperately need to figure out why it isn't working...

Many thanks and have a nice day
tsaowe cao
Greenhorn

Joined: Jul 14, 2011
Posts: 5

eh

can your jar file run under command line?when you type command like "java -jar ***.jar com.pkgname.Classname" under windows console and will respond?

if so,add your ***.jar full path alongside with the previous classpath in environment variables,this must work!


most time,i think if the IDE settings is not properly setted and many strange may occur,you may restart your ide and try again,if not that case,think over again your operation,maybe you miss some step.

may it help!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14113
    
  16

So you have an executable JAR file (with a manifest file, a Main-Class attribute etc.) and you're putting it in the lib folder of a Java EE app server?

What do you expect to happen? That the server will somehow automatically run the program? That's not going to happen - Java EE app servers don't treat executable JAR files as if they are programs that have to be started when you deploy them or start the server.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Maya sekar
Ranch Hand

Joined: Sep 22, 2011
Posts: 70
Hi Jesper,

I have a runnable Jar in the lib folder of a dynamic web project in my eclipse, I have a manifest file with the main class and class path attributes and as far as i understand (do correct me if I am wrong) providing the main class name under the main class attribute in the manifest file should cause the main class to load and run once the program starts... am i wrong?

Hi tsaowe,

My jar file does run when I run it from command prompt using the java -jar jar_name.jar...

Thank you for your response guys... you are helping me a great deal
 
 
subject: Running a runnable jar File