I want to execute a 3rd party program (VLC in my case) without any window popping up in Windows. I am running my java program as a Windows service which works fine, but when I start VLC using Runtime.exec() then a window pops up, no matter what I do. There’s command line arguments to VLC that prevent the GUI but then a black console pops up – not much better.
So: Any idea how to start an external program from Java so that no visible window shows up? (It works just fine in Mac OS X and I assume Linux will be the same)
I know there is a way to directly integrate libVLC into your Java program but that option does not work for me.
There’s probably a better solution than this, but this should work.
If you have Windows Scripting installed (standard on Win98 and newer) save the following line as a
.vbsfile (invisible.vbs, for example).This script allows you to run any
.batfile invisibly with the following command:This builds on cheeken’s answer because it will allow you to hide the cmd console. All you have to do is create a
.batfile withstart vlcin it.Note: If you execute a
.batfile with this script, it has to close itself and it cannot throw an error which causes it to hang. If it does it will stick around until shutdown or until you close it through the task manager.