Issues understanding how to use Jython

前端 未结 1 492
误落风尘
误落风尘 2021-01-14 07:28

I\'ve just started learning Jython, and I\'m having some issues with implementation. I\'ve looked through the Demo files that come with Jython 2.5, and I\'m still unsure how

相关标签:
1条回答
  • 2021-01-14 08:07

    I think the answer is CLASSPATH.

    hello.py

    print "Hello"
    

    Let's run it

    > python hello.py
    Hello
    
    > jython hello.py
    Hello
    

    Compile (I used py_compile to compile single file)

    > jython -m py_compile hello.py
    

    Run with java

    > java -classpath d:\P\jython253\jython.jar;. hello$py
    Hello
    

    Note the dot in classpath. It is required for java to find your compiled class in current directory.

    0 讨论(0)
提交回复
热议问题