Suppose I have multiple classes I want in a .jar. How would I do that in IntelliJ?
Edit: This is just a normal IDEA project. All of the classes compile properly. I want all classes to be in the JAR.
Suppose I have multiple classes I want in a .jar. How would I do that in IntelliJ?
Edit: This is just a normal IDEA project. All of the classes compile properly. I want all classes to be in the JAR.
You can check all your classes which will be in *.jar in Intellij
ctrl+alt+shift+s
(Project settings) -> Artifacts
There you can choose artifacts settings (included classes also)
then, to build package from artifact:
Build -> Build Artifact
-> choose created artifact
then, in out folder you get your *jar (or another - which you choose in artifact) package
Go to File -> Project Structure -> Artifacts
Click on the green plus sign -> JAR -> modules with dependencies
The module is your entire project.
Specify your main class. Then click OK
Check the "include in project build" box. Then click OK
You can use the terminal of IntelliJ to execute the file
java -jar "the path to the Jar file"