• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

executable jar help

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I want to make an executable jar. I have done this many times, only with gui applications. Now this application does not have any gui. I tried to create jar in same way. The manifest which i used is below. I dint get any promp. i need this to run in command prompt.


Main-Class: Test

Name: Test



Thanks and Regards
alexander
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks right, assuming you have a class in the jar named Test, which is in the default package, and has a main method. You could test it from the command line using:

java -jar the.jar

If you want it to run by clicking an icon, then the problem might be what action you associate to an executable jar. It's been awhile since I've done standalone java programs, but it seems to me there is a regular "java" command and "javaw". The purpose of "javaw" is to run GUI-based program where you don't want a command prompt window to open. If that's what you're using, that could be your problem.
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. I can run the jar from command line using java jar - test.jar. Isn't there any way to run directly.


Thanks.
 
Greg Charles
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By running it directly, you mean clicking on the icon or something similar through your window manager, right? Whatever operating system you're using, there's a way to associate an executable program like the JVM with a file type like the jar. My guess is you are using Windows and have javaw.exe associated with jars, therefore no console window opens when your run your test. Changing the association to java.exe should fix that.
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dint get this. Please someone give an example.
 
You can't have everything. Where would you put it?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic