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

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: 23958
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 ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic