【已解决】RuntimeError Java gateway process exited before sending its port number

RuntimeError: Java gateway process exited before sending its port number

问题

【已解决】RuntimeError Java gateway process exited before sending its port number_第1张图片

思路

方法一
在代码前加入如下代码(如图):

import os
os.environ[‘JAVA_HOME’] = “/usr/local/jdk1.8.0_221” # 记得把地址改成自己的
【已解决】RuntimeError Java gateway process exited before sending its port number_第2张图片

方法二
目光锁定pycharm标题栏(最上方),找到Run——> Edit Configurations——>Environment variables 按图中所示,添加jdk路径(不用添加其他的路径了,一个就够了),修改完记得Apply。

【已解决】RuntimeError Java gateway process exited before sending its port number_第3张图片

未能解决报错,尝试以下方法:

【已解决】RuntimeError Java gateway process exited before sending its port number_第4张图片

解决

成功解决!

【已解决】RuntimeError Java gateway process exited before sending its port number_第5张图片

你可能感兴趣的:(Bug错题集,java,gateway,服务器)