aspose file tools*
The moose likes Java in General and the fly likes DOS window still coming when I run the Application using javaw Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "DOS window still coming when I run the Application using javaw" Watch "DOS window still coming when I run the Application using javaw" New topic
Author

DOS window still coming when I run the Application using javaw

Rajasekaran Anand
Greenhorn

Joined: Sep 13, 2001
Posts: 23
I am running xindice using javaw but ,it is still showing the DOS window.Can any body tell me how can I come over it..
Rajasekaran Venkadasalam
Greenhorn

Joined: May 16, 2002
Posts: 8
hello do you know why javaw is used for...it is used to open the executable jar file.
please study the documentation..if you dont have doc please refer me..Okay
:-)
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

have you tried adding 'start'?
as in:
start javaw my.App
I don't actually care enough to go find out the diffence, but this is what i generally do.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi All,
I've been avoiding this one but start doesn't work either. I tried writing a small java boot program that used "start java prog" but it threw an exception in Win32Process. I even tried writing a C++ boot program to do the same thing using CreateProcess and it just sat there looking stupid: the java VM never started. The only other possibility I can think of is to write a C++ program and use spawn and then cut the parent loose from the child and then have the parent exit.
Boy some things are so much easier to do in Unix/Linux!
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

OK, I was lazy and didn't state that I believe 'start' only works in NT/2k/XP.
I know it works in some cases and these are the only ones I've tested it in.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Well, I am a bit confused. How are you running javaw xindice in the first place? From a batch file? I don't think that javaw is intended to get rid of the DOS screen as in it does not appear. I know that when you launch a java program using javaw from the DOS prompt, then you can close that DOS prompt without terminating the java application. It is the same as saying:
java xindice &
in linux. It runs the app as a seperate process from the DOS window.
Now, I have noticed that when running a batch file that uses javaw, in Windows 95, the DOS window opens then closes almost immediatly. But on Windows XP the DOS window stays open and I just have to close it.
Have not tested on other OS's.
[ August 08, 2002: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi David,
I'm using Win 2k Pro. Can't get rid of the damn command window no matter what I try. Batch files, boot programs, start, javaw, whatever. Another big problem with this is that just closing the command window will kill the VM that it owns without notifying it. So you can't prevent a user from shutting down, possibly leaving your program in a state of disarray. I hope someone comes up with a solution for this.
Michael Morris
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Originally posted by Michael Morris:
Hi David,
Another big problem with this is that just closing the command window will kill the VM that it owns without notifying it. So you can't prevent a user from shutting down, possibly leaving your program in a state of disarray.
Michael Morris

This is not true if you use JAVAW to launch you application.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi all,
I just tried using "javaw" and my java boot program does work using "javaw" instead of "start java" but as Greg indicated on NT Kernal machines you have to manually close the command box.
Here's the boot program:

Of course it wouldn't be too dificult to pass the class file and any parameters for it in main's args, instead of a hardwiring it.
Michael Morris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DOS window still coming when I run the Application using javaw