0

When I try to run a code snippet in Java Scrapbook, Eclipse cannot start the VM with the following error:

Unable to launch scrapbook VM
Exception occurred executing command line.
Cannot run program "C:\Program Files\Java\jdk-14\bin\javaw.exe" (in directory "C:\tmp"): CreateProcess error=206, The filename or extension is too long

There was a bug report in Eclipse's Bugzilla, but it was closed without a satisfactory answer.

The other similar answers on SO have different causes:
Starting in directory with an unusual name
Starting in an Android project

I tried changing the working directory to C:\tmp so that any issues caused by directory structure are solved, but to no avail.

Environment: OpenJDK 14, Eclipse 2020-06, Maven project

JohnEye
  • 6,436
  • 4
  • 41
  • 67

1 Answers1

0

The actual problem is that Windows cannot start a program whose command line is longer than about 32000 characters. This can happen if you have so many dependencies that the command line arguments reach the limit. This is why changing the directory to C:\tmp did not help, the size of this part is negligible when compared to all the dependencies on the command line.

There's a nice answer to a different question which contains some useful tips which can help out.

I initially worked around the issue by running the code snippet in a newly-created project, but this was only possible because I did not need any parts of the project I'm working on.

The real solution was to switch to Linux because pretty much all distributions have limits which exceed those of Windows by an order of magnitude or more.

JohnEye
  • 6,436
  • 4
  • 41
  • 67