Steve Cohen
Steve Cohen

Reputation: 4859

How to run a java application from a batch file under Windows 7 without popping up a console window?

I can't believe this is difficult. But all the stuff I'm reading on Microsoft sites says to run the batch file minimized - which is ridiculous, or launch via VB script???? I have to run a VB script to launch a batch file??? This is insanity.

Upvotes: 1

Views: 3659

Answers (4)

Ertyui
Ertyui

Reputation: 908

Perhaps making it a exe file by: http://viralpatel.net/blogs/convert-jar-to-exe-executable-jar-file-to-exe-converting/

Or by doing this:

@echo off
start /B server.jar [arg1] [arg2]  
start /B server.jar [arg3] [arg4]
@echo on

Found here: Launch .jar files with command line arguments (but with no console window)

Upvotes: 0

Jeff Demanche
Jeff Demanche

Reputation: 764

@echo off
cd C:/link
javaw -jar jarfile.jar

Use this for your batch file.

Upvotes: 0

Sarel Botha
Sarel Botha

Reputation: 12700

  1. Use jsmooth to create an exe. http://jsmooth.sourceforge.net/. It will also detect the location of Java and if the user doesn't have it installed offer to download it for the user.
  2. If you don't mind it flashing the black window when you run the .bat file use javaw -jar myapp.jar in your batch file.

Upvotes: 0

Starkey
Starkey

Reputation: 9771

Run the javaw executable, not java.

Upvotes: 4

Related Questions