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.
I am using Intellij IDEA version 2021.1.1 (Ultimate Edition).
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.
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.
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.
Now you can re-run your main class to start the Spring Boot application and your application will be started without this error.