How can I include external jar on my Netbeans project

后端 未结 12 2787
挽巷
挽巷 2020-11-27 06:25

When I run \"clean and build\" the .jar file that is being created only runs if the lib folder is at the same folder of the .jar file.

12条回答
  •  旧时难觅i
    2020-11-27 07:13

    I solved this by creating just one jar file with all libraries inside, adding the following to my build.xml file in NetBeans:

    
      
        
        
        
        
        
            
        
      
    
    

    This creates a jar file (Combined-dist.jar) which is the combination of the dist jar and the specified library jars (in this case, commons-io-1.4.jar,ninja-utils-3.2.jar and unicorn-1.0.jar). You have to be sure to specify your Main Class package for the new jar file or it won't run when you try to open it.

提交回复
热议问题