Can't compile if path contains Unicode on Win10

Answered

Win10, using Scala. Tried JDK8 and 12. The characters are Korean.

Error:Internal error: (java.nio.file.InvalidPathException) Illegal char <?> at index 33: C:/Users/jjh/Documents/MEGAsync/3?? 2??/????????/Scala/Lab
java.nio.file.InvalidPathException: Illegal char <?> at index 33: C:/Users/jjh/Documents/MEGAsync/3?? 2??/????????/Scala/Lab
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:82)
at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel(JpsSerializationManagerImpl.java:42)
at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:50)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:80)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:265)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835)
0
2 comments

What is IDE version used? What is the full path?

Try to compile same directory from command line - does it work or also produces the exception?

0
Avatar
Permanently deleted user

2019.2.4.

I thought I'd give it a try without Scala in pure Java and it doesn't compile either, though the error message gets less descriptive

"C:\Program Files\Java\jdk-12.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar=60884:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\jjh\Documents\아\B\JavaUnicodeTest\out\production\JavaUnicodeTest kr.jjh.Main
Error: Could not find or load main class kr.jjh.Main
Caused by: java.lang.ClassNotFoundException: kr.jjh.Main

Process finished with exit code 1

I tried compiling from the cmd and.. it compiles fine but fails when run it gives the same error. One simple modification that made it work was taking it out of the package:

//package kr.jjh;

public class Main {
public static void main(String[] args) {
// write your code here
System.out.println("Hello");
}
}

I guess it's a problem with the Java interpreter on Windows when resolving the package path or something. Funny that compiling does work but running it doesn't. Though maybe it already gets garbled at the compilation stage, who knows. I know it's generally ill-advised to use Unicode in paths especially on Windows but.. even then I'd hope at least the error message would be more obvious or there'd be some documentation, yet Google doesn't return much for me. Oh well, since it's not an IDEA specific thing I guess there's not much you can do about it. Maybe the next person to experience this will stumble upon this thread.

1

Please sign in to leave a comment.