Windows shell inconsistencies

When I double-click a .jar file on my desktop, the program opens and runs. There is no shell.

If I open a shell, change directories to the desktop and run the following:

 java -jar myprogram.jar

the program opens and runs, but the shell remains open.

If I make a .bat file with the single line in it:

java -jar myprogram.jar

and place the file on my desktop and click it, a shell opens and the program opens and runs, and the shell stays open.

If I make a .bat file with the single line invoking another program, such as notepad.exe, and place the .bat file on the desktop and click it, the shell opens, the notepad program opens and then the shell closes.

Why does the shell close for notepad.exe but not java when it is called a line in a .bat file? And why doesn’t double-clicking a .jar file open a shell?

This seems, on the surface, kind of inconsistent.

OK, at least a partial answer was found.

Some of this can be handled by selecting between using java.exe and javaw.exe

When the .bat file contains the line:

javaw -jar myprogram.jar

and the file is doubleclicked on a window, the console/shell briefly flashes and closes, and the program runs.

It seems also that using the form

start /B

can launch a program without opening a window.

(What is the point of all this? I’m trying to see if I can inline a launch command into the registry that doesn’t leave a console/shell window open in the process.)