I want to start a java program in a Windows console from a click to a shortcut in the Quicklaunch area.

How do I do this?

I can start the console (shortcut target: C:\Windows\System32\cmd.exe) in the desired directory (C:\somewhere) and then start the Java program by typing "java -jar myjar.jar".

I just want to avoid this typing, but the console should stay open. If I use java directly as target, the program runs invisibly (as expected).


The /K option of cmd.exe works for me: Shortcut target:

C:\Windows\System32\cmd.exe /K java -jar myjar.jar
  • I found this on some obscure web page. Is there some good, official documenation for cmd.exe somewhere that I could link? – Gustave Mar 2 '17 at 10:56
  • cmd - Start a new CMD shell and (optionally) run a command/executable program. – DavidPostill Mar 2 '17 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.