jarjdeveloper

JDeveloper Deploy Desktop Application JAR With Libraries


Using JDeveloper 12.1.3.0.0, I have created a Java Desktop Application that uses Oracle JDBC and BC4J Oracle Domains libraries (added them through Project Properties -> Libraries and Classpath). Everything compiles and runs fine in JDeveloper but I am struggling to deploy a working JAR file. This JAR file needs to include the libraries as it will be placed directly onto a client machine.

Current failed attempt: I have created a Deployment Profile in the Project Properties. This profile has my MainForm.java set as the main file and I included a File Group (Type: Libraries) with both necessary libraries checked as contributors.

After deploying the JAR using this profile, I get an error message saying "A Jave Exception has occurred." Running the jar through command prompt using "java -jar archive.jar" I get the following trace:

Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems, Inc." Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jbo/JboException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: oracle.jbo.JboException 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) ... 6 more

What am I doing incorrectly? Any suggestions are greatly welcomed.


Solution

  • After some communication with an Oracle representative, this is apparently not possible with JDeveloper on its own. The limitation is that Java cannot get into JAR files that are packaged within another JAR. It was suggested I use One-Jar, which will extract and package the necessary classes from the libraries, or create a script that will set the classpath to external libraries.