Note that there are some explanatory texts on larger screens.

plurals
  1. POHow export an Eclipse project including IBM classes for Java libraries into an executable JAR
    primarykey
    data
    text
    <p>I'm trying to export an <code>Eclipse</code> project to a <code>JAR</code> executable file.<br> This project include a personal library with two IBM packages <code>com.ibm.mq.jar</code> and <code>com.ibm.mq.jmqi.jar</code></p> <p>There are no errors running the application from <code>Eclipse</code> run button or by command: <code>java MainClass</code> from the project bin folder.</p> <p>Unfortunately once the jar is created (File > Export > Runnable Jar) and launched <code>java -jar MainClass.jar</code> this is the result:</p> <pre><code>Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.NoClassDefFoundError: javax/resource/ResourceException at com.ibm.mq.MQEnvironment.&lt;clinit&gt;(MQEnvironment.java:520) at MQtestMain.&lt;init&gt;(MQtestMain.java:38) at MQtestMain.main(MQtestMain.java:18) ... 5 more Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 8 more </code></pre> <p>I have tried also <code>Fat Jar</code> plugin for the export but the result of <code>java -jar MainClass_fat.jar</code> is quite similar:</p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: javax/resource/ResourceException at com.ibm.mq.MQEnvironment.&lt;clinit&gt;(MQEnvironment.java:520) at MQtestMain.&lt;init&gt;(MQtestMain.java:38) at MQtestMain.main(MQtestMain.java:18) Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more </code></pre> <p>Which is the correct way to export and run an <code>Eclipse</code> project to a <code>Jar</code> file including <code>IBM MQ Classes for Java</code> libraries?</p> <hr> <p><strong>Update 1:</strong> Unecessary but very useful to reach the solution.</p> <p>Suggested by Integrating Stuff:<br>Include <code>javaee.jar</code> file from the Java EE installation to import all dependencies for IBM classes jar included into the project.</p> <hr> <p><strong>Solution:</strong> Respect all the IBM classes for Java dependencies.</p> <p>Import into the custom library <strong>ALL</strong> the <code>jar</code> file from <code>C:\...\IBM\WebSphere MQ\java\lib</code><br> export as runnable Jar from <code>Eclipse</code> (Fat Jar plugin is not needed also)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload