aspose file tools*
The moose likes Beginning Java and the fly likes DOS command window 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 » Beginning Java
Bookmark "DOS command window" Watch "DOS command window" New topic
Author

DOS command window

Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
I have a small application ,I launch this application from a .bat,and I want to know if it's possible to launch this application without having a DOS window open! Is it possible to hide or close the dos window? Or any other way to launch the application?
Any help is welcome!
thx


Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Investigate using the javaw command (instead of java) in your batch file.
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
Thx I am investigating!
Jason Kretzer
Ranch Hand

Joined: May 31, 2001
Posts: 280
Try using "javaw" instead of "java -jar". javaw is what is called when you double click on a jar file. The only difference that I have found(I am sure there are others) is that it won't open a dos window to run. Which has advantages and disadvantages.
Adv: don't have a pesky dos window hanging around
DisAdv: don't have any place to read System.out.println that may generated from errors in running the jar.
HTH,


Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
I tried javaw instead of java. It works but the dos window is still opening, however now I may shut it down. I am still looking for a solution where the dos window does not open, or some code that will close the window automatically!
I think that it's not really professional to ask a user to close a window each time he start an application! Are your professional application working with that window?
Let me know please!
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
javaw.exe. used to not have a DOS window. However a zillion problems arose from not having a place to dump error messages, so now it also has one.
Yes - our production systems have DOS windows open with them. The users just minimize it if they don't like it.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Of course the easiest way is to put it in a jar file. Then just add a shortcut to the .jar file and run that directly. No pesky javaw or .bat files to worry about.
[ March 27, 2002: Message edited by: Thomas Paul ]

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Patrick Finnegan
Ranch Hand

Joined: Mar 05, 2002
Posts: 179
You need to call the bat file from a windows sub shell. For example:
c:> cmd /c test.bat
Carry out the command and terminate.
Use the /? flag to check the help.
c:> cmd /?
Younes Essouabni
Ranch Hand

Joined: Jan 13, 2002
Posts: 479
Thx for all your reply, I am thinking of doing a .jar, although I really don't know how to do it.
It can't be hard, so I'll find it!
Again thank you all!
Dave Turner
Ranch Hand

Joined: Mar 13, 2001
Posts: 60
If you create a batch file (.bat) to load your application using javaw, then you can set the properties of the command window (click on the A button) so that it loads in a minimized window and then closes on exit.
Hope this helps
Dave
Selvan tiru
Greenhorn

Joined: Jul 12, 2001
Posts: 18
Originally posted by Younes Essouabni:
Thx for all your reply, I am thinking of doing a .jar, although I really don't know how to do it.
It can't be hard, so I'll find it!
Again thank you all!


jar cvf "java class file names": It is similar to
tar archive command in unix
--Selvan
Selvan tiru
Greenhorn

Joined: Jul 12, 2001
Posts: 18
Originally posted by Younes Essouabni:
I tried javaw instead of java. It works but the dos window is still opening, however now I may shut it down. I am still looking for a solution where the dos window does not open, or some code that will close the window automatically!
I think that it's not really professional to ask a user to close a window each time he start an application! Are your professional application working with that window?
Let me know please!

Which version jadk is it?
javaw puts the dos window on the windows task bar. Yo udo not want to show the java application icon on the windows task bar?
Doanh Nguyen
Ranch Hand

Joined: Dec 02, 2000
Posts: 45
Originally posted by Younes Essouabni:
I have a small application ,I launch this application from a .bat,and I want to know if it's possible to launch this application without having a DOS window open! Is it possible to hide or close the dos window? Or any other way to launch the application?
Any help is welcome!
thx

Try:
SmartJ Java launcher, version 0.60, 4 May 2001
by author: Jonathan Revusky, jon@revusky.com
John Spindler
Greenhorn

Joined: Feb 12, 2002
Posts: 28
normally what I do is just create a shortcut to "javaw package.ClassName" and then execute that. The window does not appear and you can assign any icon you wish.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DOS command window