Creating a directory that includes shortcuts to all frequently used files, and then setting this directory as the path to the environment variable, this make it convienent to execute files.
将一个包含经常使用文件的快捷方式的目录设置为一个环境变量的路径会让执行文件更加方便。
However, when I execute a jar file using the environment variable java17 (shortcut), it will output "cannot access xxx. jar".
但是当我用环境变量java17(快捷方式)执行jar文件时,报错“找不到jar文件”
After my troubleshooting, I found that, the problem is caused by "Start in".
在我排查了问题后,我发现,这个问题源于“起始位置”。
According to references in bing, "Start In" points to a directory that the executable might/use as a default starting directory.
根据bing上的资料,“起始位置” 指向可能会作为这个执行文件默认起始目录的目录。
In my speculation, the path where java.exe is executed in form of an environmental variable is passed as a parameter into java.exe.
我推测, 当通过环境变量执行java.exe时,调用此环境变量的位置会作为参数传入java.exe.
When you execute a shortcut to java.exe through an environment variable, 'Start In' will be passed as a parameter that takes precedence over the current path to java.exe.
当你通过作为环境变量的快捷方式执行java.exe时,“起始位置”会优先于当前路径作为参数传入到java.exe
Therefore, to solve this problem, What you need to do is delete the path in "Start in" or specify the path where your xxx.jar is located.
因此,为了解决这个问题,你只需要将快捷方式的“起始位置”置空,或者写入你想要打开的jar文件的位置。
Then your xx.jar can be executed.
然后你的程序即可运行
写英文是为了练习,中文是防止看不懂。
Purpose of 'Start In' in properties dialog | Tom's Hardware Forum (tomshardware.com)
,