Location>code7788 >text

How to solve the problem of IDEA in the same src under more than one class in one of the runtime automatically reported errors in other classes in the problem caused by wanting to run the class can not run properly solution ideas

Popularity:195 ℃/2024-08-18 11:19:55

How to solve the problem of IDEA in the same src under more than one class in one of the runtime automatically reported errors in other classes in the problem caused by wanting to run the class can not run properly solution ideas

WrongFirst:

I prepared a normal class BG and a class HelloWorld with errors to see what happens.

WrongSecond:

Unsurprisingly it reported an error, which seems to be related to IDEA's default settings.

SolveFirst:

Open the configuration editor in Run.

SolveSecond:

Find the pre-run settings, this is my version of IDEA

IntelliJ IDEA Community Edition 2024.2.0.1

SolveThird:

Find the Add before launch task option that allows you to add a pre-launch task.

SolveFourth:

Modify the pre-startup options.

SolveFifth:

Change the pre-startup default option to a state that does not check for errors.

SolveSixth:

Save changes and prepare for trial run.

Final:

It works, but it automatically jumps to the error page, which is fine, it's better than nothing.

concluding remarks

Individuals are shallow, the first java, it is inevitable to make mistakes, I hope you master seniors more tolerance, if there is an error, please help to correct!