????????

????????????????????????y?? ??????????? ??????????? ???????д?????? ?????????.

?????????

??????? ??·?? (class path)

???????????????????????? java?? ????????д??? hello world???????????У? ???????????????????????????? ??????????? ??????? Can't find class HelloWorld ???? Exception in thread "main" java.lang.NoSuchMethodError ?? maain.?????? ?????? class ???????.

?????????????????? java ????????й???. ?????????? java ????? java??????????????е?? ?????? java ???? javac ????????? .class?????????????е???? ?????????(bytecode)?? ???????? classloader???????Щ????? ???????????????. ????????????? classloader ????????? java ???????????????????????????? ???????????(???·??).????????????????????????????? ???????????·??(classpath)?? ?????????е???????????????. ???????? classpath ??????????. ????????????е??????С?? ????????????????? ???????????????.    ????? java ????????? java luncher ???????? ??? java (?? java.exe)?????????????. ??????????????????????????????????

????1?? ?????? ??? java ?????? ???? rt.jar ?? i18n.jar ?е???.

????2?? ????? ??? java ?????????? ????λ???????($JAVA_HOME/jre/lib/ext)?е? .jar ??????.

????3?? ????? ????????????????????? java ????????????????. ?????????????????? -classpath ????????? CLASSPATH ???????????????Щ???λ??. ????????????????????????????????Щ??.?????? ???????? ???????????????λ??? ??????????????"???"????.

???????????????????? ?????·?????Щ??????????????? .jar?? .zip ??????б?? ??????????????? ???????? package ?????? ???潫??????? ?????????????????????????????????. ?????????????????в???? ?? unix ????????????? "??"?? windows ???? "??". ????????????

????* "."?? ????????? ????????.

????* CLASSPATH ?????????? ???????? ?????????.

????* ?????в??? -cp ???? -classpath?? ???????? ???????????.

????* ?? -jar ????????? .jar ???????? ?????????????????? ???е??????????????????????. ???????????е? .jar ????? ??????????Щ???? ???? package?? ?????????????????? ?????????. ??????? jdk ??????Щ????.

?????????? HelloWorld ???????????. ??????????裺

????* ??????? /HelloWorld (?? c??HelloWorld?? ??????????)

????* jdk ?汾? 1.2.2 (linux ?μ?)

????* PATH ???????????????. (???????????κ????????????ù???)

????* ????? HelloWorld.java?? ???????

public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World! ");
System.exit(0);
}
}