执行时出现Jython二进制错误

时间:2016-10-13 09:50:21

标签: jython

一旦执行jython二进制文件,我就会收到以下错误:

Traceback (most recent call last):
  File "/opt/jython2.7.0/bin/jython", line 444, in <module>
    main(sys.argv)
  File "/opt/jython2.7.0/bin/jython", line 431, in main
    os.execvp(command[0], command[1:])
  File "/usr/lib/python2.7/os.py", line 346, in execvp
    _execvpe(file, args)
  File "/usr/lib/python2.7/os.py", line 370, in _execvpe
    func(file, *argrest)
OSError: [Errno 2] No such file or directory

我不清楚这里缺少哪个文件,但更奇怪的是它可以从Eclipse执行而没有任何问题。

有什么想法吗?我在这里有点迷失

1 个答案:

答案 0 :(得分:2)

检查您的JAVA_HOME环境变量。我指的是一个不存在的Java安装。

断裂:

$ export JAVA_HOME=bad path
$ jython2.7.0/bin/jython
Traceback (most recent call last):
  File "jython2.7.0/bin/jython", line 444, in <module>
    main(sys.argv)
  File "jython2.7.0/bin/jython", line 431, in main
    os.execvp(command[0], command[1:])
  File "/usr/lib/python2.7/os.py", line 346, in execvp
    _execvpe(file, args)
  File "/usr/lib/python2.7/os.py", line 370, in _execvpe
    func(file, *argrest)
OSError: [Errno 2] No such file or directory

修正:

$ export JAVA_HOME=$HOME/java/jdk1.8.0_121
$ jython2.7.0/bin/jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.