0

I'm going to jump right in.

I have a java file called DBCon that connects to a database, and then runs SQL. When I run the java file in netbeans, it properly queries the information from the text file that I am accessing.

I am in Oracle through putty and am trying to run the java file.

export CLASSPATH="./:/opt/lablibs/ojdbc6.jar"
javac DBCon.java
java DBCon
  • the export statement gathers the ojdbc6.jar file from the server at my school. This code was given to us by our teacher.
  • then you compile the java application, which works just fine.
  • when I try and run, I get an error that says: Exception in thread "main" java.lang.NoClassDefFoundError: DBCon (wrong name:
    assignment3/DBCon)

What am I missing? Everything works until this point.

hatz
  • 225
  • 1
  • 4
  • 13
  • http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java – Pshemo Oct 21 '13 at 23:24
  • What do you mean, you are "running from oracle?" You don't show your source code, but if your class is inside a java package, you need to have the proper directory structure on the machine you are running. – OldProgrammer Oct 21 '13 at 23:26
  • I am logged into oracle through putty and am running my java program through that. Sorry if I'm being unclear, but I'm not very good at any of this yet. What source code are you wanting to see? I can post the java file. After I compile, there is a new file named DBCon.class that is created in the same directory. – hatz Oct 21 '13 at 23:34
  • Looks like your class is in a package. (it's probably assignment3). You might want to try this to run the class : `java assignment3.DBCon` – Nishan Oct 22 '13 at 01:39
  • This was it! If you had answered instead of commented I could vote that, but yes. I ended up asking my professor today. – hatz Oct 23 '13 at 03:23

0 Answers0