aspose file tools*
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
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: 18896
    
  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: 4181
    
  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!

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Opening .jar from .bat shortcut...