Intellij IDEA Error – Command Line Is Too Long

Problem

Here I am going to tell you how you can solve the problem when you try to run Java main class in Spring Boot application from IntellijIDEA. The actual error you would find as given below:

Error running ‘Application’:

Command line is too long. Shorten command line for Application or also for Spring Boot default configurations?

The ‘Application’ is your class file which has the main method.

intellij command line too long

I am using Intellij IDEA version 2021.1.1 (Ultimate Edition).

Solution

Now I will show you how to solve this problem so that your application starts normally.

Step 1. Click Select run/debug configuration menu on the top header as shown in the below image. Then click on the right dropdown arrow.

IntellijIDEA command line too long

Click on the Edit Configurations… option.

Step 2. Next make sure Configuration tab is selected and expand the Environment option as shown in the following image.

intellij command line is too long

Then you will find Shorten command line option.

Finally select the dropdown arrow on the right side to choose the third option (@argfile (Java 9+) – java @argfile className [args]) from the dropdown value.

command line is too long

Now you can re-run your main class to start the Spring Boot application and your application will be started without this error.

Leave a Reply

Your email address will not be published. Required fields are marked *