How to solve this problem"exception in thread "main" java.lang.noclassdeff"

I am a tyro of java programming .
i downloaded the j2sdk-1_4_2_09-windows-i586-p.exe from www.java.sun.com and installed it at the defaulted path C:\j2sdk1.4.2_09,
then i wrote down my first java program as follow:
public class hello
public static void main (String args[])
System.out.println("hello,����!");
}and stored it at C:\Javasmp\ch01\hello.java.
after that i opened dos commind window and compiled it :
c:\javac C:\Javasmp\ch01\hello.java. and obtained file hello.class (C:\Javasmp\ch01\hello.class)
but when running it (c:\java C:\Javasmp\ch01\hello) there was a mistake:
exception in thread "main"java.lang.noclassdeffounderror:C:\Javasmp\ch01\hello
i searched on the internet and found out the solution is set enviroment viriable ,so i set the "CLASSPATH" as".;C:\j2sdk1.4.2_09\lib;C:\j2sdk1.4.2_09\lib\tools.jar" ,"PATH" as"C:\j2sdk1.4.2_09\bin;C:\Windows\system32;c:\windows\system32\Wbem" and "JAVA_HOME" as "C:\j2sdk1.4.2_09\bin;C:\j2sdk1.4.2_09\jre\bin"
afer that, i opened a new dos command window and run it again ,but the problem was still unsolved.
in addition,my os is "windows xp"
anyone can help me ,thank you!
i am a student in China,it's a hard time for me to write down my question in english ,i doubt whether i express my question clearly.
thank you for you reading.

I have created a simple applet.
import java.lang.*;
import java.awt.*;
public class jawtex3 extends java.applet.Applet
public void init()
add(new Button("One"));
add(new Button("Two"));
public Dimension preferredSize()
return new Dimension(200, 100);
public static void main(String [] args)
Frame f = new Frame(" jawtex3");
jawtex3 ex = new jawtex3();
ex.init();
f.add("Center", ex);
f.pack();
f.show();
In this no compilation errors.
I am getting runtime exception.as Exception in thread "main"java.lang.NoClassDefFound Error: jawtex
reply me soon.
thankyou.

