From: Ted L. F. <te...@pr...> - 2018-09-29 20:13:48
|
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 |