Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java,Oracle on Solaris need Help Uragent

 
javahelp
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have installed JDK1.2.2 and oracle 8.1.6 on Solaris 2.8(Unix).
I am able to compile and execute simple java programs. Now Iam trying to run jdbc programs.
In order to do that I downloaded Oracle driver for Solaris and added classpath with classes12.zip. Now my Jdbc programs as well as simple programs are compiling successfully but not executing. Any help to soleve this problem is appreciated.
gdgd% echo $CLASSPATH
/emc/bsugeera/classes12.zip

gdgd% javac Employee.java
gdgd% java Employee
Exception in thread "main" java.lang.NoClassDefFoundError: Employee
gdgd%

Sorce code for Employee.javaclass Employee
import java.sql.*;
class Employee
{
public static void main (String args [])
throws SQLException
{

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

Connection conn =
DriverManager.getConnection ("jdbc racle ci8:@servername.port.dbname", "scott", "tiger");

Statement stmt = conn.createStatement ();

ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
while (rset.next ())
System.out.println (rset.getString (1));

rset.close();

stmt.close();
conn.close();
}
}

Thanks in Advance.
Basu
 
rani bedi
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
The NoClassDefFoundError is usually thrown if the Java Virtual Machine or a classloader tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javahelp:
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic