Datanucleus, JDO and executable jar - how to do it?

前端 未结 4 1636
你的背包
你的背包 2020-12-06 07:56

I am developing a desktop app with Datanucleus and JDO for embedded H2 database. It all works fine when I run it from Eclipse, but it stops working when I try to make execut

4条回答
  •  悲哀的现实
    2020-12-06 08:25

    Adding to DataNucleus answer.
    To acheave what you need you should use maven-dependency-plugin
    and add following to your pom.xml

    
        
            
                org.apache.maven.plugins
                maven-dependency-plugin
                2.4
                
                    
                        copy-dependencies
                        package
                        
                            copy-dependencies
                        
                        
                            ${project.build.directory}/jars
                            false
                            false
                            true
                        
                    
                
            
        
    
    

    Then the dependencies will be in target/jars dir.

    To execute your app you use command:

    Windows:
    java -cp "yourFile.jar;jars/*" package.className

    Linux:
    java -cp "yourFile.jar:jars/*" package.className

    NOTE: do not use jars/*.jar, this will not work

提交回复
热议问题