• Post Reply Bookmark Topic Watch Topic
  • New Topic

executable jar help

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • 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
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I dint get this. Please someone give an example.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!