Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong n

Please Help, I am giving up...
My PATH: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jdk1.6.0_11\bin;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\JAVA DOCUMENTATION\BasicJava1\Code;C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7\mysql-connector-java-5.1.7-bin.jar
MY CLASSPATH: C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7\;C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7-bin
Before I set the ABOVE Path's I received the "com.mysql.jdbc.Driver" error. After adding the CLASS PATH as above I got the following Error
"com.mysql.jdbc.Driver"
After the ABOVE mentione PATH's Iam getting the following error:
C:\JAVA DOCUMENTATION>java connect
Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong name:
Connect)
at java.lang.ClassLoader.defineClass1(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$000(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)
Could not find the main class: connect. Program will exit.
THIS IS MY CODE.....
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connect
public static void main (String[] args)
Connection conn = null;
try
String userName = "sampadm";
String password = "secret";
String url = "jdbc:mysql://localhost/sampdb";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url, userName, password);
System.out.println ("Database connection established");
catch (Exception e)
System.err.println ("Cannot connect to database server");
System.err.println("Exception: " + e.getMessage());
finally
if (conn != null)
try
conn.close ();
System.out.println ("Database connection terminated");
catch (Exception e) { /* ignore close errors */ }
PLEASE PLEASE HELP, AS I NEED TO GET PASSED THIS ERROR NOW. I NEED TO PROGRESS !!
THANKS TO ANYBODY THAT CAN ASSIST
FYI
JUDY

Java is case sensitive. Connect != connect

