Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javaw and bat files

 
Zabe Agha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Zabe Agha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic