• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

DOS command window

 
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Investigate using the javaw command (instead of java) in your batch file.
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thx I am investigating!
 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 479
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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, [email protected]
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic