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?
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
Joined: Sep 22, 2011
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...
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.
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.
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?
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