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

Ericson Willians picture Ericson Willians · May 25, 2015 · Viewed 15.4k times · Source

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.

Answer

user826366 picture user826366 · Nov 20, 2015

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.