• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Java Question

Hi, I am trying to run a java program in a program called JCreator. However I go to compile it and it has 2 errors. I took this code right out of a book so i don't see why it doesnt work. Here is the source code. Could someone please tell me whats the matter I dont know if its my Java or the JCreator.

class HellowWorld {
     public static void main (string args[]) {
          System.out.printIn ("hello Nick");
     }
}
0
neocytrix
Asked:
neocytrix
  • 3
1 Solution
 
allahabadCommented:
class HellowWorld {
    public static void main (String args[]) {
         System.out.println ("hello Nick");
    }
}
0
 
allahabadCommented:
-->string
has to be String
-->printIn
has to be println
0
 
neocytrixAuthor Commented:
the Dos prompt is coming up with this,
 Exception in thread "main" Java.lang.NoClassDefFoundError: myclass/java
0
 
yongsingCommented:
What you need to do:

(1) Add the "public" keyword to the class declaration.
(2) Change "string" to "String";
(3) Name the file as "HelloWorld.java"
(4) In JCreator, select the "Build" menu item, and click "Compile File".
(5) Select "Build" menu item, and click "Execute File" to run the program.

public class HellowWorld {
  public static void main (String args[]) {
    System.out.println ("hello Nick");
  }
}
0
 
allahabadCommented:
Save it as HellowWorld.java.
Go to directory where you have this file.
Compile it as javac HellowWorld.java.
Run it as java HellowWorld.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now