Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie with wrong Eclipse setting?

Status
Not open for further replies.

DugsDMan

Programmer
Mar 19, 2002
85
US
I'm new to JAVA programming and especially Eclipse. I have a small program that runs fine, if I run it outside of Eclipse. However, when I run it from within Eclipse, I get this error:

java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.ncr.teradata.jdbc_4.Driver.<clinit>(Unknown Source)
at com.ncr.teradata.jdbc_3.ifjdbc_4.TeraLocalConnection.<init>(Unknown Source)
at com.ncr.teradata.TeraDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MyFirstApp.main(MyFirstApp.java:44)
Exception in thread "main"

The code for line 44 is:
con = DriverManager.getConnection(url_type4, username, passwd);

If I go to a command prompt, I can run the program fine, it just won't run from within Eclipse. I even used the same javaw.exe it is showing in the title bar of the console window after it terminates, just to make sure the code is working.

Any ideas what I might need to change to get it to run properly?

Thanks!
Doug
 
You need to put the log4J jar in your classpath. I don't have eclipse installed, but to do it inside of WebSphere Studio Application Developer (which is built on top of eclipse) you need to right click on on the package you are working with and click properties. Look for the area that has 'Java Build Path' and click 'Add Jars'. You can find the jar in the directory where you installed java.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top