Exception in thread "main" java.lang.ClassNotFoundException

I am trying to compile a very simple java program in windows vista, I am using jdk1.6.0_15:
public class Success {
public static void main (String [] args) {
System.out.println ("hooray!");
no problem with compilation, but I keep getting the following error message when I run java Success:
Exception in thread "main" java.lang.ClassNotFoundException: Success
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:307>
at sun.misc.Launcher$AppClassLoader.loadClass<Launcher.java:301>
at java.lang.ClassLoader.loadClass<ClassLoader.java:252>
at java.lang.ClassLoader.loadClassInternal<ClassLoader.java:320>
Couldn’t find the main class: Success program will exit.
Please help!!
thanks
Thomas

the out put is:
after running javac Success.java a Success.class file gets created
when I run java Success cmd i get the following error message:
Exception in thread "main" java.lang.ClassNotFoundException: Success
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:307>
at sun.misc.Launcher$AppClassLoader.loadClass<Launcher.java:301>
at java.lang.ClassLoader.loadClass<ClassLoader.java:252>
at java.lang.ClassLoader.loadClassInternal<ClassLoader.java:320>
Couldn’t find the main class: Success program will exit.
thanks.

Similar Messages

  • Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.dr

    Hi
    I am trying to use type 4 driver to connect to my Oracle 9i Rel2 database. I downloaded the odbc14.jar from oracle and added in the C:\Oracle9i\jdbc\lib path. As on the website, I setup my environment:
    Setting Up Your Environment
    On Win95/Win98/NT:
    - Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
    [ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
    used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
    - Make sure [ORACLE_HOME]\bin is in your PATH.
    Still I am getting the following error during runtime:
    Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    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)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at jdbc.InsertQueryEx.main(InsertQueryEx.java:11)
    Below is the source code:
    import java.sql.*;
    import java.io.*;
    public class InsertQueryEx {
    public static void main(String[] args)throws Exception{
    Class.forName("oracle.jdbc.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@Prashy:1521:orcl", "scott", "tiger");
    DataInputStream din = new DataInputStream(System.in);
    Statement stmt = con.createStatement();
    while(true){
    try{
    System.out.println("enter emp name");
    String name = din.readLine();
    System.out.println("enter emp no");
    int no = Integer.parseInt(din.readLine());
    System.out.println("enter emp salary");
    float sal = Float.parseFloat(din.readLine());
    System.out.println("enter emp address");
    String addr = din.readLine();
    int count = stmt.executeUpdate("insert into myemp values("+no+",'"+name+"',"+sal+",'"+addr+"')");
    if(count>0)
    System.out.println("Record added");
    else
    System.out.println("Failed");
    catch (Exception e){
    System.err.println("Exception: "+e.getMessage());
    Any help is appreciated
    Thanks
    Prashant

    I am sorry but I did add those in the classpath but still getting this error:
    This is what I have for user variable in classpath:
    .;C:\Oracle9i\jdbc\lib\ojdbc14.jar;C:\Oracle9i\jdbc\lib\nls_charset12.jar
    error is:
    java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
         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)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at jdbc.InsertQueryEx.main(InsertQueryEx.java:14)
    Thanks

  • On starting WebLogic getting Error : Listening for transport dt_socket at address: 8453 Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m

    Hi,
    system i am using for Oracle SOA is :
    Windows 64 Bit
    i5 Processor
    6 GB RAM
    29 GB on C Drive is already free after installation of all SOA related products.
    I have installed wlserver_10.3 for SOA 11g Development purpose and followed exact installation sequence and procedure as mention in oracle documentation
    i created domain also and every thing look correct but after installation procedure there are "Additional actions required just after every thing installed" :
    setting memory limit
    starting weblogic server (Admin Server)
    starting weblogic managed server
    and so on
    now Problem is when i execute C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin startWebLogic.cmd
    as mention in oracle documentation i am getting following error message : (i have only included last error lines instead of complete console log)
    oConsole= -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\
    sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_oepe180\profiles\default\syse
    xt_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sysext_ma
    nifest_classpath;C:\Oracle\MIDDLE~1\patch_adfr1111\profiles\default\sysext_manif
    est_classpath  weblogic.Server
    Listening for transport dt_socket at address: 8453
    Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m
    Caused by: java.lang.ClassNotFoundException: vXmx512m
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: ++Xmx512m.  Program will exit.
    Now to resolve this what i already tried are :
    I change JAVA_HOME and PATH to jdk6 which came with web logic installer
    Location is at :
    JAVA_HOME : C:\Oracle\Middleware\jdk160_29
    PATH : C:\Oracle\Middleware\jdk160_29\bin
    The above dose not include any space between path
    I ran the startWebLogic.cmd and got same error
    After that I also added
    CLASSPATH : C:\Oracle\Middleware\jdk160_29\lib\tool.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\jdk160_29\bin
    WL_HOME:  C:\Oracle\Middleware\wlserver_10.3
    I ran the startWebLogic.cmd and got same error
    I also used earlier path which I used with eclipse when I was working on other java development.
    JAVA_HOME : C:\Program Files\Java\jdk1.7.0_21
    PATH : C:\Program Files\Java\jdk1.7.0_21\bin
    I ran the startWebLogic.cmd and got same error
    Then I also gave PATH: C:\Oracle\Middleware\wlserver_10.3\server\lib      (including the existing one using ; )
    I ran the startWebLogic.cmd and got same error
    Now may be there is a file called setSOADomainEnv.cmd in
    < C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\ setSOADomainEnv.cmd>
    That include some values for memory set :
    set JAVA_OPTIONS=%JAVA_OPTIONS%
    set DEFAULT_MEM_ARGS=-Xms512m –Xmx512m
    set PORT_MEM_ARGS=-Xms512m –Xmx768m
    if "%JAVA_VENDOR%" == "Oracle" goto OracleJVM
    set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=768m
    set PORT_MEM_ARGS=%PORT_MEM_ARGS% -XX:PermSize=256m -XX:MaxPermSize=768m
    now as I change the red highlighted value to 512 value because I have less memory resource and I checked in installation documentation to change the above red highlighted value to 512 original is 1024 which is too high and it was crating problem and showing memory space problem so I change it to 512 and now I am not getting that memory space problem error but may be the above error is related with change value in setSOADomainEnv.cmd file or not
    Following are my domain, weblogic and soa home directory path and all these path are exactly what it suppose to be according to Oracle Installation Documentation:
    WebLogic :
    C:\Oracle\Middleware\wlserver_10.3
    C:\Oracle\Middleware\coherence_3.7
    C:\Oracle\Middleware\oepe_11.1.1.8.0
    SOA Oracle Home Directory :
    C:\Oracle\Middleware\Oracle_SOA1
    OSB Home Location :
    C:\Oracle\Middleware\Oracle_OSB1
    Domain name : soa_div_domain
    Domain Location :       C:\Oracle\Middleware\user_projects\domains
    Application Location :  C:\Oracle\Middleware\user_projects\applications
    Domain Location:        C:\Oracle\Middleware\user_projects\domains\soa_div_domain
    form here i am trying to start weblogic : C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\startWebLogic.cmd
    Please tell me any body want more details.
    Thanks.

    I think you are missing a character '-'
    USER_MEM_ARGS="Xms512m -Xmx512m -XX:MaxPermSize=128m"Add this character like follows
    "-Xms512m -Xmx512m -XX:MaxPermSize=128m"

  • Exception in thread "main" java.lang.NullPointerException error JDeveloper 12c

    Hello,
    I am trying to call a java stored procedure in java application. I am using ORACLE database and JDeveloper.
    I am getting error "Exception in thread "main" java.lang.NullPointerException. I have no idea what have I been doing wrong.
    I have a table "Beer" and I want to select all the data out with a stored procedure which I call out of Java app.
    I have a java.class file Store_A.java which I have loaded into the ORACLE database with LOADJAVA :
        import java.sql.*;
        import java.io.*;
        public class Store_a {
          public static void apskatit ()
            throws SQLException
            { String sql =
              "SELECT * FROM Beer";
            try { Connection conn = DriverManager.getConnection("jdbc:default:connection:");
              PreparedStatement pstmt = conn.prepareStatement(sql);
              ResultSet rset = pstmt.executeQuery();
              rset.close();
              pstmt.close();
            catch (SQLException e) {System.err.println(e.getMessage());
    Then I have created a procedure which I plan to call out in java:
        CREATE OR REPLACE PACKAGE Store_a AS
        PROCEDURE apskatit;
        END Store_a;
        CREATE OR REPLACE PACKAGE BODY Store_a AS
        PROCEDURE apskatit AS LANGUAGE JAVA
        NAME 'Store_a.apskatit()';
        END Store_a;
    And I have a java file that I have created with JDeveloper 12c:
        import java.sql.Connection;
        import java.sql.DriverManager;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        public class Class1 {
             * @param args
            public static void main(String[] args) throws SQLException {
                Connection conn = null;
                try {
                    Class.forName("oracle.jdbc.driver.OracleDriver");
                    //Izveidojam savienojumu
                    conn = DriverManager.getConnection("jdbc.oracle.thin:@localhost:1521", "SYSTEM", "asdasd");
                    // Izveidojam callable statement
                    CallableStatement stmt = conn.prepareCall("CALL Store_a.apskatit()");
                    ResultSet resul = stmt.executeQuery();
                    while (resul.next()) {
                        System.out.println(resul.getInt(1) + "\t" + resul.getString(2));
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                } finally {
                    try {
                        conn.close();
                    } catch (SQLException e) {
                        e.printStackTrace();
    When I try to run the java file, I get this error "Exception in thread "main" java.lang.NullPointerException at client.Class1.main(Class1.java:29).
    So the line I get error in is "conn.close();"
    How to fix this?
    Thank you very much in advance.

    I am trying to call a java stored procedure in java application. I am using ORACLE database and JDeveloper.
    I am getting error "Exception in thread "main" java.lang.NullPointerException. I have no idea what have I been doing wrong.
    Maybe you haven't read it yet but I told you in your other thread what you were doing wrong and, step by step, how to address the problem.
    https://forums.oracle.com/thread/2611124
    I'm not going to repeat everything again just this one main piece of advice:
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    You are trying to deal with too many different issues at the same time. Unless you solve your primary Java problem by fixing the code outside the DB you will have nothing but problems loading it into the DB.
    And just get rid of this line of code - you don't need it anymore and it hasn't been done like that for many years now:
    Class.forName("oracle.jdbc.driver.OracleDriver");

  • 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

  • Stuck for 2 days: Exception in thread "main" java.lang.NoClassDefFoundError

    I wrote the code in netbeans 5.5 under windows XP and compiled perfectly. I tried to run the generated Jar file code in the command prompt and it did work perfectly.
    C:\Datahub\dist> java -jar Datahub.jar
    BUT when I took the jar file and tried to run it under linux here is what I got:
    Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: main.hw
    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:Datahub.jar,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)
    ...4 more
    The project i am working on is funded by IBM and they will be really mad if it didn't work :(
    Please help.

    It is not clear what You want to run under Linux. Jar under JVM or native code? If You are going to use JVM make it clear for Yourself which one You are going to use and then make sure it is installed properly.

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

  • Exception in thread "main" java.lang.NoClassDefFoundError: server Caused by

    I get this error when running a batch file
    Exception in thread "main" java.lang.NoClassDefFoundError: serverCaused by: java.lang.ClassNotFoundException: server
    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)
    Press any key to continue . . .
    I need to get this fixed because i can't run or compile

    Hi,
    It quite simple.
    It is missing with weblogic.jar with in classpath.
    Try to set weblogic.jar with in pre-classpath in setdomainEnv.sh file and restart the server
    You will find the weblogic.jar with in %WLS_Home% / server / lib
    Hope this should help you.
    Regards,
    Kal

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

    I'm writing a simple swing application. It compiles, but I can't get it to run... I always get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: BlueCheese
    Caused by: java.lang.ClassNotFoundException: BlueCheese
    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)
    I tried running another app, and it works just fine. Here is the source code:
    package zing.blueCheese;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class BlueCheese
         private JFrame frame;
         private static void createGUI()
              JFrame frame = new JFrame("FileSmasher");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              ImageIcon icon = new ImageIcon("Mac.gif");
              JTabbedPane tabbedPane = new JTabbedPane();
              JLabel label = new JLabel("<html><font size=6>1:</font></html>");
              JPanel panel = new JPanel();
              tabbedPane.addTab("Parse", icon, panel, "Smash a file");
              panel = new JPanel();
              tabbedPane.addTab("Concatenate", icon, panel, "Assemble the smashed pieces of a file");
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args)
              SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        createGUI();
    Any suggestions?

    yawmark wrote:
    java -cp . zing.blueCheese.BlueCheeseExecuted in the directory containing the "zing" subdirectory (which itself should contain "blueCheese/BlueCheese.class"). Note the "dot" and spaces, which mean "add the current directory to the classpath". Alternately, you could add the full path to the directory containing "zing" to the classpath. Example:java -cp . path/to/dir zing.blueCheese.BlueCheese~Shouldn't that be (with appropriate path separator)
    java -cp.:path/to/dir zing.blueCheese.BlueCheese?

  • Another .....Exception in thread "main" java.lang.NoClassDefFoundError: Hw

    Here is my Java:
    package classes.com.mattclark.hw;
    import java.lang.*;
    public class Hw {
      private static Object mainClass = null;
      private Short var1 = null;
      public Hw(){
        var1 = new Short("0");
        System.out.println("| Class Name           |           Minimum Value |           Maximum Value |");
        System.out.println("----------------------------------------------------------------------------");
        System.out.println("| " + rPad(var1.getClass().getName(), 20) +
                           " |" + lPad(String.valueOf(var1.MIN_VALUE), 24) +
                           " |" + lPad(String.valueOf(var1.MAX_VALUE), 24) +
                           " |" );
      private String rPad(String initialString, int width) {
        String returnString = null;
        if(initialString.length() >= width) {
          // truncate the string and return it
          returnString = initialString.substring(0, width-1);
        } else {
          returnString = initialString;
          for(int i=initialString.length(); i<width; i++) {
            // pad the return string to the right
            returnString = returnString.concat(" ");
        return returnString;
      private String lPad(String initialString, int width) {
      String returnString = null;
      if(initialString.length() >= width) {
        // truncate the string and return it
        returnString = initialString.substring(0, width-1);
      } else {
        returnString = new String("");
        for(int i=initialString.length(); i<width; i++) {
          // pad the return string to the right
          returnString = returnString.concat(" ");
        returnString = returnString.concat(initialString);
      return returnString;
    public static void main(String[] args) {
        mainClass=new Hw();
    } I have tried other solution from other "Exception in thread "main"" posts
    I have tried all kinds of CLASSPATH's
    My teacher said to use: Set CLASSPATH=D:\java3\hw\classes

    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

  • 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: weblogic/securit

    Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/security/subject/AbstractSubject
    hi i am trying to run ejb2 stateless session bean program but i am unable to solve the exception
    can anybody please help me to solve this problem..
    thanks in advance..
    Edited by: 959687 on Sep 17, 2012 10:17 PM

    E:\Oracle\Middleware\jdk160_35\bin>java weblogic.WLST E:\Oracle\Middleware\Oracl
    e_SOA\bin\soa-createUDD.py --domain_home E:/Oracle/Middleware/user_projects/doma
    ins/EPMSystem --soacluster soacluster
    Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/WLST
    Caused by: java.lang.ClassNotFoundException: weblogic.WLST
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: weblogic.WLST.  Program will exit.

  • The following Error:  Exception in thread "main" java.lang.NoClassDefFoundE

    Dear People,
    I would really kindly welocme any help on the following error problem:
    Exception in thread "main" java.lang.NoClassDefFoundError: CoreUpdate
    The program compiles successfully and there are no errors generated from that but I get the above error when I try to run it. I have scanned over all the previous replies that have been posted for this sort of error and have tried all the following solutions:
    1) Set classpath to point to the bin and lib directories of where the JDK1.3.1 is installed in.
    2) Have actually placed in my classpath the EXACT directory to which the tools.jar file is located (within the lib directory).
    So WHAT ELSE is there to do?? I am really frustrated with this problem and I have re-started my computer in order to boot the classpath into gear but still no joy!
    I am running Win2k so do I actually have to go into my autoexec.bat file and type the classpath in there aswell(to which I havent done) or can I just go through my computer on my desktop and then to environment variables and set it up in there (to which I have done already and nopthing seems to work)?
    PLEASE PLEASE PLEASE help!! I very frustated girl programmer!!!
    Any help would be very much appreciated!
    Regards
    Helen Pringle

    Sorry about that last email - this is the errors I get now after I have placed that '.' to my classpath!
    The program is trying to access a MySQL DB.
    java.lang.ClassNotFoundException: org.gyt.mm.mysql.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:290)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:124)
    at CoreUpdate.main(CoreUpdate.java:13)
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:477)
    at java.sql.DriverManager.getConnection(DriverManager.java:159)
    at CoreUpdate.main(CoreUpdate.java:24)
    Regards
    Helen

  • Exception in thread "main" java.lang.NoClassDefFoundError: oracle/apex/APEX

    Hi All,
    Getting the above error when running the following export utility:
    $ java oracle/apex/APEXExport
    ABove error is thrown.
    I have looked at most blogs suggested by ML.
    Here are my env params:
    echo $CLASSPATH
    /u01/app/oracle/product/11.2.0/db_1/jdbc/lib/ojdbc5dms.jar
    ( No, i don't see any classes12.jar. The classes12.zip resides in oui folder. I tried that as well and it didnt work)
    echo $JAVA_HOME
    /usr/java/jdk1.7.0_02
    So for the heck of it, I tried:
    $ export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/classes12.zip
    and lo, I am able to at least summon this:
    $ java oracle/apex/APEXExport
    Usage APEXExport -db -user -password -applicationid -workspaceid -instance -skipExportDate -expSavedReports -debug
    -db: Database connect url in JDBC format
    -user: Database username
    -password : Database password
    -applicationid : ID for application to be exported
    -workspaceid : Workspace ID for which all applications to be exported
    -instance : Export all applications
    -skipExportDate : Exclude export date from application export files
    -expSavedReports: Export all user saved intera
    BUT: when invoking specific job, I get this:
    java oracle/apex/APEXExport -db hostname:1521:SID -user apex_030200 -password welcome123 -instance
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
    at oracle.apex.APEXExport.main(APEXExport.java:315)
    any ideas?

    Hello,
    I get a very similar error.
    Windows 7 Ultimate SP1
    Oracle XE 11.2
    Apex 4.1
    jdk 6u31-windows x64.exe (installed to C:\Program Files\Java\jdk1.6.0_31\.....)
    User Variable CLASSPATH = .\; C:\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib\ojdbc5.jar
    User Variable JAVA_HOME = C:\program files\java\jdk1.6.0_31\jre\bin
    User Variable ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server
    System Variable PATH = C:\oraclexe\app\oracle\product\11.2.0\server\bin;;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\11.0\DLLShared\;C:\Program Files (x86)\Pinnacle\Shared Files\;C:\Program Files (x86)\Pinnacle\Shared Files\Filter\;C:\Program Files (x86)\QuickTime\QTSystem\
    At the C:\apex\utilities directory I give the command:
    java oracle.apex.APEXExpress -db localhost:1521:XE -user SUSANNA -password skippy123 -expworkspace
    I get the error:
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/apex/APEXExpress
    Caused by: java.lang.ClassNotFoundException: oracle.apex.APEXExpress
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doProvileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: oracle.apex.APEXExpress. Program will exit.

Maybe you are looking for