Reputation: 2483
The user wants to start the Java GUI application from Windows, with some amount of additional JVM parameters.
For instance:
javaw -Djava.util.logging.config.file=logging.properties -jar MyGUI.jar
If I add the above line to the batch file, the user can double-click the batch-file name.
And it's cool. But there is one annoying side effect: the batch file opens the cmd window before starting the GUI.
Is there a simple way to start the java GUI application by double-clicking the batch-file (or some other file which suits the above needs) without opening the cmd window?
Upvotes: 5
Views: 5305
Reputation: 1588
Try
start javaw -Djava.util.logging.config.file=logging.properties -jar MyGUI.jar
You can also use scripting:
VBS:
Const HIDDEN_WINDOW = 12
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("Notepad.exe", null, objConfig, intProcessID)
JScript:
var WindowStyle_Hidden = 0
var objShell = WScript.CreateObject("WScript.Shell")
var result = objShell.Run("cmd.exe /c abc.bat", WindowStyle_Hidden)
Finally, there are general-purpose utilities you can use to hide windows, such as CMDOW and Hidden Start ($20). I have not used either myself, since start
does the same thing.
Upvotes: 4
Reputation: 168845
The user wants to start the Java GUI application ..
The best user experience for the end user will be offered by launching the app. using Java Web Start. JWS can install desktop shortcuts and menu items to launch the app.
..from Windows..
JWS also works on OS X & *nix.
Upvotes: 3
Reputation: 3390
I see a number of ways:
.l4j.ini
file with the same name as the exe. In case of Exe4J, extra parameters can be specified in a .vmoptions
file which you drop next to the generated exe.Upvotes: 6