newbie question with compiling

Discussion in 'Java' started by Libin Xie, Oct 24, 2003.

  1. Libin Xie

    Libin Xie Guest

    Hi
    I am new to Java world, I download java version j2sdk1.4.1_01 to my
    computer, and install it
    when I try to compile program from command line type javac tst.java, I got
    the following error
    "Exception in thread "main" java.lang.NoClassDefFoundError:
    com/sun/tools/javac/Main"

    however, I can use textPad to compile it, when I try to run from textPad, I
    got same error:


    Thanks advance
    Libin
     
    Libin Xie, Oct 24, 2003
    #1
    1. Advertising

  2. Libin Xie

    winbatch Guest

    Try
    java -classpath .; tst.java

    (Textpad probably includes the current directory when compiling).

    When running, add the classpath of . again.
    java -classpath .; tst

    (You can also add . to the CLASSPATH environment variable and not have to
    worry about this again...)
    "Libin Xie" <> wrote in message
    news:3f991d67$...
    > Hi
    > I am new to Java world, I download java version j2sdk1.4.1_01 to my
    > computer, and install it
    > when I try to compile program from command line type javac tst.java, I got
    > the following error
    > "Exception in thread "main" java.lang.NoClassDefFoundError:
    > com/sun/tools/javac/Main"
    >
    > however, I can use textPad to compile it, when I try to run from textPad,

    I
    > got same error:
    >
    >
    > Thanks advance
    > Libin
    >
    >
    >
     
    winbatch, Oct 24, 2003
    #2
    1. Advertising

  3. In article <3f991d67$>, Libin Xie wrote:
    > Hi
    > I am new to Java world, I download java version j2sdk1.4.1_01 to my
    > computer, and install it
    > when I try to compile program from command line type javac tst.java, I got
    > the following error
    > "Exception in thread "main" java.lang.NoClassDefFoundError:
    > com/sun/tools/javac/Main"
    >
    > however, I can use textPad to compile it, when I try to run from textPad, I
    > got same error:

    Something is screwd up in the installation(historically java hav had problems
    if you install several versions of it , install the jre, then the sdk etc..)
    Does java -version
    show the version you expect ?
    Does it help if you use the full path to javac ? e.g.
    c:/j2sdk_whatever/bin/javac tst.java
     
    Nils O. =?iso-8859-1?Q?Sel=E5sdal?=, Oct 24, 2003
    #3
  4. Libin Xie

    David Baer Guest

    for compiling use: javac -classpath . tst.java

    not java...

    david

    winbatch wrote:

    > Try
    > java -classpath .; tst.java
    >
    > (Textpad probably includes the current directory when compiling).
    >
    > When running, add the classpath of . again.
    > java -classpath .; tst
    >
    > (You can also add . to the CLASSPATH environment variable and not have to
    > worry about this again...)
    > "Libin Xie" <> wrote in message
    > news:3f991d67$...
    >> Hi
    >> I am new to Java world, I download java version j2sdk1.4.1_01 to my
    >> computer, and install it
    >> when I try to compile program from command line type javac tst.java, I
    >> got the following error
    >> "Exception in thread "main" java.lang.NoClassDefFoundError:
    >> com/sun/tools/javac/Main"
    >>
    >> however, I can use textPad to compile it, when I try to run from textPad,

    > I
    >> got same error:
    >>
    >>
    >> Thanks advance
    >> Libin
    >>
    >>
    >>
     
    David Baer, Oct 24, 2003
    #4
  5. Libin Xie

    Roedy Green Guest

    Roedy Green, Oct 24, 2003
    #5
  6. Libin Xie

    Libin Xie Guest

    Thanks for your response, Nils
    I got two version in my system, I thinks it's screw up
    command "java -version"
    F:\My Documents>java -version
    java version "1.4.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

    Is there anyway I can edit this default path??I can compile program in this way
    however, I still cant run this program, I got the same error message even I use full path for java

    Thanks
    Libin Xie


    "Nils O. SelÄsdal" <> wrote in message news:...
    > In article <3f991d67$>, Libin Xie wrote:
    > > Hi
    > > I am new to Java world, I download java version j2sdk1.4.1_01 to my
    > > computer, and install it
    > > when I try to compile program from command line type javac tst.java, I got
    > > the following error
    > > "Exception in thread "main" java.lang.NoClassDefFoundError:
    > > com/sun/tools/javac/Main"
    > >
    > > however, I can use textPad to compile it, when I try to run from textPad, I
    > > got same error:

    > Something is screwd up in the installation(historically java hav had problems
    > if you install several versions of it , install the jre, then the sdk etc..)
    > Does java -version
    > show the version you expect ?
    > Does it help if you use the full path to javac ? e.g.
    > c:/j2sdk_whatever/bin/javac tst.java
    >
     
    Libin Xie, Oct 26, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jk
    Replies:
    1
    Views:
    548
    Mike Treseler
    Jan 4, 2004
  2. Soundar
    Replies:
    1
    Views:
    452
    JavaJava
    Jan 27, 2005
  3. Garrett Cooper
    Replies:
    0
    Views:
    585
    Garrett Cooper
    Feb 24, 2009
  4. Garrett Cooper
    Replies:
    0
    Views:
    518
    Garrett Cooper
    Feb 24, 2009
  5. Lon Baker
    Replies:
    1
    Views:
    236
    Csaba Henk
    Mar 21, 2005
Loading...

Share This Page