java/jython - newbie question

G

GP

Hi, I'm trying to teach myself a bit of jython and I am trying to run
the code below. But I keep on getting the error message:
"package org.python.util does not exist
import org.python.util.PythonInterpreter; "
When I try to compile it. Any ideas would be appriciated.

Thanks!

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

public class SimpleEmbedded {
public static void main(String []args)
throws PyException
{
PythonInterpreter interp =
new PythonInterpreter();

System.out.println("Hello, brave new world");
interp.exec("import sys");
interp.exec("print sys");

interp.set("a", new PyInteger(42));
interp.exec("print a");
interp.exec("x = 2+2");
PyObject x = interp.get("x");

System.out.println("x: "+x);
System.out.println("Goodbye, cruel world");
}
}
 
A

andreas kinell

Hi, I'm trying to teach myself a bit of jython and I am trying to run
the code below. But I keep on getting the error message:
"package org.python.util does not exist
import org.python.util.PythonInterpreter; "
When I try to compile it. Any ideas would be appriciated.

Thanks!

reading the error message and combining "sherlock holmes"-like, i would
consider the possibility that maybe package org.python.util does not exist!

"assume it is on the computer" would watson add.
holmes instantly askes himself who wrote this error message and comes up
with "the compiler!".
so the compiler thinks this package does not exist, although it is on the
computer.

watson, clueless, remarks: "so how could the compiler know the package
exists?"

holmes triumphs "by pointing to it using -classpath !" and closes yet
another case.

andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top