This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes java and javaw Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java and javaw" Watch "java and javaw" New topic
Author

java and javaw

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear Friends,

I have a '.bat' file from which an executable jar is called. If i use

start javaw -jar <jarname> its not working but if i use

start java -jar <jarname> thejar gets executed.

I'm not calling any GUI application from the jar. The jar contains an ordinary class file.

What is the exact difference between java and javaw?

Kindly provide your help.

Regards,
Vijay
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

java keeps running until the application ends. If you call it from a shortcut, it opens a command box which won't close until the application ends.

javaw starts the application in a separate process, then exits immediately. If you call it from a shortcut, there won't be a command box. It should usually only be used with GUI (AWT/Swing/SWT/...) applications, because you can't interact with any command line application nor see its output.


So what is probably happening with your .bat file is that it is a command line application, and you don't see the command box like you're used to.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java and javaw
 
Similar Threads
Annoying DOS window
convert java application to exe file
Jar executible file
Console and Swing Application
java database help