wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes javaw and bat files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "javaw and bat files" Watch "javaw and bat files" New topic
Author

javaw and bat files

Zabe Agha
Greenhorn

Joined: Feb 27, 2003
Posts: 19
Hi -- I hava a bat file which executes a JAR file using javaw. However, this type of startup still keeps the dos window from the bat file open. I was under the impression that using javaw kept the dos window from opening. Am I missing something?
The contents of my run.bat are:
----------------------------------
@echo off
if "%JAVA_HOME%" == "" goto error
%JAVA_HOME%\bin\javaw -jar testbed.jar
goto end
:error
echo ERROR: JAVA_HOME not found in your environment.
echo Please, set the JAVA_HOME variable in your environment to match the
echo location of the Java Virtual Machine you want to use (e.g. c:\j2sdk1.4.2).
pause
:end
exit
----------------------------------
Anyone have an idea either what I'm doing wrong or how to resolve this issue?
Also, let me add that I don't want to use the JAR file to launch my program.
Thx in Advance,
Zeb
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

If the .bat file doesn't pop up a window, where's that error message you print out going to show up?

If you want, you could edit the 'target' field of the shortcut to contain the call to javaw, but you're not going to get any of the error handling like you have in the batch file.

You could also change the 'Run' field of the shortcut to 'Minimized' and then even though a window is created, it only shows up on the task bar initiallly.

And, just wondering, why don't you just make an executable JAR file?
[ September 16, 2003: Message edited by: Nathan Pruett ]

-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Zabe Agha
Greenhorn

Joined: Feb 27, 2003
Posts: 19
Thanks for the suggestions Nathan, however I'm not the "owner" of this software and trying to find a solution other than the ones I've found so far.
FYI, I _did_ find a solution which I'd like to post in case others have a similiar problem in the future.
In the bat file, I changed the following from:

to:

This pops up the bat file momentarily and then makes it dissapear and still lets the program run just fine. In case you use this method however, you need to make sure javaw (or the bin dir its in) is in your classpath.
[ September 16, 2003: Message edited by: Aurangzeb Agha ]
 
Consider Paul's rocket mass heater.
 
subject: javaw and bat files