[英]Java Windows. why can I run a jar file on command prompt but not double clicking it
Now on this machine earlier just typing in the command prompt: java现在在这台机器上早些时候只需输入命令提示符:java
resulted in the command prompt saying java wasn't recognized.导致命令提示符说无法识别 java。 now the machine does have java installed , so I just added the java home and javahome/bin to path.
现在机器确实安装了 java,所以我只是将 java home 和 javahome/bin 添加到路径中。 and now pressing java causes java to be recognized but by double clicking a jar file, but I am not getting the software to run.
现在按 java 会导致 java 被识别,但是通过双击 jar 文件,但我没有让软件运行。 But when I go to command prompt and type in the prompt "java -jar nameofJar.jar" the application runs fine.
但是当我进入命令提示符并输入提示符“java -jar nameofJar.jar”时,应用程序运行良好。 Not sure what is the issue.
不知道是什么问题。 I added the environment variables to make sure it targets the jar file.
我添加了环境变量以确保它针对 jar 文件。 I do notice something its not seeing the jar file as a "Executable jar file" simple a "jar file".
我确实注意到一些事情,它没有将 jar 文件视为“可执行 jar 文件”,而只是“jar 文件”。
You have to tell java to execute your file with javaw.exe
as told by @Carcigenicate您必须按照@Carcigenicate 的指示告诉 java 使用
javaw.exe
执行您的文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.