Re: cant's compile with javac



In article <1133129500.547883.85290@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Ido.Yehieli@xxxxxxxxx took the hamburger, threw it on the grill, and I
said "Oh wow"...

> it just says:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> com/sun/tools/javac/Main
>
> when I dod that.
>
>

NoClassDefFoundError means that whatever you're looking to compile can't
be found by the compiler. You can compile something by being in the same
directory as where your source file is or you can use a path with javac
which tells it to look for your source file, then compile it.

(I think there's more ways than just that to compile but I'll leave that
to the hotshots of the group to expound on.)

Compile from the same directory as your source:

open a command prompt.

c:\stuff\morestuff> -- where you're at right now. I'm sure you know this
already.

K: -- navigate to the K: drive (I usually do this from the top directory
on the drive; for example, C:> but others may do that differently)
cd.. -- move up one folder
cd directoryName -- move to the directory (which would be directoryName)
dir -- show everything in the folder you're in
cd directoryName\anotherDirectory -- Move to the directoryName folder
then go anotherDirectory within that.

Once you're there, javac YourFile.java

javac using a path:

javac just\tell\thecompiler\where\it\can\find\your\file\YourFile.java

If the file's on another drive, I'll navigate to the drive and then
start my path. That's just what I do though. Others may have a
different/better way.

If Eclipse can find it, you can find it because it can't compile stuff
out of thin air. It has to find a source somewhere.


--
Noodles Jefferson
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

"Our earth is degenerate in these latter days, bribery and corruption
are common, children no longer obey their parents and the end of the
world is evidently approaching."
--Assyrian clay tablet 2800 B.C.
.



Relevant Pages

  • Re: .class file source dependency
    ... I change one .java source file. ... In others, the other class is still okay, but the bytecode generated for it will change - the old bytecode won't work, the source code will compile, and the new source code will work. ... public static void main(String... ...
    (comp.lang.java.programmer)
  • Re: Looking for a free basic compiler for DOS
    ... mother of an ide file - and created separate source files for each SUB ... big to compile in one bc step. ... the source for all the SUBS in the same source file. ...
    (comp.lang.basic.misc)
  • Re: disabling parse error in gcc
    ... typedef struct MYSTRUCT{ ... it will compile correctly. ... A header file shall permit multiple inclusion of itself. ... so that a source file containing only TWO #includes of it will compile, ...
    (comp.unix.programmer)
  • Re: A funny yet crazy extreme test on Delphi 7 compiler
    ... The RAM is 1G. ... A project with a major source file names TestCase.pas. ... Delphi can compile crazy functions with 999 parameters. ...
    (borland.public.delphi.non-technical)
  • Re: problem with sourcepath option
    ... I want to compile this file from another directory,say ... required <source files>. ... javac -sourcepath news news/PathTest.java ...
    (comp.lang.java.programmer)