Ask the people who have a HelloWorld issue is too much, and often start with "ask a simple question". It really thinks about it, it is also from this stage, saying "Hello", is it really a simplest question? ... // Think is good, the words retired, let's say "HelloWorld!" in Java ... First, we have to assume that our platform is Windows JDK (LINUX environment is similar). This environment is quite common, foundation, and entry. Determine that JDK has been installed correctly, the next step is to be carefully knocked into the HelloWorld source code on a tutorial, the deployment, then compile, Javac ... The problem is coming: * Error 1: 'javac' is not internal or external command, nor The running program or batch file. (Javac: Command Not Found) The reason is that the environment variable Path is not set. Path =% path% is added to AutoExce.bat under whe98; C: /JDK1.2/bin, then under the control panel -> System -> Advanced -> Environment Variables -> System Variable ... I saw? Double click on Path, add C: /JDK1.2/bin in the back. Of course, we assume that JDK is installed in a C: /JDK1.2 directory (a little Tang Yan?) ... It seems to restart the system to work ... (// know! // Tomato) Good, try again ! Javac HelloWorld * Error 2: HelloWorld Is An Invalid Option or Argument. Please give some professionalism, Java's source program is necessary to save .java file, and write all. Java. OK, Javac HelloWorld.java (this time should I become?) * Error 3: HelloWorld.java: 1: public class helloWorld Must be defined in a file callaled "HelloWorld.java". Public class helloworld {^ This problem It is because your name is inconsistent with the name of the file. (Who said, clearly seeing people have such a writing; () OK, accurately said that a plus class can be defined in a Java source program, but the classes with public properties can have one, and The name is consistent. Also, the main method must put in this public class, so that Java (run) this class. In addition, the Java language is strictly sized strictly, and beginners should pay attention.
Like the above case, helloWorld and HelloWorld think are different, so ... oh ... good, change, 嘻 ... ... javac helloworld.java ... (咦, how is it?) / / Faint this is the compilation pass! See if you have a HelloWorld.class? (Hehe .. Press the book :) Java HelloWorld (!! I know, not java helloworld.class 哟) * Error 4: Exception in thread "Main" java. Lang.noclassdeffounderror: HelloWorld huh, this is the famous classpath problem. In fact, class paths are the concepts in Java involved in the compilation process. ClassPath is to specify where to find the class, it is as simple as it is. Since our HelloWorld is not used in other (non-java.lang package) classes, there is no encounter when compiling. When running, you have to indicate where your class is. Solution, you can run: java -classpath. HelloWorld "." The current directory can be used. Of course, this is a bit trouble (it is "too much trouble"!), We can set the default classpath in the environment variable. Methods are set by the above settings. Set ClassPath = .; c: /jdk1.2/lib/dt.jar; c: /jdk1.2/lib/Tools.jar The two suggestions behind it also set up. Java-ClassPath. HelloWorld (I don't want to learn Java again) * Error 5: Exception in thread "main" java.lang.nosuchmethoderror: main (// 咣) Don't stay. Look at your code, the problem is in the definition of the main method, write it to the place, is it written? Public static void main (string args []) {// One word should not be poor, don't ask why ... Yes, including uppercaseness! Java-ClassPath. HelloWorld (listening to the heavens!) Hello World! (FAINT! Finally ...) Welcome to the Java world! Therefore, it is not a "simplest problem" that cannot be running helloworld is really a "simplest problem". Attached: helloworld.java // HelloWorld.java public class helloworld {public static void main (string args []) {system.out.println ("Hello World!");}}