My simplest and always working solution is copy the entire project’s dependencies to a pre-defined folder, and define the dependency classpath in the jar’s manifest file.īelow is the updated and final pom.xml, to use maven-dependency-plugin to copy all dependencies to target/dependency-jars/ folder, and use maven-jar-plugin to add the dependency classpath. The one-jar solution is really good, but I don’t like the custom class loader and fat-jar concept. – Try one-jar plugin, it will create a fat-jar, which includes the entire project’s dependencies into a single jar file, read this article – Create a fat Jar file with Maven This hack is workable in project with less dependencies only, for large project with many dependencies, it will cause Java class name conflict issue. The radio button should be selecting 'extract to the target JAR. Select 'From modules with dependencies' Select main class.
Click green plus button near top of window. – Alternatively, use maven-assembly-plugin to extract all dependency jars into raw classes, and group it together. jar using IntelliJ IDEA 14.1.5: File > Save All. Note: This plug-in is made up with IDEA Open API which will be compatible with idea version. The following section describes the installation procedure followed by the usage of the plug-in. – You can put both log4j.jar and jodatime.jar inside the final.jar, but your classes are unable to call other classes which is inside the unpack log4j.jar, Java jar is designed like this, unless you create a special class loader like one-jar plugin. The Axis2 plug-in for IntelliJ IDEA helps users to create service archives which can be deployed in Axis2, and generate java classes files from WSDL files.
Update the generated App.java with the following content :Ĥ.1. The following files and folder structure will be created.Ībove folder structure is not enough, create a log4j.properties file and put it in src/main/resources/log4j.properties, just create the resources folder manually. DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false $ mvn archetype:generate -DgroupId= -DartifactId=dateUtils The following jar files from the program/classes directory of a installation must be in the classpath: ridl.jar, unoil.jar, jurt.jar Create a HelloWorld.jar file containing the HelloWorld.
Like Cucumber setup in Eclipse, the imported JARs will be available under the ‘External Libraries’ section. With this, the Cucumber Selenium dependencies are added to the project.
My guess would be that this error is indicating that the HelloWorld class was not found in the JAR.In this tutorial, we will show you how to use Maven build tool, to create a single executable Jar, and how to deal with the project’s dependencies.Ĭreate a Java project from the Maven quick start template. Select the JARs through the ‘browse menu’ and click on OK. jar files from output (automatic behavior was to include them extracted, but I think that’s unnecessary since LibreOffice clearly already has a copy)Įrror: .RuntimeException: UNO calling Java method invoke: non-UNO exception occurred: Īt (Resource.java:143)Īt (URLClassLoader.java:450)Īt $100(URLClassLoader.java:73)Īt $1.run(URLClassLoader.java:367)Īt $1.run(URLClassLoader.java:361)Īt (Native Method)Īt (URLClassLoader.java:360)Īt (ClassLoader.java:424)Īt (ClassLoader.java:357)Īt .invoke(ScriptProviderForJava.java:238) Add a JAR Artifact From modules with dependencies, no Main Class.Add juh.jar, jurt.jar, officebean.jar, ridl.jar, and unoil.jar to Project Libraries.Define Project compiler output path in Project Settings.My attempt below resulted in the following error when trying to run the macro. Then pass the -XX:+TraceClassLoading option under Run -> Run -> Edit Configurations -> Environment -> VM options, and launch the application.
Or, for example, you want to print the list of classes loaded. How would these steps be accomplished in IntelliJ IDEA (or even, for that matter, from the command line?) In Intellij IDEA you can enter the -Xmx1024m -Xms256m values in the VM options field under Run -> Run -> Edit Configurations -> Environment.
The warning occurs because of the Run delegation feature enabled where IntelliJ IDEA generates the special Gradle code to run the project run configuration in the temp directory. Youre able to specify different classes in the same JAR. Create gradle.properties file next to adle file with the following:. The Macro Documentation mentions these steps: Thin JAR only contains classes that you created, which means you should include your dependencies externally.