Java Jython类可以';找不到

Java Jython类可以';找不到,java,python,jython,pythoninterpreter,Java,Python,Jython,Pythoninterpreter,我编写了一个名为jug.java的java文件,它使用jython和PythonInterpreter;代码如下: import org.python.util.PythonInterpreter; import org.python.core.PyObject; public class Jug{ public void main(String[] args) { PythonInterpreter interpreter = new PythonInterprete

我编写了一个名为jug.java的java文件,它使用jython和PythonInterpreter;代码如下:

import org.python.util.PythonInterpreter;
import org.python.core.PyObject;

public class Jug{
    public void main(String[] args) {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.exec("import InstaFeed\nAPI=InstaFeed.InstaFeed(someusername, somepassword)");
        PyObject someFunc = interpreter.get("API.like(mediaId");
        PyObject result = someFunc.__call__(new PyInteger(15));
        String realResult = (String) result.__tojava__(String.class);
    }
}
当我尝试使用此命令执行它时:

javacjug.java

出现以下错误:

Jug.java:1: error: package org.python.util does not exist
import org.python.util.PythonInterpreter;
                      ^
Jug.java:2: error: package org.python.core does not exist
import org.python.core.PyObject;
                      ^
Jug.java:6: error: cannot find symbol
        PythonInterpreter interpreter = new PythonInterpreter();
        ^
  symbol:   class PythonInterpreter
  location: class Jug
Jug.java:6: error: cannot find symbol
        PythonInterpreter interpreter = new PythonInterpreter();
                                            ^
  symbol:   class PythonInterpreter
  location: class Jug
Jug.java:8: error: cannot find symbol
        PyObject someFunc = interpreter.get("like");
        ^
  symbol:   class PyObject
  location: class Jug
Jug.java:9: error: cannot find symbol
        PyObject result = someFunc.__call__(new PyInteger(15));
        ^
  symbol:   class PyObject
  location: class Jug
Jug.java:9: error: cannot find symbol
        PyObject result = someFunc.__call__(new PyInteger(15));
                                                ^
  symbol:   class PyInteger
  location: class Jug
7 errors
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f0f6e654009, pid=31088, tid=31089
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195246.buildd.src)
# Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-04-14-195246.buildd.src, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libjava.so+0x1d009]  JNU_GetEnv+0x19
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /home/muhammad/Downloads/core.31088)
#
# An error report file with more information is saved as:
# /home/muhammad/Downloads/hs_err_pid31088.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)
还安装了jython。 我如何解决这个错误

更多信息

我已经使用终端安装了jython:

sudo apt install jython
它成功地安装了jython。 但每当我尝试从源代码安装它时:

sudo java -jar jython-installer-2.7.0.jar
出现以下错误:

Jug.java:1: error: package org.python.util does not exist
import org.python.util.PythonInterpreter;
                      ^
Jug.java:2: error: package org.python.core does not exist
import org.python.core.PyObject;
                      ^
Jug.java:6: error: cannot find symbol
        PythonInterpreter interpreter = new PythonInterpreter();
        ^
  symbol:   class PythonInterpreter
  location: class Jug
Jug.java:6: error: cannot find symbol
        PythonInterpreter interpreter = new PythonInterpreter();
                                            ^
  symbol:   class PythonInterpreter
  location: class Jug
Jug.java:8: error: cannot find symbol
        PyObject someFunc = interpreter.get("like");
        ^
  symbol:   class PyObject
  location: class Jug
Jug.java:9: error: cannot find symbol
        PyObject result = someFunc.__call__(new PyInteger(15));
        ^
  symbol:   class PyObject
  location: class Jug
Jug.java:9: error: cannot find symbol
        PyObject result = someFunc.__call__(new PyInteger(15));
                                                ^
  symbol:   class PyInteger
  location: class Jug
7 errors
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f0f6e654009, pid=31088, tid=31089
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195246.buildd.src)
# Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-04-14-195246.buildd.src, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libjava.so+0x1d009]  JNU_GetEnv+0x19
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /home/muhammad/Downloads/core.31088)
#
# An error report file with more information is saved as:
# /home/muhammad/Downloads/hs_err_pid31088.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)

包org.python.util应该存在于您缺少的jython.jar中

你可以从

如果存在,将其添加到命令中(而不是
javacjug.java


您是否尝试过调用java-cp jython-installer-2.7.0.jar:。Jug?是,输出:错误:无法找到或加载主类Jug您应该在与Jug.javaYes相同的文件夹中运行您的java文件应该保存为Jug.java而不是Jug.javaSo您找到解决方案了吗?