How to make an executable JAR file?

后端 未结 5 1390
孤独总比滥情好
孤独总比滥情好 2020-11-21 23:41

I have a program which consists of two simple Java Swing files.

How do I make an executable JAR file for my program?

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 00:19

    If you use maven, add the following to your pom.xml file:

    
        
        org.apache.maven.plugins
        maven-jar-plugin
        2.4
        
            
                
                    com.path.to.YourMainClass
                
            
        
    
    

    Then you can run mvn package. The jar file will be located under in the target directory.

提交回复
热议问题