环境变量 快捷方式 java unable to access

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)

 ,

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值