How do I bundle a JRE in my JAR, so that it can run on systems without Java?

后端 未结 2 1261
情书的邮戳
情书的邮戳 2021-02-20 11:55

I want to bundle a JRE inside my executable JAR, so that the exe can run on any system.

I have tried Launch4j, but that approach requires me to ship both the JRE and the

2条回答
  •  甜味超标
    2021-02-20 12:20

    Late better than never. I used maven-shade-plugin in the pom.xml as follows:

            
              maven-shade-plugin
              2.4.3
              
                  
                      
                      
                          ${mainClass}
                      
                  
                  
                  
                false
                  
                  
                      
                          *:*
                          
                              META-INF/*.SF
                              META-INF/*.DSA
                              META-INF/*.RSA
                          
                      
                      
                          *:*
                          
                              sun/misc/**
                          
                      
                  
                
                
                    
                        package
                        
                          shade
                        
                    
                
            
    

提交回复
热议问题