While developing with Java, the following error started to occur and I was quite addicted to it, so make a note.
Exception occurred executing command line.
Cannot run program "C:\Program Files\Java\jre1.8.0_144\bin\javaw.exe" (in directory "C:\Users\ore\myproject"): CreateProcess error=206, The filename or extension is too long
When I first saw it, I didn't understand it at all, but the specified string of classpath specified when executing the java command (java -cp "c: \ myproject \ main; c: \ Users \ .gradle \ .. .. It seems that the cause is that "Mita-natsu" is too long and exceeds the maximum number of characters of the argument of createProcess in Windows, 32768.
This is the best if you can choose this. This time it was impossible because all the libraries were necessary.
For example, if it is now in c: \ Users / ore / nanika / nantoka / are / sore / koko, move to c: \ Users / ore /. I thought this would be the next easiest thing to do, but it didn't work. The reason is in the next item.
If you look closely at the classpath specified in the java command when the error occurs, it is very often something like c: \ Users \ ore \ .gradle \ nantoka_library \ nantoka.jar. So I moved the default download destination of gradle from c: \ Users \ ore \ .gradle to c: \ .gradle.
In Windows, create GRADLE_USER_HOME in "System"-> "Advanced system settings"-> "Environment variables"-> User environment variables and specify the value in the procedure of C: \ .gradle.
Now I restarted the IDE and rebuilt it and it worked. It's not a good idea, but if you're addicted to it, it might be worth a try.
The problem is that the java command has too long arguments, so you can stop doing this. If you can use Java 9 module, you don't need to specify such a large number of long classpaths. However, it will take some time before Java 9 becomes widespread and the library supports it.
Recommended Posts