IDEA compiles .jar (problems may be involved)

IDEA

Confirmation is required before performing the following operations:

There is no syntax error in the class file in the package, the project SDK and SDK version numbers are consistent, and the settings of main method and main path

The above confirmed problems will cause the compilation to fail. The solutions are as follows:

The opening method is: File----->Project Structure----->Project

Please add image description
Please add image description

To compile the project, first click on Artifacts in the File----->Project Structure----->Project directory

Please add image description
Here you need to add an item. You can choose to search from the current edit page
Please add image description
Please add image description
. After operating as shown in the figure, he will automatically add a main class. After clicking OK, you need to confirm the main class.

Please add image description

After confirming that the information of the main class is obtained, click Apply

Please add image description
Select Build from the upper toolbar

Find Artifacts under build

Please add image description
Please add image description
In the first execution, we choose Build, and after executing it once, if we want to perform this operation again, we must choose ReBuild

The completed project will be saved in the OUT folder

Right-click under the current .jar file and select to run the file. If the debugging is successful, it means that the .jar file was created successfully

The .jar to exe file may use the exej4 program innersetup to package the jar file and program file to ensure that the application can also be downloaded and used on a computer without JDK

Guess you like

Origin blog.csdn.net/qq_50767141/article/details/119004893