我正在学习使用Py4J在python中使用Java对象。我开始尝试下面提到的一个简单示例
from py4j.java_gateway import JavaGateway
gateway = JavaGateway()
gateway.gateway_parameters.port = 4040
gateway.jvm.java.lang.System.out.println('Hello World!')
这导致了以下错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ultrausr/Downloads/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1659, in __getattr__
py4j.protocol.Py4JError: java does not exist in the JVM
如何在JVM中加载java
或任何其他Java包?