LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 885|回复: 2

初学Java 请问如何建立一个Java平台?

[复制链接]
发表于 2005-3-31 09:06:34 | 显示全部楼层 |阅读模式
我的系统是windosw xp 专业版

请问如何建立一个java平台,用什么软件来编写java代码?
:cool:
发表于 2005-3-31 10:08:37 | 显示全部楼层
下载并安装 sdk

任何 text editor 都可以用来编写 java 代码
回复 支持 反对

使用道具 举报

发表于 2005-3-31 10:38:59 | 显示全部楼层
Post by gary9912
我的系统是windosw xp 专业版

请问如何建立一个java平台,用什么软件来编写java代码?
:cool:



1. 下載安裝J2SE SDK,最新的穩定版本是1.5

http://java.sun.com/j2se/1.5.0/download.jsp


2. 配置好環境變量,加入以下變量
JAVA_HOME   你所選擇的J2SE SDK安裝路逕(如:C:\Program Files\Java\jdk1.5.0_01)
CLASSPATH .;%JAVA_HOME%\lib
path              %JAVA_HOME%\bin
確認無誤後打開Command Prompt,用java,javac幾個命令測試下環境變量是否配置成功
例如:java

  1. Usage: java [-options] class [args...]
  2.            (to execute a class)
  3.    or  java [-options] -jar jarfile [args...]
  4.            (to execute a jar file)

  5. where options include:
  6.     -client       to select the "client" VM
  7.     -server       to select the "server" VM
  8.     -hotspot      is a synonym for the "client" VM  [deprecated]
  9.                   The default VM is client.

  10.     -cp <class search path of directories and zip/jar files>
  11.     -classpath <class search path of directories and zip/jar files>
  12.                   A ; separated list of directories, JAR archives,
  13.                   and ZIP archives to search for class files.
  14.     -D<name>=<value>
  15.                   set a system property
  16.     -verbose[:class|gc|jni]
  17.                   enable verbose output
  18.     -version      print product version and exit
  19.     -version:<value>
  20.                   require the specified version to run
  21.     -showversion  print product version and continue
  22.     -jre-restrict-search | -jre-no-restrict-search
  23.                   include/exclude user private JREs in the version search
  24.     -? -help      print this help message
  25.     -X            print help on non-standard options
  26.     -ea[:<packagename>...|:<classname>]
  27.     -enableassertions[:<packagename>...|:<classname>]
  28.                   enable assertions
  29.     -da[:<packagename>...|:<classname>]
  30.     -disableassertions[:<packagename>...|:<classname>]
  31.                   disable assertions
  32.     -esa | -enablesystemassertions
  33.                   enable system assertions
  34.     -dsa | -disablesystemassertions
  35.                   disable system assertions
  36.     -agentlib:<libname>[=<options>]
  37.                   load native agent library <libname>, e.g. -agentlib:hprof
  38.                     see also, -agentlib:jdwp=help and -agentlib:hprof=help
  39.     -agentpath:<pathname>[=<options>]
  40.                   load native agent library by full pathname
  41.     -javaagent:<jarpath>[=<options>
复制代码

javac

  1. Usage: javac <options> <source files>
  2. where possible options include:
  3.   -g                         Generate all debugging info
  4.   -g:none                    Generate no debugging info
  5.   -g:{lines,vars,source}     Generate only some debugging info
  6.   -nowarn                    Generate no warnings
  7.   -verbose                   Output messages about what the compiler is doing
  8.   -deprecation               Output source locations where deprecated APIs are u
  9. sed
  10.   -classpath <path>          Specify where to find user class files
  11.   -cp <path>                 Specify where to find user class files
  12.   -sourcepath <path>         Specify where to find input source files
  13.   -bootclasspath <path>      Override location of bootstrap class files
  14.   -extdirs <dirs>            Override location of installed extensions
  15.   -endorseddirs <dirs>       Override location of endorsed standards path
  16.   -d <directory>             Specify where to place generated class files
  17.   -encoding <encoding>       Specify character encoding used by source files
  18.   -source <release>          Provide source compatibility with specified release

  19.   -target <release>          Generate class files for specific VM version
  20.   -version                   Version information
  21.   -help                      Print a synopsis of standard options
  22.   -X                         Print a synopsis of nonstandard options
  23.   -J<flag>                   Pass <flag> directly to the runtime system
复制代码



3. 寫第一個java程序進行測試(Hello World)

  1. class HelloWorld {
  2.     public static void main(String[] args) {
  3.         System.out.print("Hello World");
  4.     }
  5. }
复制代码

另存爲HelloWorld.java,javac HelloWorld.java編譯,java HelloWorld運行。


4. 選擇適合的編輯器進行學習
現在一個學習java的環境已經搭好了,選擇編輯器就是個人的喜好問題了,我個人推薦是Editplus/UltraEdit,當然如果你喜歡Linux或是也打算在這方面有所作爲的話,我建議你使用VIM,WIN下有GVIM,初學者不推薦任何IDE的。

http://www.vim.org/


5. 選擇教材
現在你需要的是一套適合自己的系統的學習過程,一本好書很適合擔當這個角色。吐血推薦《Thinking In Java》,也就是傳說中的《Java變成死相》:)每章?後的習題一定要做,?氐赘愣.斎蝗绻鉋文水平很牛或是時間較多,看英文原版是個更好的選擇,對各方面都有提高而且理解得可以更深入些,倒不是說候捷老師的翻譯水平爛,可他畢竟是台灣人,很多技術用詞都是台灣常用的,我們看著會很別扭的。例如Type,我們用的是?型,可台灣叫型別.....


6. 找項目練手
盡可能的參予項目,沒有條件創造條件,這個階段很需要?戰演練。因爲除了語言,你現在?K沒有任何項目開發的概念,多看看開發文檔是很有必要的,國外的開源軟件是很好的教科書。


7. 還沒想好
不過如果認真按照上述的步驟踏踏??的學習,我想這時候你的水平已經超過我,不用我再?U話了:)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表