problems with basic "Hello World" program

From: john smith (princetonharvard_at_charter.net)
Date: 02/25/05


Date: Fri, 25 Feb 2005 14:12:22 -0800

I have a basic program where I compile the java code and then run it.

I can not seem to run the code for some reason.

1.) Here is my code

class HelloWorld
{

  public static void main( String[] args)
  {
    System.out.print("This is Java");
  }

}

2.) I then type in javac HelloWorld.java
and this works. I end up getting a HelloWorld.class.

3.) then I type in java HelloWorld and this does NOT work.

I get an error message:

Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/java

Can someone please tell me what is wrong. I am really confused since I know
I am able to compile
ok, just cannot run the program.

Thanks for any help on this matter.



Relevant Pages

  • Re: problems with basic "Hello World" program
    ... > I have a basic program where I compile the java code and then run it. ... > class HelloWorld ...
    (comp.lang.java.help)
  • Re: Scriptbasic - Compiling the generated C code
    ... When you compile a ScriptBasic program to C you actually do nothing ... but create a C program that contains the bytecode of the BASIC program ... BASIC interpreter creates in memory or saves to an output file when it ...
    (comp.os.linux.development.system)
  • using perl script to compile java
    ... I'm trying to do a small perl sript to compile a basic java code. ... and the name of the perl script is "compile". ...
    (comp.lang.perl.misc)
  • Re: Java For Mac/Linux
    ... An alternative way may be to compile your java code with gcj (gnu ... compiler) but I don't know if it exists for mac. ... often an .exe wrapper that invokes the JVM is used. ...
    (comp.lang.java.programmer)
  • help! how can a compiled mfile read structured data from a mfile
    ... I have a set of m-files, A.m, B.m and C.m. ... by another program in Java code. ... So I compiled the m-files into C++ dll file ... compile A.m and B.m into D.dll and call C.m at runtime, ...
    (comp.soft-sys.matlab)