pycharm中安装JDK后出现环境变量问题,jpype._jvmfinder.JVMNotFoundException:

时间:2024-04-07 07:40:28

pycharm安装了JDK并配置,运行显示jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found.

pycharm中.py文件-提示错误信息如下:

File “G:\Microbial_Ecological_Network_Analysis_System\Real_Data\network_analysis___5_cal_th.py”, line 32, in cal_th
startJVM(getDefaultJVMPath(), “-ea”, “-Djava.class.path=%s” % jarpath)
File “E:\Anaconda\lib\site-packages\jpype_core.py”, line 121, in get_default_jvm_path
return finder.get_jvm_path()
File “E:\Anaconda\lib\site-packages\jpype_jvmfinder.py”, line 153, in get_jvm_path
.format(self._libfile))
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.

提示错误中

File “E:\Anaconda\lib\site-packages\jpype_core.py”,和 File “E:\Anaconda\lib\site-packages\jpype_jvmfinder.py”, line 153, in get_jvm_path
.format(self._libfile))为Anaconda自带的文件,没有更改。

这个文件

File"G:\Microbial_Ecological_Network_Analysis_System\Real_Data\network_analysis___5_cal_th.py是我自己写的,有用到
jarpath = os.path.join(os.path.abspath(’.’), ‘find_yuzhi_th.jar’)
if not isJVMStarted():
startJVM(getDefaultJVMPath(), “-ea”, “-Djava.class.path=%s” % jarpath)
Test = JClass(‘MY_package.RandomMatrixModeling’)
t = Test()
th=t.start_run()

我自己的理解 :

问题在于: jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
但我看了好多文章,说是JDK问题,我原来用的JDK1.9,后来因为其他软件需要,改成了JDK1.8,完全重新安装的。

运行java -version时显示正确:

pycharm中安装JDK后出现环境变量问题,jpype._jvmfinder.JVMNotFoundException:

但cmd中运行javac有问题,并且java不显示内容:

pycharm中安装JDK后出现环境变量问题,jpype._jvmfinder.JVMNotFoundException:

我尝试过.java文件能够编译成.class文件,但为什么cmd中javac和java不显示我没查到。

环境变量配置我参考网上教程,如下图:

classpath:

pycharm中安装JDK后出现环境变量问题,jpype._jvmfinder.JVMNotFoundException:

javahome:

pycharm中安装JDK后出现环境变量问题,jpype._jvmfinder.JVMNotFoundException:

path:pycharm中安装JDK后出现环境变量问题,jpype._jvmfinder.JVMNotFoundException:

新手小白,求指教,蟹蟹啦!