Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 13th, 2006, 12:35 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default error:exception in thread main java.lang.noclassde

i have entered the following code in notepad for creating table
import java.sql.*;

Public class CreateTable {
    public static void main(string args[]){
    connection con=null;
    try{
     class.forname("org.gjt.mm.mysql.driver").newinstan ce();
     SYSTEM.OUT.PRintln("JDBC Driver loaded");
     con=drivermanager.getconnection(
     "jdbc:mysql://localhost/wrox?user=root&password=q1w2e3");
     SYSTEM.OUT.Println("Database connection established");

     statement stmt=con.createstatement();
     string upd="Create table author(
                     Author_id Integer NOT NULL PRIMARY KEY,
                     Author_name char(50));";
     stmt.executeupdate(upd);
     System.out.println("Table-Author created");
        }
     Catch (ClassNotFoundException cnfe){
        system.out.println("ClassNotFoundException:could not locate Driver");
     }catch(SQLException cnfe){
        system.out.println("SQLException:+Cnfe);
     }Catch(Exception e){
        system.out.println("AN unknown error occured while connecting TO THE Database");
     }finally {
      try {
      if(con!=null)
      con.close();
        }catch(SQLException sqle){
         SYStem.out.println("unable to close database connection.");
        }
          }
         }
     }
when i try to run >java CreateTable i am getting the following error:exception in thread main java.lang.noclassdef found:CreateTable.

pls help.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception in thread "main" javax.xml.transform.Tra XSLTUser XSLT 1 December 29th, 2007 04:59 AM
"java.lang.classNotFound Exception:org.gjt.mm.mysq anwarraja Java Databases 4 September 12th, 2007 11:04 PM
"Exception in thread main java.lang.Noclass Def Fo anwarraja Java Databases 1 September 4th, 2007 07:19 AM
Exception : java.lang.NoClassDefFoundError haifriends J2EE 1 July 26th, 2006 07:22 PM
ERROR "Exception in thread "main" java.lang.NoClas nitinnishi BOOK: Beginning Java 2 3 June 17th, 2006 07:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.