2008年4月28日 星期一

JDK設定步驟


這篇文章.最適合初學者看吧! 
JDK設定步驟:

   1. java程式的compiler,tools,package甚至是source code都包含在jdk這個套件中,jdk可到sun取得,各平台都有jdk的套件,請依需要選擇然後安裝。
   2. 拿到jdk解開後,會安裝在一個目錄下 如:windows下 c:\jdk1.1 ; 或 unix 下/usr/local/java
   3. 在作業系統下增加JDK路徑,及classpath的環境變數:

      windows:

      ================ AUTOEXEC.BAT ==============

      PATH=%PATH%;C:\JDK1.2\BIN

      SET CLASSPATH = C:\JDK1.2\JRE\LIB;  <== 若為jdk1.2則不須加上此行

      ============================================   

      unix:(bash or sh)

      ================ .profile ==================

      PATH=$PATH:/usr/local/java/bin

      CLASSPATH=/usr/local/java/jre/lib:  <== 若為jdk1.2則不須加上此行

      export PATH

      export CLASSPATH

      ============================================

   4. 當寫好程式 InstanceSample.java , 必須要將程式編譯(compile)

      windows: 

      c:\jdk1.2>javac InstanceSample.java

      unix:

      # javac InstanceSample.java

   5. 程式編譯後,會產生 ClassSample1.class 的bytecode, 如果要執行,可打

      windows: 

      c:\>java InstanceSample

      unix:

      # java InstanceSample

如何執行Applet:

     假設Applet程式放在 ExtendsSample.html中

     c:\>appletviewer ExtendsSample.html

Bible:

     寫程式最重要的是參考資料,因此jdk內的package用法必須到 Sun

     下載jdk的document(java api),才能知道如何使用

     %%% very important %%%

#end


This message and any attachments (together, the "message") are intended only for use of the addressee and may contain information that is privileged and confidential. If you are not the intended recipient, you are hereby notified that any use or dissemination of the message is strictly prohibited. Any use not in accordance with its purpose, any dissemination or disclosure, either in whole or in part, shall be prohibited except with our prior approval. If you have received this message in error or you have doubts about the authenticity of it, please notify us immediately by reply and delete this message from your system. We do not represent that messages may not be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems. We shall not be liable for the message if modified. We also reserve the right to intercept and monitor the content of email message to and from our system.

沒有留言: