This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Opening .jar from .bat shortcut... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Opening .jar from .bat shortcut..." Watch "Opening .jar from .bat shortcut..." New topic
Author

Opening .jar from .bat shortcut...

Primoz Karnekaj
Greenhorn

Joined: Apr 19, 2009
Posts: 5
Hey,
I made a program in NetBeans and everything is working OK.
I created a .bat file, which opens the .jar program correctly, but also opens a "cmd window" next to .jar program.

This is in the .bat file:
"folder\program.jar"

This does the same thing:
java -jar "folder\program.jar"

Now I am wondering how one could open this .jar program itself without cmd window next to it, using a .bat file or some other shortcut? Are there any flags like -nocmd..

Thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18538
    
  40

I think the "javaw" command should work here...

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Primoz Karnekaj
Greenhorn

Joined: Apr 19, 2009
Posts: 5
javaw is not wroking, unless i'm doing something wrong..

Here is the screenshot to make thing clearer

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

The terminal you see is the one that the Batch file is executing in. In order to get rid of it you need to tell Windows to start the application in a 'new' window/terminal. You do this with the START command:


Steve
Primoz Karnekaj
Greenhorn

Joined: Apr 19, 2009
Posts: 5
Thank you very much for helping me out, it works perfectly!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening .jar from .bat shortcut...
 
Similar Threads
Batch file
To create a desktop short cut icon for the standalone application
Running application
How to include my own package in jar file
another question about exec() to open a cmd window