简体   繁体   English

java如何检查Mac OS上'jar launcher.app'正在使用的版本

[英]java how to check version being used by 'jar launcher.app' on Mac OS

I have several .jar files that run successfully when opened with Mac's built in 'Jar Launcher' (Version 15.0.1) but when ran from terminal they error out.我有几个 .jar 文件在使用 Mac 内置的“Jar Launcher”(版本 15.0.1)打开时可以成功运行,但是当从终端运行时,它们会出错。

Looking online the error messages might be down to the incorrect version of Java being linked to the terminal version, so I'd like to check if the options set for 'Jar Launcher' and the Java used within terminal are the same.在线查看错误消息可能归结为链接到终端版本的 Java 版本不正确,因此我想检查为“Jar Launcher”设置的选项和终端中使用的 Java 是否相同。

Does there exist any way to do this?有没有办法做到这一点?

This question is two years old, but as there is no answer to it, I thought I'd put my two cents here since I've had issues myself, and have made some observations.这个问题已经两年了,但由于没有答案,我想我会把我的两分钱放在这里,因为我自己也有问题,并做了一些观察。

It seems that the Jar Launcher doesn't necessarily use the same JVM version as the one shown by the command /usr/libexec/java_home : If there is a JRE /Library/Internet Plug-Ins/JavaAppletPlugin.plugin , then the Jar Launcher will use it and ignore anything in /Library/Java/JavaVirtualMachines .似乎 Jar Launcher 不一定使用与/usr/libexec/java_home命令显示的相同的 JVM 版本:如果有 JRE /Library/Internet Plug-Ins/JavaAppletPlugin.plugin ,则 Jar Launcher将使用它并忽略/Library/Java/JavaVirtualMachines任何内容。

I've solve my problem of version mismatch between the Jar Launcher and the terminal by removing the JRE:我通过删除 JRE 解决了 Jar Launcher 和终端之间版本不匹配的问题:

  1. Go to /Library/Internet Plug-Ins.转至 /Library/Internet Plug-Ins。
  2. Remove the JavaAppletPlugin.plugin directory by executing the rm command as a root user or by using the sudo tool.通过以 root 用户身份执行 rm 命令或使用 sudo 工具来删除 JavaAppletPlugin.plugin 目录。
  3. Go to /Library/PreferencePanes.转到 /Library/PreferencePanes。
  4. Remove JavaControlPanel.prefpane by executing the rm command as a root user or by using the sudo tool.通过以 root 用户身份执行 rm 命令或使用 sudo 工具来删除 JavaControlPanel.prefpane。

Source: https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-macos.htm来源: https : //docs.oracle.com/javase/9​​/install/installation-jdk-and-jre-macos.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM