Java version of the first HelloWorld program!

xiaoxiao2021-03-06  58

First download J2SDK, you can download directly from Sun website, http: //java.sun.com, you need to set up four environment variables after installation: 1.include finally added; C: / J2SDK / Include. 2.Path finally added; c: /j2sdk/bin3.lib finally added; C: / J2SDK / LIB4. New Environment variable named ClassPath, value is.; C: /J2SDK/Lib/dt.jar; C: /j2sdk/lib/tools.ja then saves and restarts. Source code: public class helloworld {public static void main (string args []) {system.out.println ("Hello World!");}} When you save it, you must post it later after you must be named .java, otherwise you can't compile additional The name of the class and the file file name of the deposit must be consistent otherwise it will be wrong, then compile Javac HelloWorld.java, pay attention to the case, otherwise it is wrong to compile nothing. The file of HelloWorld.class will appear in the folder where the source code is stored. Then Java HelloWorld runs, OK! Note: If there is no ClassPath's environment variable, an error occurs: Exception in thread "main" java.lang.noclassdeffounderror: HelloWorld

转载请注明原文地址:https://www.9cbs.com/read-113867.html

New Post(0)