Similar Messages

  • Exception in thread "main" java.lang.NoClassDefFoundError: continue (wrong

    class Continue {
    public static void main(String[] args)
    int i=0;
    while(i>5) continue;
    System.out.println("Count is: " + i);
    i++;
    when i run this program get an error i.e.,
    Exception in thread "main" java.lang.NoClassDefFoundError: continue (wrong name:
    Continue)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    so pls help me what my mistake in my progrm
    i

    The output of your program is
    C:\rk>javac Continue.java
    C:\rk>java Continue
    Count is: 0
    C:\rk>
    Why is that you got that problem? Could you please tell me how did you tried compiling it?

  • Exception in thread "main"java.lang.NoclassDefFoundError: server (wrong....

    Ok, i made my own java compiler (well my friend made it for me), and I got this error when i ran the program.....
    Here is the code in my compiler if you want to take a look at it.
    @echo off
    if exist "C:\Program Files (x86)\Java\" set programfiles=C:\Program Files (x86)
    set pr=%programfiles%\Java\
    :co1
    set b=0
    set t=7
    goto co2
    :co2
    color %b%%t%
    :menu
    cls
    title The Perfect Compiler version 1.9
    echo Please choose an option below to do that function.
    echo Keep posted on the Moparscape Tutorials section for
    echo any updates that I post.
    echo.
    echo c - Compile your server.
    echo r - To Run your server.
    echo e - To exit out of the program.
    echo jar - It will create your server into an executable Jar archive.
    echo color - Change the Text and Backround colors of this compiler.
    echo reset - Resets your Compiler Logs.
    echo.
    echo.
    set /p c=Option:
    if %c%==c goto c
    if %c%==C goto c
    if %c%==r goto r
    if %c%==R goto r
    if %c%==jar goto jar
    if %c%==Jar goto jar
    if %c%==JAR goto jar
    if %c%==color goto color
    if %c%==Color goto color
    if %c%==COLOR goto color
    if %c%==reset goto reset
    if %c%==Reset goto reset
    if %c%==RESET goto reset
    if %c%==e goto e
    if %c%==E goto e
    if %c%==* goto er
    goto er
    :jar
    title Jar Creator
    cls
    echo What will be the name of the Jar file?
    echo.
    set /p name=Name:
    if exist *.class (del *.class)
    set pro=%pr%jdk1.5.0
    set pro2=%pr%jdk1.6.0
    set jav=bin\javac.exe
    set go=jar2
    goto cj
    :jar2
    %java% -cp . *java
    echo Manifest-Version: 1.0 >> manifest
    echo Created-By: 1.5.0_04 (Sun Microsystems Inc.) >> manifest
    echo Main-Class: server >> manifest
    set pro=%pr%jdk1.5.0
    set pro2=%pr%jdk1.6.0
    set jav=bin\jar.exe
    set go=jar3
    goto cj
    :jar3
    if not exist *.class (goto jre)
    %java% -cvfm %name%.jar manifest *.class
    del runserver.bat
    del manifest
    del *.class
    goto jl
    :jar4
    set pro=%pr%jre1.5.0
    set pro2=%pr%jre1.6.0
    set jav=bin\java.exe
    set go=jar5
    goto cj
    :jar5
    echo @echo off  >> runserver.bat
    echo title %name% >> runserver.bat
    echo %java% -cp .;%name%.jar server >> runserver.bat
    echo pause >> runserver.bat
    cls
    echo %name% Jar file successfully made. The runserver.bat will
    echo now load the Jar file. If you have any errors while runnning
    echo the Jar file, please post about it in Mod Taharok's 'Perfect
    echo Compiler' topic on MoparScape.
    pause
    goto menu
    set
    :color
    cls
    echo Would you like to change the backround color, change
    echo the text color, or reset it to default?
    echo.
    echo back - Change the backround color.
    echo text - Change the text color.
    echo def - Change all colors back to default.
    echo.
    echo.
    set /p color=Option:
    if %color%==back goto back
    if %color%==BACK goto back
    if %color%==text goto text
    if %color%==TEXT goto text
    if %color%==def goto co1
    if %color%==DEF goto co1
    if %color%==* goto er
    goto er
    :back
    cls
    echo Please select a color to change the backround to:
    echo.
    echo black
    echo white
    echo red
    echo yellow
    echo green
    echo blue
    echo purple
    echo.
    echo.
    set /p back=Color:
    if %back%== black (set b=0)
    if %back%== white (set b=7)
    if %back%== red (set b=4)
    if %back%== yellow (set b=6)
    if %back%== green (set b=2)
    if %back%== blue (set b=1)
    if %back%== purple (set b=5)
    goto co2
    :text
    cls
    echo Please select a color to change the text to:
    echo.
    echo black
    echo white
    echo red
    echo yellow
    echo green
    echo blue
    echo purple
    echo.
    echo.
    set /p back=Color:
    if %back%== black (set t=0)
    if %back%== white (set t=7)
    if %back%== red (set t=4)
    if %back%== yellow (set t=6)
    if %back%== green (set t=2)
    if %back%== blue (set t=1)
    if %back%== purple (set t=5)
    goto co2
    :c
    cls
    title Compiler
    set pro=%pr%jdk1.5.0
    set pro2=%pr%jdk1.6.0
    set jav=bin\javac.exe
    set go=c2
    goto cj
    :c2
    if exist src (goto cl) else (goto c3)
    :c3
    if exist *.java (goto cl2) else (goto ce)
    :c4
    %java% -cp . *.java
    echo Files Compiled Successfully!
    pause
    cls
    goto menu
    :c5
    %java% -cp . .\src\*.java
    echo Files Compiled Successfully!
    pause
    move .\src\*.class .\classes\
    cls
    goto menu
    :ce
    cls
    echo You must have Java files for this Compiler to Compile.
    pause
    cls
    goto menu
    :r
    cls
    title Runserver
    set pro=%pr%jre1.5.0
    set pro2=%pr%jre1.6.0
    set jav=bin\java.exe
    set go=r2
    goto cj
    :r2
    set rjava=%java% -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    cls
    goto r3
    :r3
    if exist .\classes\HelloJava.class (goto sl2) else (goto r4)
    :r4
    if exist .\server.class (goto sl) else (goto se)
    :r5
    %rjava%
    pause
    cls
    goto menu
    :r6
    set rjava=
    set rjava=%java% -cp .;./classes; Server
    %rjava%
    pause
    cls
    goto menu
    :se
    cls
    title Error
    echo You do not have a Server.class. Make sure that you have used the
    echo compiler with your server BEFORE you try runing it.
    pause
    cls
    goto menu
    :er
    cls
    title Error
    echo Invalid command. Please make sure the commands you type
    echo in are correct.
    pause
    cls
    goto menu
    :e
    cls
    exit
    :cj
    if exist "%pro2%_01\%jav%" (goto sj)
    if exist "%pro2%\%jav%" (goto sj2)
    if exist "%pro%_10\%jav%" (goto sj3)
    if exist "%pro%_09\%jav%" (goto sj4)
    if exist "%pro%_08\%jav%" (goto sj5)
    if exist "%pro%_07\%jav%" (goto sj6)
    if exist "%pro%_06\%jav%" (goto sj7)
    if exist "%pro%_05\%jav%" (goto sj8)
    if exist "%pro%_04\%jav%" (goto sj9)
    if exist "%pro%_03\%jav%" (goto sj10)
    if exist "%pro%_02\%jav%" (goto sj11)
    if exist "%pro%_01\%jav%" (goto sj12)
    if exist "%pro%\%jav%" (goto sj13) else (goto je)
    :sj
    set java="%pro2%_01\%jav%"
    goto %go%
    :sj2
    set java="%pro2%\%jav%"
    goto %go%
    :sj3
    set java="%pro%_10\%jav%"
    goto %go%
    :sj4
    set java="%pro%_09\%jav%"
    goto %go%
    :sj5
    set java="%pro%_08\%jav%"
    goto %go%
    :sj6
    set java="%pro%_07\%jav%"
    goto %go%
    :sj7
    set java="%pro%_06\%jav%"
    goto %go%
    :sj8
    set java="%pro%_05\%jav%"
    goto %go%
    :sj9
    set java="%pro%_04\%jav%"
    goto %go%
    :sj10
    set java="%pro%_03\%jav%"
    goto %go%
    :sj11
    set java="%pro%_02\%jav%"
    goto %go%
    :sj12
    set java="%pro%_01\%jav%"
    goto %go%
    :sj13
    set java="%pro%\%jav%"
    goto %go%
    :je
    cls
    title Error
    echo You do not have JDK 5.0 or JDK 6.0 or any JDK 5.0 and 6.0 updates.
    echo Go to Mod Taharok's tutorial on the Moparscape Tuturoials section
    echo for step-by-step instructions to download the newest JDK Update.
    pause
    cls
    goto menu
    :sl
    cls
    echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
    echo Server was run using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto r5
    :sl2
    cls
    echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
    echo Server was run using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto r6
    :cl
    cls
    echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
    echo Java files were compiled using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto c5
    :cl2
    cls
    echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
    echo Java files were compiled using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto c4
    :jl
    cls
    echo %name% Jar file created at %time% and on %date%. >> "Compile Logs.txt"
    echo Jar file was created using %java%. >> "Compile Logs.txt"
    echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto jar4
    :reset
    cls
    echo Resetting the Compiler's Logs...
    pause
    del "Compile Logs.txt"
    goto menuAs the pic says "5 duke stars for whoever can fix this"

    I got that exact problem I think, how did you fix it?? I been trying to make a server for a whole year, spent hours and hours trying to make it, and I can't do it... Need help... Whoever helps gets... Co on my server. :)

  • Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1 (wr

    Tthe program is getting compiled fine . After that I am giving hte command
    java JdbcExample1
    The error messge that comes is :
    Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1 (wrong name: com/stardeveloper/example/JdbcExample1)
    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)
    MY computer settings
    Java is installed in : c:\jdk1.3
    Classpath is
    C:\com\stardeveloper\example;C:\Documents and Settings\abhijeet\Desktop;c:\jdk1.3\bin;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar;C:\com\stardeveloper\example\JdbcExample2\mysql-connector-java-3.1.12-bin.jar;c:\jdk1.3\bin;c:program files\java\j2re1.4.2_11\bin\;C:\jdk1.3\jre\bin;%CLASSPATH%;
    CODE is :
    package com.stardeveloper.example;
    import java.sql.*;
    public class JdbcExample1 {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql:///test", "root", "desertgot123");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    }

    Thanks a lot all.....the code has started working but the reason for its running and non running remain unclear...
    1)When you give the command java JdbcExample1 inside the directory structure c:\com\startdeveloper\example ,it does not work
    \2) Including c:\ in the classpath also did not help
    3) Now after removing c:\ from the classpath and then going ot the c:\ i gave the command java com.stardeveloper.example.JdbcExample1. Voila it stated working.
    Some advice needed from you all guys..the way out to buil a databas e driven website seems seriously very complicated if this keeps happening.IS there any GUI based tool hat can help.
    Thanks a lot
    abhijeet

  • Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1/

    Dear all ,I am getting the following eror message while using JDBC to connect to MYSQL
    Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1/class
    The code comiles fine but when i run it the error comes.
    The java code used is as follows and it is in the directory c:\com\stardeveloper\example
    The classpath is set as
    classpath= .;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar;C:\com\stardeveloper\example\mysql-connector-java-3.1.12-bin.jar
    JAVA_HOME= C:\jdk1.3
    Java is installed in : C:\jdk1.3
    The mysql-connector-java-3.1.12-bin.jar is in the folder wher the code is i.e. C:\com\stardeveloper\example
    THE CODE IS AS FOLLOWS:
    package com.stardeveloper.example;
    import java.sql.*;
    public class JdbcExample1 {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql:///test", "root", "desertgot123");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    Please help
    Thanks in advance
    Regards
    Abhijeet

    Classpath is C:\com\stardeveloper\example;C:\Documents and Settings\abhijeet\Desktop;c:\jdk1.3\bin;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar;C:\com\stardeveloper\example\JdbcExample2\mysql-connector-java-3.1.12-bin.jar;c:\jdk1.3\bin;c:program files\java\j2re1.4.2_11\bin\;C:\jdk1.3\jre\bin;%CLASSPATH%;
    the program is getting compiled fine . After that I am giving hte command
    java JdbcExample1
    The error messge that comes is :
    Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1 (wrong n
    ame: com/stardeveloper/example/JdbcExample1)
    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)

  • Exception in thread main java.lang.NoClassDefFoundError: com/object/msg/Sms

    Exception in thread main java.lang.NoClassDefFoundError: com/object/msg/SmsService
    caused by: java.lang.NotFoundException: com.object.msg.SmsService
    at java.net........................
    at java.security.......
    I'm trying to send SMS using this code and it gives above Exception during Runtime.
    import java.io.File;
    import com.objectxp.msg.*;
    public class SendSMS
    public static void main(String[] args)
    SmsService service = null;
    try {
    // Configuration
    File config = new File("jsms.conf");
    // create service object.
    service = new GsmSmsService();
    service.init(config);
    // create a new Message.
    Message msg = new Message();
    msg.setRecipient("7894561");
    msg.setMessage("jSMS is cool!");
    // Connect to the device
    service.connect();
    // send the Message
    service.sendMessage(msg);
    System.out.println("Message sent successfully, ID is ");
    } catch (Exception ex) {
    System.err.println("Message could not be sent: "+ex.getMessage());
    ex.printStackTrace();
    } finally {
    if (service != null) {
    try {
    service.disconnect();
    } catch( Exception unknown ) {}
    service.destroy();
    }

    run this one in command prompt and then convert the applet using converter tool
    JC_HOME = C:\java_card_kit-2_2_2\bin\
    set CLASSES=%JCHOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;
    D:\NareshPalle\jcardRE\Smart\src>java -classpath %_CLASSES% com.sun.javacard.con
    verter.Converter -out EXP JCA CAP -exportpath .\exp -applet 0x0a:0x00:0x00:0x00:0x0e:0x01:0x02:
    0x03:0x04:0x05:0x06 PackageName appletName 0x01:0x02:0x03:0x04:0x05:0x0
    6:0x07:0x08 1.0
    or
    go to following directory and run the converter tool in command prompt
    step 1: cd C:\java_card_kit-2_2_2\bin\
    then run this command under the above directory
    step 2:converter -classdir E:\Pathof Your applet class file -out EXP JCA CAP -exportpath E:\path of exp files folder -applet AID PackageName AppletName PackAID major.minor no
    For more doubts mail me....
    *[removed by moderator]*
    Thanks and Regards
    NareshPalle
    Edited by: EJP on 31/03/2012 20:09: removed your email address. Unless you like spam and unless you think these forums are provided for your personal benefit only, posting an email address here serves no useful purpose whatsoever.

  • SQLJ error: "Exception in thread main java.lang.NoClassDefFoundError: sqlj/

    Hi,
    I am new to SQLJ. Now, in my PC (with Win98), I have JDK 1.2 and Oracle 8i (personal edition). I have used Java and Oracle in my PC without any problem. Now, I am going to learn SQLJ in order to create a java program to access Oracle database. What I have done is to set up several classpaths in DOS:
    SET classpath=C:\ora_program\sqlj\lib\translator.zip;
    SET classpath=C:\ora_program\sqlj\lib\runtime.zip;
    SET classpath=C:\ora_program\sqlj\lib\runtime12.zip;
    SET classpath=C:\ora_program\jdbc\lib\classes12.zip;
    The code of my program is:
    import java.sql.Date;
    import java.sql.SQLException;
    import oracle.sqlj.runtime.Oracle;
    import java.util.Date;
    public class Hello{
         public static void main(String[] args){
              java.sql.Date current_date;
              try{
                   // connect to the db
                   Oracle.connect(
                        "C:\ora_program\bin",
                        "system",
                        "manager");
                   // get the current date from the database
                   #sql{SELECT sysdate INTO :current_date FROM dual};
                   // display message
                   System.out.println("Hello, the current date is: "+ current_date);
              catch(SQLException e){
                   System.err.println("sqlException: "+e);
              finally{
                   try{
                        Oracle.close();
                   catch(SQLException e){
                        System.err.println("sqlException: "+e);
    And then I compile my program in DOS with the typing: sqlj Hello.sqlj
    The program cannot be compiled and the error message is:
    "Exception in thread main java.lang.NoClassDefFoundError: sqlj/tools/Sqlj"
    It indicates that the SQLJ translator class files cannot be found.
    I have set up the classpath in DOS (see above). How does the error come? Please help. Thanks.
    PC

    >
    SET classpath=C:\ora_program\sqlj\lib\translator.zip;
    SET classpath=C:\ora_program\sqlj\lib\runtime.zip;
    SET classpath=C:\ora_program\sqlj\lib\runtime12.zip;
    SET classpath=C:\ora_program\jdbc\lib\classes12.zip;
    The above only sets the classpath to the last value. You need to use the following.
    SET classpath=%classpath%;C:\ora_program\sqlj\lib\runtime.zip;

  • Exception in thread "main" java.lang.NoClassDefFoundError: Emp/class

    Dear all,
    It occur 'Exception in thread "main" java.lang.NoClassDefFoundError: Emp/class' error when I test a oracle java sample.I've already SET CLASSPATH=C:\ORACLE\JDBC\LIB\CLASSE~1.ZIP.
    following is the source code:
    import java.sql.*;
    class Emp
    public static void main (String args [])
    throws SQLException
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Connect to the database
    // You must put a database name after the @ sign in the connection URL.
    // You can use either the fully specified SQL*net syntax or a short cut
    // syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@localhost:1521:orcl",
                        "scott", "tiger");
    // Create a Statement
    Statement stmt = conn.createStatement ();
    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
    // Iterate through the result and print the employee names
    while (rset.next ())
    System.out.println (rset.getString (1));
    Can you tell me what should also be set in classpath?
    thanks in advance.

    You are right, the program is absolutely correct and I've run it before.but why set PATH=%PATH%;C:\ORACLE\JDBC\LIB\CLASSE~1.ZIP?I don't think it is correct.
    I've ever run this jdbc program before and remeber only set classpath(path is also be set only for run executable program, for example set path=%path%;c:\j2sdk\bin),
    I think the only difference with before is:
    1,oracle version is changed from enterprise version to personal version
    2,OS is changed from NT to windows 98
    but i dont know if it lead to problem and can you give me some advice?

  • Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoi

    I am getting the following exception described below:
    Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java, Compiled Code)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java, Compiled Code)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java, Compiled Code)
    at java.net.URLClassLoader.access$1(URLClassLoader.java, Compiled Code)
    at java.net.URLClassLoader$1.run(URLClassLoader.java, Compiled Code)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java, Compiled Code)
    at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java, Compiled Code)
    at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java, Compiled Code)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java, Compiled Code)
    at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
    at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
    at source.UserCompileASLFromPatch.getConnection(UserCompileASLFromPatch.java, Compiled Code)
    at source.UserCompileASLFromPatch.initialize(UserCompileASLFromPatch.java, Compiled Code)
    at source.UserCompileASLFromPatch.main(UserCompileASLFromPatch.java, Compiled Code)
    I am using java version "1.4.2_09" for the JDBC Connection. Is it the version problem or can be a problem specific to the code?

    hello debdatta
    The JVM is unable to find the class. Just check ur driver class whether its included in the class path.
    and its not getting the location of the file. The path where ur program is searching the class isnt there. so its the problem with ur path not the program.

  • Exception in thread "main" java.lang.NoClassDefFoundError: base

    this is my error, in my progam there is a database which has to insert the values. but is not inserting.
    the error is,
    Exception in thread "main" java.lang.NoClassDefFoundError: base
    at java.lang.ClassLoader.defineClass1(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)
    and the code for that program is as follows
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.*;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.io.*;
    class base
                                     PreparedStatement pstmt=null;
                   Connection con = null;
                   Statement stmt = null;
                   ResultSet rset = null;     
                   int est_effort;
                   String  proj_id,proj_name,client_name,strt_date,est_date,proj_mgr;
         void add( )
              try
                                             String driverName = "com.mysql.jdbc.Driver";
                   Class.forName(driverName);
                   String serverName = "192.168.10.253";
                   String mydatabase = "Trainees";
                   String url = "jdbc:mysql://" + serverName +  "/" + mydatabase; // a JDBC url
                   String username = "josep";
                   String password = "josep";
                   con = DriverManager.getConnection(url, username, password);
                   System.out.println("Connected");
                                           catch(Exception e)
                   System.err.println("Exception: " + e.getMessage());
              try{
    pstmt = con.prepareStatement("INSERT INTO project(proj_id,proj_name,client_name,strt_date,est_date,proj_mgr,est_effort)VALUES
                   pstmt.setString (1,proj_id);
                   pstmt.setString (2,proj_name);
                   pstmt.setString (3,client_name);
                   pstmt.setString (4,strt_date);
                   pstmt.setString (5,est_date);
                   pstmt.setString(6,proj_mgr);
                   pstmt.setInt (7,est_effort);
                   pstmt.executeUpdate();
              catch(Exception e)
                   System.err.println("Exception: " + e.getMessage());
              finally
                   try
                        if(con != null)
                             con.close();
                   catch(SQLException e)
         void modify()
         void delete()
         void assign()
    class xx extends base
         public static void main(String args[]) throws IOException
                    base a= new base();
                   a.add();
    }

    If you are trying something like:java xxThen class xx should be public. (Also Base and Xx are better names for
    classes.)

  • Reg:- Exception in thread "main" java.lang.NoClassDefFoundError

    Hi Friends,
    I am trying to connect to Central Management Server using Java.I have created a sample program.I set class path as
    D:\j2sdk1.4.2_14\lib;D:\Program Files\Business Objects\common\3.5\java\lib\rebean.wi.jar;D:\Program Files\Business Objects\common\3.5\java\lib\rebean.jar;D:\Program Files\Business Objects\common\3.5\java\lib\ceplugins.jar;D:\Program Files\Business Objects\common\3.5\java\lib\cesession.jar;D:\Program Files\Business Objects\common\3.5\java\lib\cecore.jar;D:\Program Files\Business Objects\common\3.5\java\lib\celib.jar;D:\Program Files\Business Objects\common\3.5\java\lib\.;.
    Source Code Sample.java
    import com.crystaldecisions.enterprise.ocaframework.ServiceNames;
    import com.crystaldecisions.sdk.exception.SDKException;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.pluginmgr.*;
    import com.crystaldecisions.sdk.plugin.*;
    import com.crystaldecisions.sdk.plugin.desktop.report.*;
    import com.crystaldecisions.sdk.plugin.desktop.user.*;
    import com.crystaldecisions.sdk.framework.*;
    import com.businessobjects.rebean.wi.LogicalOperator;
    import com.crystaldecisions.sdk.occa.infostore.*;
    import com.businessobjects.rebean.wi.*;
    import java.util.*;
    import java.lang.StringBuffer;
    import java.io.*;
    public class Sample1
    public static void main(String[] args)
    System.out.println("After Method Call");
    String Juname = "Administrator";
    String Jpwd = "";
    String Jcms = "hst-pcs4892:6400";
    String Jauth = "secEnterprise";
    SDKException Jfailure = null;
    boolean JloggedIn = true;
    IEnterpriseSession JenterpriseSession=null;
    // If no session already exists, logon using the specified parameters.
    if (JenterpriseSession == null)
    try
    /* Attempt logon. Create an Enterprise session
    * manager object.
    ISessionMgr JsessionMgr = CrystalEnterprise.getSessionMgr();
    // Log on to BusinessObjects Enterprise.
    JenterpriseSession = JsessionMgr.logon(Juname, Jpwd, Jcms, Jauth);
    String JlogonToken = JenterpriseSession.getLogonTokenMgr().getDefaultToken();
    catch (SDKException error)
    System.out.println("Exception Occured");
    JloggedIn = false;
    Jfailure = error;
    //System.out.println(JloggedIn);
    I am getting the following error
    Exception in thread "main" java.lang.NoClassDefFoundError: com/crystaldecisions/thirdparty/org/omg/CORBA/TRANSIENT
    at com.crystaldecisions.enterprise.ocaframework.ServiceMgrFactory.getServiceMgr(Unknown Source)
    at com.crystaldecisions.sdk.occa.security.internal.m.<init>(Unknown Source)
    at com.crystaldecisions.sdk.occa.security.internal.SecurityFactory.makeSecurityMgr(Unknown Source)
    at com.crystaldecisions.sdk.framework.internal.d.<init>(Unknown Source)
    at com.crystaldecisions.sdk.framework.internal.CEFactory.makeSessionMgr(Unknown Source)
    at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr(Unknown Source)
    at Sample1.main(Sample1.java:46)
    Please help me resolve this.
    Regards,
    Sriram.
    [email protected]

    Hi Cotton,
    First let me thank you for responding to this
    thread.I gave the class path where all these are
    availableJava disagrees with you.
    Do you know which jar com.crystaldecisions.thirdparty.org.omg.CORBA/TRANSIENT is supposed to be in?

  • Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/pool

    I have the following configuration:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    on a Suse 10.1 Linux.
    The javaversion is Java.Version = 1.4.2_11
    The classpath does look like:
    Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen> echo $CLASSPATH
    /derby.jar:/derbytools.jar:/derbynet.jar:/derbyclient.jar:/derbyTesting.jar:/local/derby/tools/java/jakarta-oro-2.0.8.jar:/derbyLocale_de_DE.jar:/derbyLocale_es.jar:/derbyLocale_fr.jar:/derbyLocale_it.jar:/derbyLocale_ja_JP.jar:/derbyLocale_ko_KR.jar:/derbyLocale_pt_BR.jar:/derbyLocale_zh_CN.jar:/derbyLocale_zh_TW.jar:/oracle/oracle/product/10.2.0/db_1/jdbc/lib/classes12.jar:/oracle/oracle/product/10.2.0/db_1/jdbc/lib/classes12.zip:/oracle/oracle/product/10.2.0/db_1/jlib/orai18n.jar:/oracle/oracle/product/10.2.0/db_1/jdbc/lib/ojdbc14.jar:/home/Eisele/Oracle/ojdbc14.jar:/home/Eisele/FH-Weihenstephan/Winter_Semester_200809/Uebungen
    Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen>
    The Program JDBCVersion.java which I copied out of the Oracle-Documentation looks like:
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    class JDBCVersion
    public static void main (String args[]) throws SQLException
    System.out.println("Java.Version = " + System.getProperty("java.version")) ;
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:scott/tiger@host:port:service");
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    I get the following error
    Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen> javac JDBCVersion.java
    Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen> java -cp ~/FH-Weihenstephan/Winter_Semester_200809/Uebungen/ JDBCVersion
    Java.Version = 1.4.2_11
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
    at JDBCVersion.main(JDBCVersion.java:10)
    Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen>
    Can anyone help me out here and tell me, what I did wrong ?
    Thanks in advance !
    Rüdiger

    Two thoughts.
    The first is that 10.2.0.1 is unpatched. Why? It has been two years since its release and no one has applied 10.2.0.2, 10.2.0.3 or 10.2.0.4.
    The second is that your question is not a database question but a Java question is you are more likely to get an answer that will help you if you post in a group where it is on-topic.

  • Error complie "Exception in thread "main" java.lang.NoClassDefFoundError"

    Dear All,
    I have the following problem can not compile the code below.
    Here my settings and the code.
    Thanks for the help.
    My java version.
    ===============================================
    D:\bea\jdk150_22\bin>java -version
    java version "1.5.0_22"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode)
    ===============================================
    I use a bat to compile the code
    ===============================================
    set JDK_HOME=D:\bea\jdk150_22
    set PATH=%JDK_HOME%\bin;%PATH%
    set CLASSPATH=%CLASSPATH%;D:\oracle\product\10.2.0\client_1\jdbc\lib\classes12.jar
    rem ---- compile
    javac GetDBOracle.java
    rem ---- testing
    java GetDBOracle
    rem ---- add to jar
    jar cf GetDBOracle.jar GetDBOracle.class
    ===============================================
    My java code
    ===============================================
    import java.sql.*;
    import java.io.*;
    public class GetDBOracle {
    public static String GetDBOracle(String Parm1, String Parm2) throws SQLException
    String myResult = "";     
    // Load Oracle driver
    DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
    // Connect to the local database
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@localhost:ORCL", "ORC", "ORC2010");     
    // Query the employee names
    Statement stmt = conn.createStatement ();
    ResultSet rset = stmt.executeQuery ("SELECT JAVA_GET_VALUE('"Parm1"','"Parm2"') FROM DUAL");
    // Print the name out
    while (rset.next ()) {
    myResult = rset.getString (1);
    //close the result set, statement, and the connection
    rset.close();
    stmt.close();
    conn.close();     
    return myResult;
    public static void main(String args[])
    try {
    System.out.println(GetDBOracle("XXI", "12000"));
    } catch (Exception e) {
    System.out.println(e.getMessage());
    ===============================================
    Erro
    ===============================================
    Exception in thread "main" java.lang.NoClassDefFoundError: GetDBOracle
    ===============================================

    What happened to this Error complie "Exception in thread "main" java.lang.NoClassDefFoundError" ?

  • Exception in thread "main" java.lang.NoClassDefFoundError: JDBCVersion

    I using the example in the online jdbc docs shown below:
    +++++++
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    class JDBCVersion
    public static void main (String args[]) throws SQLException
    OracleDataSource ods = new OracleDataSource();
    //ods.setURL("jdbc:oracle:thin:scott/tiger@host:port:service");
    ods.setURL("jdbc:oracle:thin:scott/tiger@testdb:1521:xe");
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    I compiles without a problem:
    C:\temp>javac JDBCVersion.java -classpath c:\instantclient\ojdbc6.jar
    +++
    I keep getting the following error when attempting to run the
    C:\temp>java JDBCVersion -classpath c:\instantclient\ojdbc6.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: JDBCVersion
    Caused by: java.lang.ClassNotFoundException: JDBCVersion
    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)
    Could not find the main class: JDBCVersion. Program will exit.
    I attempted to set my classpath using the parameter -classpath
    and setting the environment variable in the ontrol panel, system, adv, env. vars.
    I still get the error.
    Can someone provide some specific idea why this is occuring?
    Thanks in advance,
    Larry

    Thanks for the response. I also found a solution by setting the classpath using the environment variable in xp. I tried to set the environmental variable before, but I did it incorrectly(unknown to me); I set it up in the system variable portion. I was surfing around for solutions and found the proper way to set the value with this link. I hope it saves some else several days of work that it cost me :)
    http://faculty.ed.umuc.edu/~arnoldyl/NetBeansTutorials/Setting-Classpath.html

  • RE:Exception in thread "main" java.lang.NoClassDefFoundError:

    Hello all!
    I'm trying to connect to a 10g Oracle DB (10.2.0.1.0) from Java code using jdbc. however i get the error below when i try to run the following code in Eclipse. could you please help me out here. Thnx so much in advance.
    import java.sql.*;
    public class CreateCoffees {
    public static void main(String args[]) {
    String host="Francis-PC";
    int port=1521;
    String sid="orcl";
    String url = "jdbc:oracle:thin:@" host":"+port+":"+sid;
    Connection con;
    String createString;
    createString = "create table COFFEES " +
    "(COF_NAME VARCHAR2(32), " +
    "SUP_ID NUMBER, " +
    "PRICE NUMBER(4,2), " +
    "SALES NUMBER, " +
    "TOTAL NUMBER)";
    Statement stmt;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con = DriverManager.getConnection(url,"abiri", "abel");
    //con=DriverManager.
    stmt = con.createStatement();
    stmt.executeUpdate(createString);
    stmt.close();
    con.close();
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/instrument/ExecutionContextForJDBC
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:341)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:816)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at CreateCoffees.main(CreateCoffees.java:30)
    Caused by: java.lang.ClassNotFoundException: oracle.dms.instrument.ExecutionContextForJDBC
    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)
    ... 7 more

    Amasoni wrote:
    how can I include it in the Oracle's JDBC driver library plz?You don't; you learn how to properly set the Java classpath and you include the jars you need in it. If you don't know how to do that, I recommend you get a good book on Java for beginners.

Maybe you are looking for

  • Bundling in jar file doubt

    my application uses the some image file and properties file i want to bundle all the required files into single jar file and while double click it should lonch how can i acchive this

  • HT1338 help with installing Mountain Lion software...!

    i am trying to update my mac book pro with the mountain lion software. i have purchased this in my mac app store but do not see where to go from here to install... anyone know what to do? do i not have enough space to install the update? how do i tel

  • A problem about Live trace

    Hello, I use Adobe illustrator CS4 in MAC, I often used function of Make and convert to Live paint for my work. But One day i found a serious problem in used this function, I really don't know cause. Pleae look at the image under. This gray things ar

  • WORK FLOW & PROCEDURE FOR FOR SNP CAPACITY LEVELLING HEURISTICS RUN

    Dear Sir / Madam, Currently, we are  taking  only SNP Heuristics Run  and the output viz. planned stock transfer requisitions are being passed to PPDS as such. But now we feel, SNP capacity leveling can play a vital role in getting more fine tuned re

  • Minimize windows in CS3 Suite on WINDOWS 7

    Has anyone else experienced this??? or know of a way to fix it? When minimizing windows in Photoshop/Illy (the cs3 package) they go really small and display the X (close window sign) really big so when you want to Maximize you hit the close window bu