Posts Tagged java7

Java 7 and platform encoding

If you are working on a collaborative  java project, you must be settled on file encoding. The common usage is UTF-8. But for example on current OS X versions, the platform default is MacRoman.

I had big problems with it when I was running a maven plugin, which hadn’t the ability to set the encoding explicitly. In such cases the platform encoding is taken!

The only useful solution for java 7 is setting the environment variable JAVA_TOOL_OPTIONS.

E.g. for linux-based OS’s you just need the following entry in your .profile:

 export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

Advertisements

,

1 Comment