首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >系统检查器在MacOS大Sur上“无法访问”时失败

系统检查器在MacOS大Sur上“无法访问”时失败
EN

Stack Overflow用户
提问于 2022-04-18 22:05:42
回答 2查看 61关注 0票数 1

我在MacOS Big上运行Cytoscapa3.9.1有困难。系统检查器在下列情况下失败:

代码语言:javascript
复制
############# Cytoscape System Requirements Checker for Mac ##############
Target Cytoscape version: 3.9.0
Your shell is bash
Compatible OS version found: 11.6
 - Pass: OS Version = 11.6.1
 - Pass: Following Oracle JDK found:

/Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk
Fail: Java is not reachable.
Try re-installing Java 11.

我在输出中显示的位置安装了Java 11,它似乎很好:

代码语言:javascript
复制
$ /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home/bin/java -version
java version "11.0.5" 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)

权限看起来是对的(这些权限在目录层次结构上都是一样的):

代码语言:javascript
复制
$ ls -lh /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home/bin/
total 6672
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jaotc
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jar
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jarsigner
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 java
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 javac
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 javadoc
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 javap
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jcmd
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jconsole
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jdb
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jdeprscan
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jdeps
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jhsdb
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jimage
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jinfo
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jjs
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jlink
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jmap
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jmod
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jps
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jrunscript
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jshell
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jstack
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jstat
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 jstatd
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 keytool
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 pack200
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 rmic
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 rmid
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 rmiregistry
-rwxr-xr-x  1 root  wheel   101K Oct  6  2019 serialver
-rwxr-xr-x  1 root  wheel   110K Oct  6  2019 unpack200

我还安装了几个最新的Java版本(我不确定这些版本是否导致了问题):

代码语言:javascript
复制
$ ls /Library/Java/JavaVirtualMachines/
jdk-10.0.2.jdk      jdk-12.0.2.jdk      jdk-14.0.1.jdk      jdk1.8.0_181.jdk
jdk-11.0.5.jdk      jdk-13.0.2.jdk      jdk-17.0.1.jdk

默认情况是JDK17:

代码语言:javascript
复制
$ java -version
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

如果我直接从命令行调用cytoscape.sh,那么它似乎是试图在Java 8下运行:

代码语言:javascript
复制
$ ./cytoscape.sh 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/cytoscape/launcher/internal/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-04-28 14:54:55

JAVA_HOME 3.9.1不会在JDK 17上运行。您需要设置您的以指向JDK 11的安装,并且应该可以正常工作。

-滑板车

票数 2
EN

Stack Overflow用户

发布于 2022-06-10 19:51:50

我对Java也有类似的问题。如果其他人和我有同样的问题,我会在这里给出答案。我第一次来到这里是为了找出"How to set or change the default Java (JDK) version on macOS?

在那里,您应该能够找到您想要使用的Java版本。然后设置JAVA_HOME变量

使用bash或zsh,可以设置JAVA_HOME环境变量,如下所示:

巴什实例

代码语言:javascript
复制
echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 11.0.7)" >> ~/.bash_profile

或者在Zsh

代码语言:javascript
复制
echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 11.0.7)" >> ~/.zshrc

在此之后重启终端。

您可以检查您的shell配置文件,并看到这一行已经添加到配置文件的末尾:

代码语言:javascript
复制
nano ~/.bash_profile
代码语言:javascript
复制
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.7.jdk/Contents/Home

在默认情况下,您还可以检查java是否映射到所需的Java版本:

代码语言:javascript
复制
java -version

在Mac上运行System脚本现在应该可以识别Java是正确安装的

代码语言:javascript
复制
./mac.sh

现在应该通过单击cytoscape.sh脚本来运行Cytoscape

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71917546

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档