|
From: Adam B. <ada...@gm...> - 2018-09-30 12:34:30
|
Do you have jython on your classpath? It will be needed because of the
classes extended and improted. Java seems to give an unexpectedly terse
error message in this case.
Adam
On Sun, 30 Sep 2018 at 06:14, Ted Larson Freeman via Jython-users <
jyt...@li...> wrote:
> I have just installed Jython 2.7, and am looking for a simple example of
> compiling a Python script down to a Java .class file. Following a
> suggestion on Stack Overflow, I tried to compile a file called
> HelloWorld.py, which contains this:
>
> class HelloWorld(object):
> def hello(self):
> print 'Hello, World!'
>
> if __name__ == '__main__':
> h = HelloWorld()
> h.hello()
>
> Using these Jython commands (in the same working directory):
>
> import py_compile
> py_compile.compile('HelloWorld.py')
>
> That produces a file called HelloWorld$py.class, but when I try to run it
> with java from the command line, I get this error:
>
> Error: Could not find or load main class HelloWorld
>
> Please let me know what commands I should use.
>
> Thanks.
>
> Ted
>
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
|