You should still be able to create a shortcut with environment variable using a COM Object from VBScript or powershell. The method "CreateShortcut" (more details also for arguments here) is capable of that. While originally a vbscript solution you can call this from a powershell prompt like this:
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("C:\Users\Public\Desktop\My Java Shortcut.lnk")
$Shortcut.TargetPath = "%MY_OWN_JAVA_HOME%\javaw.exe"
$Shortcut.Arguments = "-cp"
$Shortcut.Save()
Please note that the arguments do not go in the target path. Also it might not work if your environment variable contains spaces.
The upside of this is that you do have a real shortcut not some wrapper, the downside is, that you can never alter this shortcut via it's properties dialog. As soon as you do this the variable gets replaced again.
If you want a wrapper I would also suggest a vbs file which is completely silent. Create a new text file and paste the line
CreateObject("WScript.Shell").Run """%MY_OWN_JAVA_HOME%\bin\javaw.exe"" -cp", , False
in there and save it as "runmyjava.vbs" and create the shortcut to that file and it wont have an black popups not even for a split second. Note the extra "" in front after the path to the executable. Those are only needed if the environment variable contains spaces.
%MY_OWN_JAVA_HOME%\bin\javaw.exe -version
in a batch file and run the batch file from the shortcut.cmd
-window. If I usestart %MY_OWN_JAVA_HOME%\bin\javaw.exe -version
in the batchfile, then the cmd-window will close right away. And I am minimizing the cmd-window with my shortcut-settings. Still I would prefer not to open that second window.start /B
Start application without creating a new window`