Re: Question about compiling with Jython

Adam Burke <[email protected]> Sun, 30 Sep 2018 22:34:10 +1000
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAE=2sjerLi8rSyU7smBiYPKrxkAsbtG=nGsONbiOQmfvyqm=xg@mail.gmail.com>
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 <
[email protected]> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-users
>

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users