java/jython - newbie question

Discussion in 'Java' started by GP, Oct 17, 2004.

  1. GP

    GP Guest

    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");
    }
    }
    GP, Oct 17, 2004
    #1
    1. Advertising

  2. > 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
    andreas kinell, Oct 17, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. javahead
    Replies:
    1
    Views:
    1,046
    Erik Max Francis
    Oct 8, 2003
  2. Matt Newcomb

    jython/java inheritance question?

    Matt Newcomb, Oct 29, 2003, in forum: Python
    Replies:
    1
    Views:
    336
    Alan Kennedy
    Oct 29, 2003
  3. David McNab
    Replies:
    0
    Views:
    452
    David McNab
    Apr 9, 2004
  4. Divya Prakash
    Replies:
    0
    Views:
    425
    Divya Prakash
    Dec 19, 2006
  5. Pinegar, Kent T

    FW: [Jython-users] Jython Licensing Question

    Pinegar, Kent T, Jul 24, 2008, in forum: Python
    Replies:
    0
    Views:
    342
    Pinegar, Kent T
    Jul 24, 2008
Loading...

Share This Page