Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Running a runnable jar File

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 5
IntelliJ IDE jQuery Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
IntelliJ IDE jQuery Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Maya sekar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
A timing clock, fuse wire, high explosives and a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic