Exception in thread "main" java.lang.NoClassDefFoundError: Hello

Hi @ all!
I'm a newbie and maybe for advanced developers my problem is just a tiny one, but I can't solve it. So everytime I want to run my Hello.class in a DOS window with the commandline: java Hello, it print this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
Who can I solve it???

This is a common problem and everybody has had it! The Java runtime cannot find your class.
- make sure that your compilation worked and the "Hello.class" file exists.
- To test whether this is a classpath problem, navigate to the directory where "Hello.class" is located and then run "Java Hello" again (assumes you are not yet using packages). If it works, then add the directory to your classpath and you should be able to run from anywhere.
- if it doesn't work, post again with the error.
Good Luck

Similar Messages

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

    I installed jdk 1.5 on my windows XP SP2 system and tried to run a simple program:
    public class Hello {
         public static void main(String[] args) {
              System.out.println("Hello world!!");
    }     but i get the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: Hello/java
    I've set the classpath as:
    CLASSPATH=C:\Java\jdk1.5.0_09\lib;
    and path variableas:
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM;%SYSTEMROOT%\system32\WBEMC:\PROGRA~1\COMMON~1\AUTODE~1;C:\Java\jdk1.5.0_09\bin;c:\j2sdkee1.3.1\bin;c:\Java\jdk1.5.0_09\lib;
    I didn't have this problem when i was using SP1 of windows xp...
    Plz help!!

    Oh!! I didn't know this was a famous question of this forum!!
    Just added a semi-colon at the end of classpath and it works fine.... although a strange solution

  • Windows 2000: Exception in thread "main" java.lang.NoClassDefFoundError

    I've had much success using Java 1.4.0-beta under Win98. After upgrading to Win2000, I can't get Java to execute the class file. Everything compiles just fine, but when I attempt to execute the program, I get the following error (ics 21 is the folder with all my files, Hello is the program):
    C:\ics 21>java Hello
    Exception in thread "main" java.lang.NoClassDefFoundError: Hello
    Source code for the highly complex and mind boggling "Hello World!" program I'm attempting to run:
    public class Hello
         public static void main(String[] args)
              System.out.println("Hello world!");
    My PATH is setup just fine trust me, and my CLASSPATH ain't too shabby either. Like I said, everything compiles fine, it just doesn't run. Any help would be greatly appreciated!

    The Classpath setting is a list of directories in which the javac compiler and JVM search to find classes. That's why your error is almost certainly a Classpath problem. Your class Hello is in a file name Hello.class. The directory that holds Hello.class must be in your Classpath. One way to achieve this is to include . (the current directory) in your Classpath and CD to the directory where Hello.class is.

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

    i've set the classpath and path to point to my C:\j2sdk1.4.2_01\bin directory.
    but unfortunately when i ran my java file, i'm getting the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: hello
    **Note : Have tried this java file on another computer. it's running perfectly fine.
    Is there any other way i solve this matter?

    Dear,
    I think you should have posted this on new to java forum.
    classPath must be set to where your .class file is and not
    where java.exe(JDK) is.

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

    Hello;
    I got a error to run my application, i have not problem with compile it. But it give me the following error massage when i run it.
    Could anyone help me please.
    E:\Java>javac HelloWorldSwing.java
    E:\Java>java HelloWorldSwing
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldSwing
    E:\Java>path
    PATH=C:\Program Files\Java\jdk1.6.0\bin;C:\Program Files\QuickTime\QTSystem\;C:\
    Program Files\Common Files\Adobe\AGL;C:\Program Files\Microsoft SQL Server\80\To
    ols\BINN;C:\Program Files\Java\jre1.6.0\bin;C:\Program Files\Java\jre1.6.0\bin;C
    :\Program Files\Java\j2re1.4.2_13\bin
    The following are where my jdk and jre store.
    C:\Program Files\Java>dir
    Volume in drive C has no label.
    Volume Serial Number is 3023-229B
    Directory of C:\Program Files\Java
    04/02/2007 12:22 AM <DIR> .
    04/02/2007 12:22 AM <DIR> ..
    01/02/2007 10:54 PM <DIR> j2re1.4.2_13
    03/02/2007 04:54 PM <DIR> jdk1.6.0
    01/02/2007 10:02 PM <DIR> jre1.5.0_06
    04/02/2007 12:22 AM <DIR> jre1.6.0
    0 File(s) 0 bytes
    6 Dir(s) 5,761,228,800 bytes free

    It even tries to tell you what's wrong. Run class "start.HelloWorldSwing", not "HelloWorldSwing".
    I bet that copying that error message without the class name into Google would have given you the answer right away.

  • 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: 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: Helloworld

    Hi Java Experts,
    I am at a lost to how Java searches for all the classes when running a program. Below are the following steps I have taken to try a simple basic HelloWorld.java program on the command prompt on Windows XP (SP2) platform:
    ( i ) Installed both jdk1.5.0_09 and Netbeans IDE 5.0 and working properly.
    ( ii ) The source file is located in F:\Documents and Settings\abc\HeadFirstDesignPattern\src\ch11 and the compiled file is in F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes\ch11 which was compiled in Netbeans.
    ( iii ) No problem compiling & running this program in Netbeans.
    ( iv ) The RUN CLASSPATH in Netbeans is F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes.
    ( v ) No CLASSPATH variable has been set.
    ( vi ) The HelloWorld program looks like this:
    package ch11;
    public class HelloWorld {
    public static void main(String[] args) {
    System.out.println("Hello World!");
    ( vi ) Got the message
    "Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld"
    when running a combination of the following Java commands:
    ( a ) cd F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes
    ( b ) java HelloWorld, or
    java -cp . HelloWorld or java -cp "." HelloWorld, or
    java -cp F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes HelloWorld or "F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes" HelloWorld, or
    java -cp F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes;. HelloWorld or "F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes";. HelloWorld, or
    java -cp "F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes";. HelloWorld or "F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes";"." HelloWorld, or
    java -cp "F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes";. HelloWorld or "F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes";"." ch11\HelloWorld.
    It is the package location which is a subdirectory of F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes which caused Java not to find this program. I had no problem running it if the HelloWorld.java was moved one level up. ie from F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes\ch11 to F:\Documents and Settings\abc\HeadFirstDesignPattern\build\classes.
    I have written Java in the last year mostly on Netbeans without any problem running them.
    The reason for having to learn to run Java on the command line is so that I could add arguments to the program which I couldn't do in Netbeans just yet.
    I have gone through a lot of the articles from Java forums, Google searches but yet to have found a solution.
    Many thanks,
    Netbeans Fan

    I am getting the same problem when running the same program on a Fedora 4.0 (Redhat Linux 10) system, together with Netbeans 5.5 and JDK1.5.0_09. Again, I have no such problem when running the same program in Netbeans.
    Here are the steps that I have taken as follows:
    $ hostname
    spisu07.stvincents.com.au
    $ uname -a
    Linux spisu07.stvincents.com.au 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686
    $ pwd
    /home/dbi/HeadFirstDesignPattern/build/classes/ch11a
    $ cd ..
    $ pwd
    /home/dbi/HeadFirstDesignPattern/build/classes
    $ ls
    ch11a
    $ ls ch11a
    GumballMachine.class GumballMonitor.class NoQuarterState.class State.class
    GumballMachineRemote.class GumballMonitorTestDrive.class SoldOutState.class WinnerState.class
    GumballMachineTestDrive.class HasQuarterState.class SoldState.class
    $ java -cp . ch11a.GumballMachineTestDrive
    Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: ch11a.GumballMachineTestDrive
    at java.lang.VMClassLoader.transformException(java.lang.Class, java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0)
    at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.6.0.0)
    at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
    at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
    Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
    at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
    at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0)
    at java.lang.ClassLoader.loadClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
    at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)file:///usr/share/doc/HTML/index.html
    ...4 more
    $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/netbeans-5.5/bin:/etc/alternatives/.:/opt/netbeans-5.5/bin:/opt/jdk1.5.0_09:/etc/alternatives/.
    $ echo $JAVA_HOME
    $ echo $CLASSPATH
    Any suggestions?
    Thanks,
    Henry

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

    Hello,
    I am using the tool tzupdater over Solaris 9 to get java compliant with new DST (Daylight Saving Time) for US (2007).
    I am using the following command:
    # find /usr -fstype nfs -prune -o -fstype autofs -prune -o -name java -print -exec {} /marksman/packages/tzupdater2006p/tzupdater.jar -u \;
    Getting the following messages:
    /usr/bin/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/dt/appconfig/netscape/java
    /usr/j2se/bin/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/j2se/bin/sparcv9/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/j2se/jre/bin/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/j2se/jre/bin/sparcv9/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/j2se/opt/javahelp/doc/api/com/sun/java
    /usr/java
    /usr/iplanet/console5.1/java
    /usr/iplanet/ds5/java
    /usr/iplanet/admserv5.1/java
    /usr/apache/jserv/docs/api/org/apache/java
    /usr/java1.2/bin/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/java1.2/jre/bin/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/java1.2/jre/bin/sparc/native_threads/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/appserver/samples/rmi-iiop/cpp/src/client/java
    /usr/appserver/samples/rmi-iiop/cpp/src/client/org/omg/boxedRMI/java
    /usr/dlc91d/jre/bin/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/dlc91d/jre/bin/sparc/native_threads/java
    Exception in thread "main" java.lang.NoClassDefFoundError: /marksman/packages/tzupdater2006p/tzupdater/jar
    /usr/dlc91d/java
    Any idea why I am getting this error, and how can I fix it?
    Thank you

    Hi,
    I was wondering if you ever saw a resolution to your problem. I am seeing the same error on Windows and can't figure out what is causing it. Any information is appreciated.
    Thanks,
    Marina Orton

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

    Dear Sir/Madam
    I downloaded the Weblogic610 server five times, and when I install it on my Linux
    box (RedHat 7.1), I always met the exception like:
    Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server
    When I check with lib directory, there is weblogic.jar here, but the file looks
    was damaged, the file size is ok, but I can't open it by use jar tool or other
    tools.
    Some packeage is very strange, after my downloaded, and install, there are only
    a few files in lib directory and some subdirectory and weblogic.jar is missing,
    but the download is normal.
    So, I hope who guy have similar experience, please let me know.
    Thank you
    Cidy

    Hi Raj,
    Could you provide more information from the log; is there a full
    traceback. A first step may be to use the latest service pack [1].
    Also you might try your question in the management newsgroup [2] or
    contact our outsanding support group [3].
    Hope this is of some value,
    Bruce
    [1]
    http://commerce.bea.com/showproduct.jsp?family=WLS&major=8.1&minor=2
    [2]
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.management
    [3]
    http://[email protected]
    Raj wrote:
    >
    Hello All,
    I have installed wls 8.1 and created domain. I have manged server running at other location.I am getting the following Log,When i tried to start managed server from admin server
    java.lang.NoClassDefFoundError: weblogic/Server Exception in thread "main"
    and on admin side
    The request to start the server ecgNode01 of domain CQ6UIDomain failed because the node manager did not hear from the managed server in the configured timeout period. Despite this, if the managed server has not failed, it will come up and the node manager will start monitoring it. To adjust this timeout so that the task does not fail prematurely, please refer to the node manager property ScavangerDelaySeconds (Default value : 180 seconds. Current value : 180 seconds
    can anyone tell me where i went wrong

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

    I am very new to java. Tried to take the time to learn but got wrapped up in other things. Now I am back to learn and here is what I am getting. I don't know if it has anything to do with java required files being in a different directory or what. I have my java sdk files in C:\Program Files\Java\jre1.6.0_05\ and the source file is in C:\Java
    Here is more information.
    My Error at runtime:_
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
    My actions in the shell:_
    C:\Java>javac HW.java
    C:\Java>java HW
    Exception in thread "main" java.lang.NoClassDefFoundError: HW
    Caused by: java.lang.ClassNotFoundException: HW
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    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:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    My Source:_
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    class HW {
        public static void main(String[] args) {
            System.out.println("Hello World!"); // Display the string.
    }

    My Error at runtime:_
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
    Exception in thread "main" java.lang.NoClassDefFoundError: HW
    Caused by: java.lang.ClassNotFoundException: HWO_o
    That's two different errors.
    Try to execute with:
    java -cp . HW

  • Exception in thread "main" java.lang.NoClassDefFoundError in Textpad

    Hello to everybody:
    I programed in java some time ago and now i'm trying to recycle and start again with it. I was programming using Textpad and compiling and excuting the files from there. Now i'm trying to configure it the same way that i had it some time ago. But i'm not able.
    My program is just a operation of 2 numbers. I know it's so dumb :P but i'm trying to learn again. I can compile it (Ctrl+1, using the instruction javac of j2sdk1.4.2_13) but when i try to execute (Ctrl+2, instruction java.exe) i throws me this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: 6
    where "6" is the first parameter for the program.
    I put the CLASSPATH in enviromental variables
    CLASSPATH: C:\j2sdk1.4.2_13\bin;.
    PATH: C:\j2sdk1.4.2_13\bin (this last one after all the others that existed before and separated by ";" )
    If i try to execute it from the promp using the instructions javac.exe and java.exe it works ok. And using NetBeans too. So i have to think it's sth from textpad.
    Can somebody help me? Thank you to everybody for your time.

    Hey, first of all thank you for your help again.
    I'm trying to execute it in the textpad itself. You press Ctrl+2 and appears a window to put the arguments. So there's a parameter called $File (maybe that's the problem, this name should be another one), the name of the current project you're trying to execute. I've tried to put the class name between but it threw me the same error changing the parameter for the class name. So finally i've put the name of the project without extension and after it the arguments, and it has work. I'll go on looking for the parameter to substitute the project name.
    Thank you for all your help. It's the first time i enter in a forum and you've been really helpful. Tahnk you so much. Sure you'll see me here again,, cos i'm a kid of rookie:P

  • 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.

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

    Hello everyone,
    Can someone enlighten my mind with this error?
    import java.io.*;
    public class TestInputs
         public static void main(String [] args) throws IOException
              DataInputStream din = new DataInputStream(System.in); // read inputs from keyboard
              InputStreamReader inReader = new InputStreamReader(din);
              BufferedReader inBuf = new BufferedReader(inReader);
              String s = inBuf.readLine( );
         } // end main( )
    } // end class
    Error:
    Exception in thread "main" java.lang.NoClassDefFoundError: TestInputs

    Looks like your CLASSPATH is not setup properly.
    Make sure that TestInputs.class is on your class path when you run
    "java TestInputs"
    and that you copiled it

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

    I have set the path, classpath and also compiled the HelloWorldApp.java file and my main is public static void main.
    public class HelloWorldApp
    public static void main(String[] args)
    // Display "Hello World!"
    System.out.println("Hello World!");
    I still get this error
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp

    For better understanding:
    I have set the classpath in the autoexec.bat following:
    set CLASSPATH="C:\TEST;.;";
    and I have a userdefined class in c:\jdk1.3.1_01\jre\lib\ext\myclass.jar
    compiling works, but when I run the program in c:\TEST\Hello.java I get the java.lang.NoClassDefFoundError Message.
    My source code looks like this:
    import myclass.*;
    public class Hello extends MyClass{
         public static void main(String[] args)     {
              System.out.println("Hello");

Maybe you are looking for