Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

java - How do I fix UnsupportedCharsetException in Eclipse Kepler/Luna with Jython/PyDev?

Example code:

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."]

Annoying output:

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.

I've tried the solution described here and here. Both solutions failed miserably (I've added the -Dpython.console.encoding=UTF-8 argument to the JVM and the PyDev interactive console).

There's also another question about it here from 4 months ago, and no one answered it. So, how do I fix it?

EDIT: I've just installed the new Eclipse Luna, installed PyDev with Jython, and the same thing happens.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've fixed this issue following the advice mentioned in the bug report you referred to (http://bugs.jython.org/issue2222), adding -Dpython.console.encoding=UTF-8 as a VM argument to the run configuration for my program. Setting the same value as an environment variable for the Jython interpreter didn't work in my case.

I'm using Jython 2.7.0 and Eclipse Luna with PyDev on Windows 7.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...