Home Ask Login Register

Developers Planet

Your answer is one click away!

vlshch February 2016

UTF-8 characters in a path to a jarfile

I have a folder with Unicode(UTF-8) symbols in its name, for example, Я_Папка, and the folder contains foo.jar.

Now I need to execute the foo.jar:

chcp 65001
Active code page: 65001

C:\>java -Dsun.jnu.encode=UTF-8 -jar C:\Я_Папка\foo.jar
Error: Unable to access jarfile C:\Я_Папка\foo.jar

-Dsun.jnu.encode=UTF-8 switch tells java to use UTF-8 encoding for the platform string.

-Dfile.encode=UTF-8 switch can't help - it works only with the contents of files rather than the command line

My question here - how to make -jar switch understand UTF-8 encoding?


vlshch March 2016

Java doesn't support Unicode (UTF-8) for platform string on Windows by design. You can only use code page set in the System locale.

Post Status

Asked in February 2016
Viewed 3,504 times
Voted 13
Answered 1 times


Leave an answer

Quote of the day: live life