Launch a Scala Swing app on Windows without command window Launch a Scala Swing app on Windows without command window windows windows

Launch a Scala Swing app on Windows without command window


I would advise to launch your app directly using javaw. Since Scala compiles into the same byte code as Java - you can do it. Don't forget to add standard scala libraries to the class path


It's clearly stated in the java command explanation, about -jar:

When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.

Making a shortcut withjavaw.exe -cp "%SCALA_HOME%\lib\scala-library.jar";"%SCALA_HOME%\lib\scala-swing.jar";"C:/path/yourjar.jar" packageName.mainClassNamedid work.

The solution is hence include libraries + packaged target code with -cp argument and don't use the -jar switch. As also given as a solution in the question.


You can try to compile your bat file to exe (I used quick batch file compiler). I believe this prevent command window appearance. I did not use Windows for a long time, but I remember it helped me sometimes.