Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems creating an executable jar file from jdeveloper 11.1.1.2.0

Ross ZimmermanDec 30 2009 — edited Dec 30 2009
Hello,

I am using Jdeveloper 11.1.1.2.0 to try to create a very simple jar file and I am running into problems.

I created a simple main class that makes use of a jar file that my company has compiled over time (bpc.jar). I am also making use of the "Java EE 1.5" library of jars.

I have created a client jar deployment profile, and I have the two jar files as library dependencies (and they are checked), as well as the necessary java main class.

When I create the jar file and try to run it from command prompt I am getting the following error.

C:\>java -jar myJar.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/bpc/util/mail/MailBean
at jarfile.myJar.<init>(myJar.java:10)
at jarfile.myJar.main(myJar.java:15)
Caused by: java.lang.ClassNotFoundException: com.bpc.util.mail.MailBean
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 2 more

MailBean is one of the classes in the jar file that my company has compiled (bpc.jar), but it doesn't appear to be adding it to the jar correctly.

What am I missing in order to include the bpc.jar in the jar file that I am creating?




Thanks


below is my main class code.

package jarfile;

import com.bpc.util.mail.MailBean; //this is from bpc.jar

public class myJar
{
MailBean mb;
public myJar()
{
mb = new MailBean();
}

public static void main(String[] args)
{
myJar testmain = new myJar();
testmain.mb.setMessage("Hi There.");
testmain.mb.setTo("bob@anywhere.com");
System.out.println("made it.");
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 27 2010
Added on Dec 30 2009
4 comments
1,435 views