CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Learning Java

  1. #1
    Join Date
    Mar 1999
    Posts
    1

    Learning Java



    I am trying to learn the language Java, but am having problems. I entered the following Java program:


    class Example1 {

    public static void main(String args[]) {

    System.out.println("This is the output from Example1"

    }

    }


    I saved the program as Example1.java, compiled it: javac Example1.java and the Example1.class file was produced, but

    when I entered:


    java Example1


    I got the following error message:


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


    I am using JDK1.2. My path statement points to its bin folder. Any help as to why I am getting this error message or

    what I am doing wrong would help. I am using the book Teach Yourself Java by Joesph O'Neil. The above example came

    directly out of his book.


    Thanks...

  2. #2
    Join Date
    Apr 1999
    Posts
    2

    Re: Learning Java



    I run the above code in my system. It works fine. My path also points to jdk1.2\bin. The exception you have mentioned happens when JRE is not able to find the Example1.class and has nothing to do with the PATH. Java is very case sensitive so be sure you take care of it. Your error could because of this. Also be sure you run java Example1 from the directory where Example1 is residing. Otherwise give the fullyqualfied file name.

  3. #3
    Join Date
    Mar 1999
    Posts
    7

    Re: Learning Java



    Hi!,


    I tested the program It is working fine. What I supect is though you have JDK1.2 in your mechine the java compiler your

    are using could be an obsolate on. In the older versions CLASSPATH variable has to be set as follows


    set cllasspath=.;c:\jdk1.1.6\lib;classes.zip;


    and I assume your path variable is as follows.


    path=c:\jdk1.1.6\bin;c:\jdk1.2\bin;


    In the above case the java compiler is from JDK 1.1.6 not from jdk1.2


    I don't know how far I am correct. But the problem could be with path some settings only.


    Satya



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured