Lỗi the file name or extension is too long năm 2024

I'm trying to run my project in IntelliJ IDEA in debug or run mode, and it is throwing me always this:

Cannot run program "C:\corretto11\bin\java.exe" (in directory "C:\project-be"): CreateProcess error=206, The filename or extension is too long

I have both in C root, I tried to google it and search in Stack Overflow, but nothing that I found was working.

EDIT:

The problem comes when I add the following dependency:

implementation("com.google.firebase:firebase-admin:8.1.0")

To be honest, no idea what could I do, if I remove the dependency it works like magic.

asked Sep 29, 2021 at 12:59

Lỗi the file name or extension is too long năm 2024

8

In addition to changing the run configuration, you must also enable this in your workspace. It's quite silly that this is still required, and not enabled by default.

Open the file .idea/workspace.xml file from your project root folder, go to section

<component name="PropertiesComponent">

and add the following:

<property name="dynamic.classpath" value="true" />

answered Oct 5, 2021 at 10:28

Lỗi the file name or extension is too long năm 2024

NathanNathan

1,00711 silver badges16 bronze badges

3

It works for me in intellij: Run -> Edit Configurations -> Modify options -> Shorten command line -> and select last option from Shorten command line (@argfile(Java9+))

answered Jan 19, 2022 at 12:14

In addition to Nathan answer. In most recent versions, Intellij uses a Json in <component name="PropertiesComponent"> tag.

Add the "dynamic.classpath": "true" property inside the keyToString json element.

answered Nov 25, 2022 at 18:23

Lỗi the file name or extension is too long năm 2024

z1lV3rz1lV3r

7797 silver badges13 bronze badges

2

In Idea Run/Debug configuration click

 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 

0.

Chose

 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 

1 and in

 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 

2 drop down select

 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 

3 or

 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 

4 Shorten command line drop down

answered Jul 18, 2023 at 11:00

this is how I solved this error, if you you are using windows

Follow these Steps

  1. Move your .m2 folder from C:/users/user_name/.m2 to C:/.m2
  2. Go to the folder maven installed config / settings.xml
  3. uncomment
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  1. Add repository location:
    C:.m2\repository

answered Oct 18, 2022 at 11:40

Khalid HabibKhalid Habib

1,1281 gold badge16 silver badges25 bronze badges

1

After several days of struggling with the problem, I eventually found a solution. By enabling debug logs, I discovered that the characters in the classpath were exceeding the maximum limit of around 32k on Windows. The directory with the maximum entries in the classpath was the .m2 folder directory, which was stored in my user/{username} directory, taking up a significant chunk of characters.(use an online string analyser tool for this)

To resolve the issue, I redirected the .m2 repository to "C:" which reduced the classpath to approximately 30k characters, and the problem was resolved.

My suggestion to others facing a similar issue would be to analyze the classpath and find ways to reduce its size. Unfortunately, there is no universal solution that works for all cases.