Similar Messages

  • HELP Needed with this error:   Exception in thread "main" java.lang.NoClass

    Folks,
    I am having a problem connecting to my MSDE SQL 2000 DB on a WindowsXP pro. environment. I am learning Java and writing a small test prgm to connect the the database. The code compiles ok, but when I try to execute it i keep getting this error:
    "Exception in thread "main" java.lang.NoClassDefFoundError: Test1"
    I am using the Microsoft jdbc driver and my CLASSPATH is setup correctly, I've also noticed that several people have complained about this error, but have not seen any solutions....can someone help ?
    Here is the one of the test programs that I am using:
    import java.sql.*;
    * Microsoft SQL Server JDBC test program
    public class Test1 {
    public Test1() throws Exception {
    // Get connection
    DriverManager.registerDriver(new
    com.microsoft.jdbc.sqlserver.SQLServerDriver());
    Connection connection = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://LAPTOP01:1433","sa","sqladmin");
    if (connection != null) {
    System.out.println();
    System.out.println("Successfully connected");
    System.out.println();
    // Meta data
    DatabaseMetaData meta = connection.getMetaData();
    System.out.println("\nDriver Information");
    System.out.println("Driver Name: "
    + meta.getDriverName());
    System.out.println("Driver Version: "
    + meta.getDriverVersion());
    System.out.println("\nDatabase Information ");
    System.out.println("Database Name: "
    + meta.getDatabaseProductName());
    System.out.println("Database Version: "+
    meta.getDatabaseProductVersion());
    } // Test
    public static void main (String args[]) throws Exception {
    Test1 test = new Test1();

    I want to say that there was nothing wrong
    with my classpath config., I am still not sure why
    that didn't work, there is what I did to resolved
    this issue.You can say that all you like but if you are getting NoClassDefFound errors, that's because the class associated with the error is not in your classpath.
    (For future reference: you will find it easier to solve problems if you assume that the problem is your fault, instead of trying to blame something else. It almost always is your fault -- at least that's been my experience.)
    1. I had to set my DB connection protocol to TCP/IP
    (this was not the default), this was done by running
    the
    file "svrnetcn.exe" and then in the SQL Server Network
    Utility window, enable TCP/IP and set the port to
    1433.Irrelevant to the classpath problem.
    2. I then copied all three of the Microsoft JDBC
    driver files to the ..\jre\lib\ext dir of my jdk
    installed dir.The classpath always includes all jar files in this directory. That's why doing that fixed your problem. My bet is that you didn't have the jar file containing the driver in your classpath before, you just had the directory containing that jar file.
    3. Updated my OS path to located these files
    and....BINGO! (that simple)Unnecessary for solving classpath problems.
    4. Took a crash course on JDBC & basic Java and now I
    have created my database, all tables, scripts,
    stored procedures and can read/write and do all kinds
    of neat stuff.All's well that ends well. After a few months you'll wonder what all the fuss was about.

  • How do I stop "Exception in thread "main" java.lang.OutOfMemoryError.java heap space

    I'm trying to rebuild my iPhone app, with hires graphics etc, using CS6 Flash Pro. However, I get this now,
    Exception in thread "main" java.lang.OutOfMemoryError.java heap space .....  followed by a lot of location information related to the error.
    Now, how do I increase the java memory allowances if that's the problem. I've already upp the jvm.ini file from 128 to 512. No difference.
    I'm based on
    Win8, 8GB RAM, x64
    I'm obviously asking it to load a lot of resources - but hey, Flahs should be able to handle it right?
    thanks if anyone can help

    Hmmm. Maybe I was doing something wrong with images, and icons. I'm not sure, as it's not at all clear really.
    This is the Icons screen from CS6, can't see the files above 512x512unless scrolling up - 29x29,57x57,114x114.  no matter.
    So - after reading and rereading the Apple specs and directions, I removed the 512x512 and the 1024x1024 images from the Icons list that get pulled in during build.
    Next, I again re-read the Apple directives, and put the required files for the build into the base directory of the build, as per this image.
    In actual fact - I can probably leave out the last two. iTunesArtwork.xxx But I don't know, because it is entirely unclear on that point. I can find no directive regarding this at all.
    Do I upload them myself? Probably? I don't know.
    HOWEVER.
    The build now completes. Java, or something, was very confused about finding that file called 1024x1024.png in the build list, and would not do it.
    Take it out of icons, built fine. Put it in the icons directory, and crash...
    Now - with the setup I am using, it all builds fine for ipad and iphone, in all resolutions.
    I don't know what the problem is with what Java is seeing, but this fixes it it seems.
    Hope that helps anyone else.
    cheers

  • 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");

  • Error exception in thread 'main' java.lang.No ClassDefFound Error

    Hi..
    i hope maybe some of u can help me to settle this problem...my problem is when i run this program..this error will appear at command prompt....Exception in thread 'main' java.lang.No ClassDefFound Error.
    How to solve this problem?I need someone to help me..this is my coding..
    import java.io.*;
    class Wang{
    public int ringgit, sen;
    public Wang (int nilaiRinggit, int nilaiSen){
    ringgit=nilaiRinggit;
    sen=nilaiSen;
    System.out.println("Jumlah sen:"+jumlahSen());
    public int jumlahSen ( ) {
    return 100*ringgit + sen;
    class Aplikasi{
    public static void main (String [ ] args) throws IOException {
    Wang wang = new Wang (5, 20);
    System.out.println ("Jumlah wang:RM"+wang.ringgit+"."+wang.sen);
    System.out.println("Sen :"+wang.jumlahSen( ) );
    thank you...

    tq for reply my msg..
    i dont know how to do....can u help me?....teach me
    step by step......to set the classpath...for ur
    info.i'm using win xp...i want to ask u about
    compilation and run....to compile i using javac
    <filename>.java..and to run ... which one true..using
    java <filename>.java or java<filename>?For the javac command, FILEname.java is used. For java command CLASSname is used. Do not use .class or .java. Do use the fully qualified CLASS name. Fully qualified means package name plus the Class name. If you do not specify a package name, then the fully qualified name is just the Class name. Also, all names are case sensitive. MyClass is not equal to myclass.
    Lets say you compile HelloWorld.java so you have a HelloWorld.class file in the directory, C:\myjava. Then, use the commandjava -classpath c:\myjava HelloWorld
    ang how to settle the error exception in thread 'main'
    java.lang.Nosuch method error..You should ALWAYS post the full, exact error message. It is difficult to answer this question without knowing the full error. Which method did Java complain about? Often, this occurs when you try to launch a class as an application but the class does not have a method whose signature is "public static void main(String[] args) "
    You might want to try the tutorial here: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html

  • 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

  • Exception in thread "main" java.lang.NoSuchMethodError: main -- Help

    I am new to Java programming and I have been working out of a book trying to learn the language. I am working on a Ubuntu system using Eclipse. I get an error when I try to run this app. It is: Exception in thread "main" java.lang.NoSuchMethodError: main. I have Googled it and read different possible solutions, but none have helped. Can someone help me solve this?
    Here is the code for battleshipGameTestDrive.java:_
    import java.util.ArrayList;
    public class battleshipGameTestDrive
         public static void main(String[] args, ArrayList<String> locations)      
              int numOfGuesses = 0;
              boolean isAlive = true;
              GameHelper helper = new GameHelper();
              battleshipGame ship = new battleshipGame();
              for (int ctr = 1; ctr < 4; ctr++)
                   int randomNum = (int) (Math.random() * 5);          
                   locations.add(Integer.toString(randomNum));
                   ship.setLocationCells(locations);
              while (isAlive == true){
                   String userGuess = helper.getUserInput("Enter a number (1-7): ");
                   numOfGuesses++;
                   String result = ship.checkYourself(userGuess);
                   if (result.equals("kill")){
                        isAlive = false;
                        System.out.println("You took " + numOfGuesses + " guesses");
                   } // close result if
              }  //end while loop
         }// end of main
    }// end of battleshipGameTestDrive class
    Here is the code for the battleshipGame class.java:_
    import java.util.ArrayList;
    public class battleshipGame {
         private ArrayList<String> locationCells;
         public void setLocationCells(ArrayList<String> loc){
              locationCells = loc;
         public String checkYourself(String userInput){
              String result = "miss";          
              int index = locationCells.indexOf(userInput);
              if (index >= 0){
                   locationCells.remove(index);
                   if (locationCells.isEmpty()){
                        result = "kill";
                   }else{
                        result = "hit";
                   }// close if
              }// closer outer if
              return result;
         }     //close method
    }     //close class

    Hello,
    I saw your short message youe sent to someone who had a problem : Exception in thread "main" java.lang.NoSuchMethodError :main
    So I was thinking maybe you could help me I struggle with this code fro 3weeks, this is a code I save it later as
    import java.awt.*;
    import java.awt.event.*;
    class Party {
    public void makeInvitation(){
    Frame f = new Frame();
    Label l = new Label("Party at Tom's");
    Button b = new Button("Sure");
    Button c = new Button("Noo...");
    Panel p = new Panel();
    p.add(l);
    I write this code in Notepad++ than I save it as java file with looks like this : Java source file (*.java)
    - than in Command Prompt I write : javac Party.java as usual and it comes with this error below Exception in thread "main" .......
    I have no idea what's wrong with it.Can you help me
    Thank you in advance

  • Error: Exception in thread "main" java.lang.StringIndexOutOfBounds

    I have to write a program that calculates a monthly mortgage payment from a 10,000 loan, decreases the principle, and displays all of the info (principle payment, interest payment, loan balance) for each month. Since all of that info would scroll off the screen, I have to break it down where it will show a few months, prompt user for input to scroll down, and then show the rest of the info. I keep getting this error:
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String Index Out Of Range: 0
    at java.lang.String.charAt (Unknown Source)
    at Payment2.main (Payment2.java: 20)
    Here is my code:
    import java.text.*;
    import java.lang.*;
    class Payment2 {
         public static void main(String[] arguments) {
              double LoanAmount = 10000;
              int Term = 3;
              double AnnualInterest = .0575;
              double InterestRate = AnnualInterest/12;
              double MonthlyPayment = (LoanAmount*InterestRate)/(1-(Math.pow(1/(1+InterestRate),(Term*12))));
              String UserInput = "";
              double LoanBalance;
         System.out.println("The amount of the loan is $10,000.");
         System.out.println("The annual interest rate is 5.75%.");
         System.out.println("The term of the loan is 3 years.");
         System.out.println("The average monthly payment is $302.");
         System.out.println("Please press Enter to continue, or Q to quit.");
         if((UserInput.toUpperCase().charAt(0)) != 'Q')
         LoanBalance = LoanAmount;
         int DisplayMonth = 1;
         int DisplayLoop = 0;
         while (DisplayMonth <= (Term*12))
         double InterestPayment = LoanBalance*InterestRate;
         double PrinciplePayment = MonthlyPayment-InterestPayment;
         LoanBalance = (LoanBalance-PrinciplePayment);
         NumberFormat nfo;
         nfo = NumberFormat.getCurrencyInstance();
         String MyFormattedInterest = nfo.format(InterestPayment);
         String MyFormattedPrinciple = nfo.format(PrinciplePayment);
         String MyFormattedBalance = nfo.format(LoanBalance);
         System.out.println("For Month " + DisplayMonth + ":");
         System.out.println("The Monthly Payment is " + MonthlyPayment);
         System.out.println("Interest paid is " + MyFormattedInterest);
         System.out.println("Principle applied is " + MyFormattedPrinciple);
         System.out.println("The new loan balance is " + MyFormattedBalance);
         DisplayMonth++;
         DisplayLoop++;
         if (DisplayLoop == 6)
              System.out.println("Press Enter to scroll down...");
    public static String readLine()
    int ch;
    String r = "";
    boolean StringDone = false;
    while (!StringDone)
    try
    ch = System.in.read();
    if (ch < 0 || (char)ch == '\n') StringDone = true;
    else r = r + (char) ch;
    } // end try
    catch(java.io.IOException e)
    StringDone = true;
    } //end catch
    }// end while
    return r;
    } // end Readline
    PLEASE HELP!!! I would greatly appreciate any tips that anyone can give. Thx
    Ryane

    OK, so I fixed that part, it will run now. But, can't figure out how to keep the screen from scrolling down all the way to the bottom of the list. I need it to stop after 3 months, each time, asking the user to press Enter to scroll down (or any input that will work for this). Any hints on that? Also, when I run the program, I have to press Enter to get it to actually start displaying info. Otherwise, I run it and it just sits there. But when I press Enter, it scrolls and prints all information for the entire loan, 36 months. Here's my updated code. Thx
    class Payment2 {
         public static void main(String[] arguments) {
              double LoanAmount = 10000;
              int Term = 3;
              double AnnualInterest = .0575;
              double InterestRate = AnnualInterest/12;
              double MonthlyPayment = (LoanAmount*InterestRate)/(1-(Math.pow(1/(1+InterestRate),(Term*12))));
              String UserInput = readLine();
              double LoanBalance;
         System.out.println("The amount of the loan is $10,000.");
         System.out.println("The annual interest rate is 5.75%.");
         System.out.println("The term of the loan is 3 years.");
         System.out.println("The average monthly payment is $303.09.");
         if((UserInput.toUpperCase().charAt(0)) != 'Q')
         LoanBalance = LoanAmount;
         int DisplayMonth = 1;
         int DisplayLoop = 0;
         while (DisplayMonth <= (Term*12))
         double InterestPayment = LoanBalance*InterestRate;
         double PrinciplePayment = MonthlyPayment-InterestPayment;
         LoanBalance = (LoanBalance-PrinciplePayment);
         NumberFormat nfo;
         nfo = NumberFormat.getCurrencyInstance();
         String MyFormattedPayment = nfo.format(MonthlyPayment);
         String MyFormattedInterest = nfo.format(InterestPayment);
         String MyFormattedPrinciple = nfo.format(PrinciplePayment);
         String MyFormattedBalance = nfo.format(LoanBalance);
         System.out.println("For Month " + DisplayMonth + ":");
         System.out.println("The Monthly Payment is " + MyFormattedPayment);
         System.out.println("Interest paid is " + MyFormattedInterest);
         System.out.println("Principle applied is " + MyFormattedPrinciple);
         System.out.println("The new loan balance is " + MyFormattedBalance);
         DisplayMonth++;
         DisplayLoop++;
         if (DisplayLoop == 3)
              System.out.println("Press Enter to scroll down...");
    public static String readLine()
    int ch;
    String r = "";
    boolean StringDone = false;
    while (!StringDone)
    try
    ch = System.in.read();
    if (ch < 0 || (char)ch == '\n') StringDone = true;
    else r = r + (char) ch;
    } // end try
    catch(java.io.IOException e)
    StringDone = true;
    } //end catch
    }// end while
    return r;
    } // end Readline
    }

  • 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

  • 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

    Am using java 1.3.1 on Red Hat Linux 7.1
    i get this error
    Exception in thread "main" java.lang.NoClassDefFoundError
    while running a simple program HelloWorld.java
    help

    When you use the "java" command, the only required argument is the name of the class that you want to execute. This argument must be a class name, not a file name, and class names are case sensitive. For example, "java HelloWorld.java" won't work because the class name isn't HelloWorld.java, it's HelloWorld. Similarly, "java helloworld" won't work because a class defined as "public class HelloWorld {" is not named helloworld due to case sensitivity. Finally, the .class file must be in a directory that is in the Classpath - that's where java.exe searches to find the file that contains the class.

  • Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/S

    Hi,
    I have created a class JaxmClient.java. When I compile the class with appropriate jar files assigned to -classpath it compiles successfully with no errors. But when I run the classe "java JaxmClient" it produces the following exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SOAPElement
    Can someone help me I am knew to this technology.
    Thanks in advance

    I tried to use in my execution all the jar files that I used for compilation.
    java -cp jaxm-jar; etc.jar Request
    but it still gives me this execption
    Exception in thread "main" java.lang.NoClassDefFoundError: Request
    I am in the right directory where is the Request.class file is and it is present in this directory....
    Thanks appreciate your help...

  • Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/lib

    I am trying to add jdbc to my project and find that jdbc components seem to be missing
    compiles and runs fine in IDE
    but when I try to run outside IDE I get this error
    Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/lib/sql/
    DataNavigator

    here is my log file
    Log Session: Sunday, May 22, 2005 10:17:39 PM EDT
    System Info: Product Version = Sun(tm) Java(tm) Studio Enterprise 7 2004Q4 (Build 041123)
    IDE Versioning = IDE/1 spec=4.26.1 impl=041123
    Operating System = Windows XP version 5.1 running on x86
    Java; VM; Vendor = 1.4.2_05; Java HotSpot(TM) Client VM 1.4.2_05-b04; Sun Microsystems Inc.
    Java Home = C:\j2sdk1.4.2_05\jre
    System Locale; Encod. = en_US (f4j_ee); Cp1252
    Home Dir; Current Dir = C:\Documents and Settings\dale; C:\Sun\jstudio_04Q4\Ent_04Q4\bin
    IDE Install; User Dir = C:\Sun\jstudio_04Q4\Ent_04Q4; C:\Documents and Settings\dale\.jstudio\Ent04Q4
    CLASSPATH = C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\boot.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\Describe.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\DescribeIDE.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\jaxen.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\logger.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\msv.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\parser.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\saxpath.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\Tidy.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\tsgdtj55.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\tsgetj55.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\tsglt55.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\tsgltc55.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\tsgltjava55.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\ext\tsgmtj55.jar;C:\j2sdk1.4.2_05\lib\dt.jar;C:\j2sdk1.4.2_05\lib\tools.jar;C:\Sun\jstudio_04Q4\AppServer7\pointbase\client_tools\lib\pbclient42RE.jar
    Boot & ext classpath = C:\j2sdk1.4.2_05\jre\lib\rt.jar;C:\j2sdk1.4.2_05\jre\lib\i18n.jar;C:\j2sdk1.4.2_05\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_05\jre\lib\jsse.jar;C:\j2sdk1.4.2_05\jre\lib\jce.jar;C:\j2sdk1.4.2_05\jre\lib\charsets.jar;C:\j2sdk1.4.2_05\jre\classes;C:\j2sdk1.4.2_05\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_05\jre\lib\ext\jai_codec.jar;C:\j2sdk1.4.2_05\jre\lib\ext\jai_core.jar;C:\j2sdk1.4.2_05\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_05\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_05\jre\lib\ext\mlibwrapper_jai.jar;C:\j2sdk1.4.2_05\jre\lib\ext\sunjce_provider.jar
    Dynamic classpath = C:\Sun\jstudio_04Q4\Ent_04Q4\lib\patches\TopLogging.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\core.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\openfile-cli.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\openide-loaders.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\openide.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\locale\core_f4j.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\locale\core_f4j_ee.jar;C:\Sun\jstudio_04Q4\Ent_04Q4\lib\locale\openide_f4j.jar
    Patched TopLogging from crash-reporter.nbm
    [org.netbeans.core.modules #4] Warning - had to upgrade dependencies for module com.sun.xml.registry1_0_01: added = [module org.netbeans.libs.xerces/1 > 1.2] removed = [package org.apache.xerces.parsers[SAXParser], package org.apache.xml.serialize[XMLSerializer]]; details: [Xerces is now available only as an autoload module, not in classpath: http://libs.netbeans.org/#xerces]
    [org.netbeans.core.modules #4] Warning: the extension C:\Sun\jstudio_04Q4\Ent_04Q4\modules\autoload\ext\namespace1_3.jar may be multiply loaded by modules: [C:\Sun\jstudio_04Q4\Ent_04Q4\modules\autoload\jaxr-module-1-3.jar, C:\Sun\jstudio_04Q4\Ent_04Q4\modules\autoload\jax-qname-module.jar]; see: http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/classpath.html#class-path
    Module patch or custom extension: C:\Sun\jstudio_04Q4\Ent_04Q4\modules\patches\org-netbeans-modules-editor\codetemplatesPatches.jar
    [org.netbeans.core.modules #4] Warning - had to upgrade dependencies for module org.netbeans.modules.jarpackager: added = [module org.netbeans.libs.regexp > 1.2] removed = [package org.apache.regexp > 1.2]; details: [Regexp is now available only as an autoload module, not on classpath: http://libs.netbeans.org/#regexp]
    [org.netbeans.core.modules #4] Warning - had to upgrade dependencies for module org.netbeans.modules.refactoring: added = [module org.openide.debugger > 1.0, token org.openide.compiler.CompilationEngine, module org.openide.compiler > 1.0, token org.openide.TopManager, module org.openide.execution > 1.0, token org.openide.windows.IOProvider, module org.openide.deprecated > 1.0, token org.openide.execution.ExecutionEngine] removed = []; details: [API separation phase I (#19443): http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-I, API separation phase II (#19443): http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-II, Debugger API separation (#29914): http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-III]
    [org.netbeans.core.modules #4] Warning - had to upgrade dependencies for module org.netbeans.modules.web.tomcat.tomcat40: added = [module org.netbeans.libs.xerces/1 > 1.2] removed = [package [org.apache.xml.serialize.EncodingInfo]]; details: [Xerces is now available only as an autoload module, not in classpath: http://libs.netbeans.org/#xerces]
    [org.netbeans.core.modules #4] Warning - had to add recursive class loader dependencies for module org.netbeans.modules.refactoring on [org.netbeans.modules.classfile]; see http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-indirect-dep-cp
    [org.netbeans.core.modules #4] Warning - had to add recursive class loader dependencies for module com.sun.forte4j.j2ee.debugger on [org.openidex.util, org.netbeans.modules.web.core, org.netbeans.modules.schema2beans, org.netbeans.api.xml, org.netbeans.modules.jarpackager, javax.activation, org.netbeans.modules.vcscore, org.netbeans.libs.jaxp, org.netbeans.libs.xerces, org.netbeans.modules.projects, org.netbeans.modules.logger, org.netbeans.modules.html, com.sun.forte4j.j2ee.lib, org.netbeans.modules.clazz, javax.mail, org.netbeans.modules.image, com.sun.forte4j.modules.depclass, org.netbeans.libs.regexp]; see http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-indirect-dep-cp
    [org.netbeans.core.modules #6] Warning: the module org.netbeans.modules.jarpackager uses org.netbeans.libs.regexp which is deprecated: JDK 1.4 includes regular expression support which should be used instead: http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.6-jre-regexp
    [org.netbeans.core.modules #6] Warning: the module org.netbeans.modules.projects uses org.openide.deprecated which is deprecated: Clients of obsoleted Open APIs are encouraged to remove this dependency. See http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-I
    [org.netbeans.core.modules #6] Warning: the module org.netbeans.modules.refactoring uses org.openide.deprecated which is deprecated: Clients of obsoleted Open APIs are encouraged to remove this dependency. See http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-I
    [org.netbeans.core.modules #6] Warning: the module com.embarcadero.netbeans uses org.openide.deprecated which is deprecated: Clients of obsoleted Open APIs are encouraged to remove this dependency. See http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-I
    [org.netbeans.core.modules #6] Warning: the module com.sun.forte4j.j2ee.debugger uses org.openide.deprecated which is deprecated: Clients of obsoleted Open APIs are encouraged to remove this dependency. See http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-I
    Type Groups Level Module Name
    err * 255 * (Default)
    Type Groups Level Module Name
    err * 255 * (Default)
    cfg 9 255 com.sun.forte4j.webdesigner
    Last execution suffered an abnormal exit at Sunday, May 22, 2005 10:15:18 PM EDT
    Log file not specified
    Turning on modules:
         org.openide/1 [4.26.1 041123]
         org.openide.loaders [4.11.1 041123]
         org.netbeans.core/1 [1.21.1 041123]
         org.openide.io [1.1.1 041123]
         org.netbeans.lib.terminalemulator [1.1.1 041123]
         org.netbeans.core.output/1 [1.1.1 041123]
         com.sun.tools.ide.collab/1 [7.0.0 041123]
         com.sun.im [7.0.0 041123]
         org.openide.src [1.1.1 041123]
         org.openide.execution [1.1.1 041123]
         org.openide.compiler [1.2.1 041123]
         org.netbeans.core.compiler/1 [1.4.1 041123]
         org.openide.debugger [1.1.1 041123]
         org.netbeans.modules.editor/1 [1.14.1 041123]
         org.netbeans.libs.xalan/1 [1.4.1 2.5.2]
         org.netbeans.libs.jaxp/1 [1.2.1 1.1.2]
         org.netbeans.api.xml/1 [1.3.1.3.6.0 3.6.0 041123]
         org.netbeans.modules.xml.core/2 [1.1.1.3.6.0 3.6.0 041123]
         org.netbeans.modules.xml.text/2 [1.1.1.3.6.0 3.6.0 041123]
         org.netbeans.modules.classfile/1 [1.8 041123]
         org.netbeans.core.execution/1 [1.3.1 041123]
         org.netbeans.modules.clazz/1 [1.13.1 041123]
         org.netbeans.modules.javahelp/1 [2.1.1 041123]
         org.netbeans.modules.db/1 [1.8.2 041123]
         com.sun.forte4j.modules.dbmodel.jdbcimpl/1 [7.0.0 041123]
         org.openide.deprecated [1.3.1 041123]
         org.netbeans.core.deprecated [1.3.1 041123]
         org.netbeans.modules.debugger.core/3 [2.10.1 041123]
         org.netbeans.modules.debugger.jpda/1 [1.17.1 041123]
         org.netbeans.modules.j2eeserver/2 [1.7.3 041123]
         org.apache.xalan [2.2.2 Xalan 2.2.0 release]
         org.netbeans.modules.image/1 [1.11.1 041123]
         javax.activation/1 [1.0.2 1.0.2]
         javax.mail/1 [1.1.4 1.1.4]
         org.netbeans.modules.logger/1 [1.5 041123]
         com.sun.forte4j.modules.depclass/1 [2.4 041123]
         org.openidex.util/2 [2.7.1 041123]
         org.netbeans.modules.vcscore/1 [1.9.1 041123]
         org.netbeans.libs.regexp [1.2.1 1.2]
         org.netbeans.modules.jarpackager/2 [1.13.3 041123]
         org.netbeans.modules.schema2beans/1 [1.4.3 041123]
         org.netbeans.api.java/1 [1.3.1 041123]
         org.netbeans.libs.xerces/1 [1.4.1 2.6.0]
         org.netbeans.modules.java/1 [1.16.1 041123]
         com.sun.ffj.modules.licensemgr/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.lib/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.ejb/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.ejbmodule/1 [7.0.0 041123]
         org.netbeans.modules.projects/1 [1.14.1 041123]
         org.netbeans.modules.html/1 [1.12.1 041123]
         org.netbeans.modules.web.core/1 [1.16.3 041123]
         com.sun.forte4j.j2ee.appasm/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.appclient/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.j2eeconn/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.importear/1 [7.0.0 041123]
         org.netbeans.modules.diff/1 [1.7.1 041123]
         org.netbeans.modules.vcs.advanced/1 [1.9.1 041123]
         org.netbeans.modules.vcs.profiles.clearcase/1 [1.2 041123]
         org.netbeans.modules.xml.catalog/2 [1.1.1.3.6.0 3.6.0 041123]
         org.netbeans.modules.properties/1 [1.11.1 041123]
         org.netbeans.modules.i18n/1 [1.14.1 041123]
         org.netbeans.modules.javadoc/1 [1.11.1 041123]
         javax.xml.namespace/1 [1.0 1.0]
         com.sun.xml.messaging1_3/1 [1.0 1.0]
         com.sun.xml.registry1_3/1 [1.0 1.0]
         com.sun.tools.jaxrpc_cmn/1 [1.1 1.1]
         com.sun.xml.rpc1_3/1 [1.0 1.0]
         com.sun.forte4j.j2ee.wsdl/1 [7.0.0 041123]
         org.netbeans.modules.servletapi23/1 [1.3.2 041123]
         org.netbeans.modules.web.jspparser/1 [1.5.2 041123]
         org.netbeans.modules.web.tomcat.tomcat40/1 [1.8.3 041123]
         com.sun.forte4j.genericgenerator4/1 [1.1.1 020327]
         org.netbeans.modules.web.ie/1 [1.15.3 041123]
         com.sun.forte4j.webdesigner.xmlservice/1 [7.0.0 041123]
         com.sun.tools.ide.j2eeant/1 [7.0.0 041123]
         org.netbeans.modules.xml.schema/1 [1.1.1.3.6.0 3.6.0 041123]
         org.netbeans.modules.filecopy/1 [1.11 041123]
         org.netbeans.modules.group/1 [1.0.1 041123]
         org.netbeans.modules.settings/1 [1.4.1 041123]
         org.netbeans.tasklistapi/1 [1.7.1.2 2 041123]
         org.netbeans.modules.tasklist.core/2 [1.22.1.26 6 041123]
         org.netbeans.modules.suggestions_framework/2 [1.2.1.265 5 041123]
         org.netbeans.modules.tasklist.docscan/2 [1.13.1.2653 3 041123]
         com.sun.forte4j.codetemplates/1 [7.0.0 @BUILD_NUMBER_SUBST@]
         com.sun.tools.vcsscc/1 [7.0.0 041123]
         com.sun.tools.vcsscc.profiles.vss/1 [7.0.0 041123]
         com.sun.forte4j.modules.pointbase/1 [7.0.0 041123]
         org.netbeans.core.windows/2 [2.0.1 041123]
         org.netbeans.core.ui/1 [1.3.1 041123]
         org.netbeans.modules.utilities/1 [1.15.1 041123]
         org.netbeans.modules.autoupdate/1 [2.8.1 041123]
         org.netbeans.modules.welcome/1 [1.5.1 041123]
         org.apache.soap [2.2.1 SOAP 2.2 release]
         org.netbeans.lib.cvsclient/1 [1.8.1 041123]
         org.netbeans.modules.vcs.profiles.cvsprofiles/1 [1.3.1 041123]
         org.netbeans.modules.applet/1 [1.14.1 041123]
         org.netbeans.modules.web.debug/1 [1.8.2 041123]
         org.netbeans.modules.web.core.syntax/1 [1.12.3 041123]
         com.sun.jato.tools.sunone.ee/1 [2.1.4 20041123.213634]
         org.netbeans.modules.usersguide/1 [1.13.1 041123]
         com.sun.forte4j.ee_examples/1 [7.0.0 041123]
         org.netbeans.modules.css/2 [1.1.1.3.6.0 3.6.0 041123]
         com.sun.tools.j2mews/1 [7.0.0 041123]
         org.ksoap/1 [1.0.1 kSOAP release 1.0]
         org.netbeans.modules.vcs.cmdline.compat/1 [1.3.1 041123]
         org.netbeans.modules.form/2 [1.13.1 041123]
         com.sun.tools.ide.collab.channel.mdc/1 [7.0.0 041123]
         org.netbeans.modules.servletapi/1 [1.3.1 041123]
         org.netbeans.modules.web.taglibed/1 [1.11.3 041123]
         com.sun.tools.dbdrivers/1 [7.0.0 041123]
         org.netbeans.modules.refactoring/1 [7.0.0 041123]
         org.netbeans.modules.web.assemblee/1 [1.2.1 041123]
         com.sun.tools.ide.portal.portlet/1 [1.0 041123]
         com.sun.tools.crashreporter [7.0.0 041123]
         org.netbeans.modules.text/1 [1.12.1 041123]
         com.embarcadero.netbeans/2 [1.0 041123]
         com.sun.tools.modules.cvsdisabler/1 [7.0.0 041123]
         com.sun.tools.vcsscc.profiles.pvcs/1 [7.0.0 041123]
         com.sun.tools.ide.collab.channel.chat/1 [7.0.0 041123]
         org.netbeans.modules.i18n.form/2 [1.12 041123]
         org.netbeans.modules.properties.syntax/1 [1.11 041123]
         org.netbeans.modules.cvsclient/1 [2.0.1 041123]
         com.sun.tools.ide.collab.channel.filesharing/1 [7.0.0 041123]
         com.sun.forte4j.j2ee.ejbtest/1 [7.0.0 041123]
         org.netbeans.modules.httpserver/1 [1.13.1 041123]
         org.netbeans.modules.jdbc/1 [7.0.0 041123]
         com.sun.jdo.modules.persistence.mapping.core/1 [7.0.0 041123]
         com.sun.jdo.modules.persistence.mapping.ejb/1 [7.0.0 041123]
         org.netbeans.modules.web.tomcat.tomcat40.autocompile/1 [7.0.0 041123]
         org.netbeans.modules.junit/2 [2.11.1 041123]
         com.sun.ffj.modules.registration/1 [7.0.0 041123]
         org.netbeans.modules.xsl/1 [1.1.1.3.6.0 3.6.0 041123]
         com.sun.forte4j.webdesigner.jwsdp/1 [7.0.0 041123]
         org.netbeans.modules.extbrowser/1 [1.3.1 041123]
         com.sun.forte4j.j2ee.debugger/1 [7.0.0 041123]
         com.sun.xml.messaging1_0_01/1 [1.0 1.0]
         com.sun.xml.rpc1_0_01/1 [1.0 1.0]
         org.netbeans.modules.web.monitor/1 [1.8.3 041123]
         org.netbeans.core.ide/1 [1.3.1 041123]
         org.apache.tools.ant.module/3 [3.6.1 041123]
         javax.portlet/1 [1.0 041123]
         org.netbeans.modules.autoupdateffj/1 [7.0.0 041123 ]
         com.sun.tools.profiler.monitor [7.2.4 041123]
         org.netbeans.modules.beans/1 [1.11.1 041123]
         com.sun.enterprise.webserver.tools/1 [7.0.0 PLUGINVERSION]
         com.sun.portal.devtool/1 [1.0 041123]
         com.sun.tools.ide.collab.ui/1 [7.0.0 041123]
         org.netbeans.modules.xml.tax/2 [1.1.1.3.6.0 3.6.0 041123]
         org.netbeans.modules.xml.tools/2 [1.1.1.3.6.0 3.6.0 041123]
         com.sun.appserv.tools.forte/1 [7.0.0 041123]
         org.netbeans.modules.web.dd.editors/1 [1.1.2 041123]
    QuantumAutoupdateModule 1116814706515 starting check
    Warning - org.netbeans.modules.projects.SetMainClassCookieAction should override CallableSystemAction.asynchronous() to return false
    Warning - org.netbeans.modules.debugger.delegator.DefaultDebuggerType should have overridden startDebugger(DataObject,boolean); falling back on deprecated ExecInfo usage; see: http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.5i-sep-II-ExecInfo

  • "Exception in thread "main" java.lang.NoClassDefFound: classname" error.

    Here's my code:
    public class Hello
    public static void main( String[] args )
    System.out.println( "Hello!" );
    it compiles but it wont run. it encounters this error: " Exception in thread "main" java.lang.NoClassDefFoundError: Hello"
    Since I am using jdk1.3, my path is "c:\windows;c:\windows\command;c:\progra~1\dell\resolu~1\common\bin;c:\jdk1.3\bin"
    another error I noticed in my computer were these while running Calculator.java:
    Calculator.java:11: cannot resolve symbol
    symbol: class Calc
    location: class Calculator
    Calc calculator;
    Calculator.java:36: cannot resolve symbol
    symbol: class Calc
    location: class Calculator
    calculator = new Calc();
    2 errors
    Yet my Calculator.java, Calculator.class, Calc.java, Calc.class, Calculator.html files are all in one folder.
    Since I am using jdk1.3, my path is "path=c:\windows;c:\windows\command;c:\progra~dell\resolu~1\common\bin;c:\jdk1.3\bin;"
    I would greatly appreciate your help.
    Thank you very much!=)

    hi!
    set the classpath to the relative path "."!
    in the command box type this:
    SET CLASSPATH=.;
    then it should work!
    visit: >> http://www.menzsoft.ch <<
    greets

  • "Exception in thread "main" java.lang.NumberFormatException"error..pls help

    Hi,
    I'm trying to run a program I've written but keeping getting this error:
    Exception in thread "main" java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
    at java.lang.Double.parseDouble(Double.java:482)
    at data.newLineToRead(data.java:21)
    at data.data(data.java:34)
    at train.main(train.java:86)
    I'm not quite sure where I'm going wrong.I've included the data class and train class.Could someone pls help me.
    Thanks a lot.
    Data Class:
    import java.io.*;
    import java.util.*;
    public class data{
            private static parameter par;
            private static double[][] x=new double[par.n()][par.D()];
            public static double[] t=new double[par.n()];
            public static void newLineToRead(String LineToRead,int n){
            int d=0;
            String stringToRead=new String();
                    for(int i=0;i<=LineToRead.length();i++){
                            StringTokenizer str = new StringTokenizer (stringToRead,"/t");
                            String[] strtemp = new String[str.countTokens()];
                                    while (str.hasMoreTokens()){
                                    x[n][d++] = Double.parseDouble(str.nextToken());
                                    d++;
                                    System.out.println(x[n][d++]);
                            stringToRead=new String();
                    t[n]=Double.parseDouble(stringToRead);
                    x[n][par.d()]=1.0;
            public static void data() throws IOException{
            DataInputStream in=null;
                    try{
                            in=new DataInputStream(new FileInputStream(par.f()));
                            for(int n=0;n<par.n();n++){
                            String LineToRead=in.readLine();
                                    if(LineToRead.length()==0){
                                            System.out.println("Remove empty lines");
                                    else{
                                            newLineToRead(LineToRead,n);
                    }finally{if(in!=null){in.close();}}
            public static double x(int n,int d){return x[n][d];}
            public static double t(int n){return t[n];}
    }Train Class
    import java.io.*;
    import java.util.*;
    public class train{
             private static parameter       par;
             private static data            dat;
             private static model           mod;
             private static response        resp;
             private static void error(String msg){
                    System.out.println(msg);
                    System.exit(1);
             private static void check(){
                if(par.f().length()==0)
                    error("No filename of input vectors!");
                if(par.n()==0)
                    error("No number of input vectors!");
                if(par.d()==0)
                    error("No number of input variables!");
                if(par.d()>par.D())
                    error("Dimension is larger than 100!");
              private static void usage(){
                System.out.println("Non-default parameters==========================");
                System.out.println("-f filename of input vectors");
                System.out.println("-n number of input vectors");
                System.out.println("-d number of input variables");
                System.out.println("Default parameters==========================");
                System.out.println("-R regularisation constant (must be positive and the default value is 0.0)");
                System.out.println("-S epsilon criterion for stopping a learning process (default value is 0.001)");
                System.out.println("-C maximum learning cycle (default value is 10000)");
                      public static void main(String[] argv){
                            if(argv.length==0){
                                    System.out.println("Command line is <Java [-cp path] train parameters>");
                                    usage();
                                    System.exit(1);
                            if(argv.length==1 && argv[0].equals("help")==true){
                                    usage();
                                    System.exit(1);
                            par.nin(0); par.din(0); par.Rin(0.0); par.Cin(10000); par.Sin(0.001);
    for(int i=0;i<argv.length;i++){
                                            if(argv.equals("-f")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.fin(argv[i+1]);
    i++;
    else if(argv[i].equals("-d")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.din(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-n")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.nin(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-S")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.Sin(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-C")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.Cin(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-R")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.Rin(Double.parseDouble(argv[i+1]));
    i++;
    else error("Unkown token");
    check();
    try {
    dat.data();
    }catch(IOException e) { System.err.println(e.toString()); }
    try {
    mod.model();
    }catch(IOException e) { System.err.println(e.toString()); }
    try {
    resp.record();
    }catch(IOException e){ System.err.println(e.toString()); }

    String stringToRead=new String();
                    for(int i=0;i<=LineToRead.length();i++){
                            StringTokenizer str = new StringTokenizer (stringToRead,"/t");
                            String[] strtemp = new String[str.countTokens()];
                                    while (str.hasMoreTokens()){
                                    x[n][d++] = Double.parseDouble(str.nextToken());
                                    d++;
                                    System.out.println(x[n][d++]);
                            stringToRead=new String();
                    t[n]=Double.parseDouble(stringToRead);
                    x[n][par.d()]=1.0;
            }Not sure exactly what you are trying to do above but...
    You are setting your String to an empty String with "new String()" and then parsing that empty String. Eventually, you are trying to parse a double from that empty String:
    t[n]=Double.parseDouble(stringToRead);Also, I cannot think of a reason to ever use "new String()" when you could just use:
    String myString = "";

Maybe you are looking for