Win a copy of Terraform in Action this week in the Cloud 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Executable jar files with CLI programs?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I looked at the thread on creating executable jar files at https://coderanch.com/t/391746/java/java/Game-Tutorials-Creating-Executable-JAR and this worked fine for an application, but I don't know if it's possible to do the same with a program that runs in the command prompt. Any ideas?

Thanks!

[EDIT by mw: Repaired link.]
[ February 05, 2006: Message edited by: marc weber ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Flo Powers:
this worked fine for an application, but I don't know if it's possible to do the same with a program that runs in the command prompt.


Whether you run your application from the command prompt or from an IDE or from TextPad or from a bat file, it works the same way. I guess I don't understand your distinction between "an application" and "a program".
 
Flo Powers
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, careless wording on my part. What I mean is, I've made two different programs, one that displays a GUI using swing, and one that runs in the command prompt (or perhaps "console" is a better word for it?). I made two different executable JAR files (using Eclipse - really easy). However, when I click on the one that has a GUI, it loads fine. When I click on the one that requires a console in which to run, nothing happens.

Is there a(n easy) way to make this CLI program run when I double-click the JAR file?

Hope that was a bit more precise. Thanks again!
[ February 08, 2006: Message edited by: Flo Powers ]
 
author
Posts: 23909
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is probably a minor error -- but you can't see it, because windows terminates the cmd window as soon as the programs ends.

I suggest that you write a very simple batch file, with the single command:



The "/k" option will force the window to stay, so you can see what the error is.

Henry
 
Flo Powers
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer, but I'm afraid I'm going to need a bit more help.

I've never written a batch file, so... the line of code you wrote goes in the batch file?

Flo

Wow! I tested it - put the line in a text file (with the rigth jar file name), saved it as a .bat file and double-clicked it, and voila! It works!

THANK YOU! )
[ February 21, 2006: Message edited by: Flo Powers ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic