示例代码:
from java.lang import System
if __name__ == '__main__':
[System.out.print(x) for x in "Python-powered Java Hello World from within a List-Comprehension."]
烦人的输出:
console: Failed to install 'org.python.util.JLineConsole': java.nio.charset.UnsupportedCharsetException: cp0.
console: Failed to install 'org.python.util.JLineConsole': java.nio.charset.UnsupportedCharsetException: cp0.
Python-powered Java Hello World from within a List-Comprehension.
我已经尝试了描述的解决方案 here和 here .这两种解决方案都惨遭失败(我已将 -Dpython.console.encoding=UTF-8 参数添加到 JVM 和 PyDev 交互式控制台)。
There's also another question about it here from 4 months ago ,也没有人回答。那么,我该如何解决呢?
编辑:我刚刚安装了新的 Eclipse Luna,安装了带有 Jython 的 PyDev,同样的事情发生了。
最佳答案
我已经按照您提到的错误报告 (http://bugs.jython.org/issue2222) 中提到的建议解决了这个问题,添加
-Dpython.console.encoding=UTF-8
作为我程序运行配置的 VM 参数。设置与 an 相同的值
Jython 解释器的环境变量在我的案例中不起作用。
我在 Windows 7 上使用 Jython 2.7.0 和 Eclipse Luna 以及 PyDev。
关于java - 如何使用 Jython/PyDev 修复 Eclipse Kepler/Luna 中的 UnsupportedCharsetException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30443537/