|
发表于 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
- Usage: java [-options] class [args...]
- (to execute a class)
- or java [-options] -jar jarfile [args...]
- (to execute a jar file)
- where options include:
- -client to select the "client" VM
- -server to select the "server" VM
- -hotspot is a synonym for the "client" VM [deprecated]
- The default VM is client.
- -cp <class search path of directories and zip/jar files>
- -classpath <class search path of directories and zip/jar files>
- A ; separated list of directories, JAR archives,
- and ZIP archives to search for class files.
- -D<name>=<value>
- set a system property
- -verbose[:class|gc|jni]
- enable verbose output
- -version print product version and exit
- -version:<value>
- require the specified version to run
- -showversion print product version and continue
- -jre-restrict-search | -jre-no-restrict-search
- include/exclude user private JREs in the version search
- -? -help print this help message
- -X print help on non-standard options
- -ea[:<packagename>...|:<classname>]
- -enableassertions[:<packagename>...|:<classname>]
- enable assertions
- -da[:<packagename>...|:<classname>]
- -disableassertions[:<packagename>...|:<classname>]
- disable assertions
- -esa | -enablesystemassertions
- enable system assertions
- -dsa | -disablesystemassertions
- disable system assertions
- -agentlib:<libname>[=<options>]
- load native agent library <libname>, e.g. -agentlib:hprof
- see also, -agentlib:jdwp=help and -agentlib:hprof=help
- -agentpath:<pathname>[=<options>]
- load native agent library by full pathname
- -javaagent:<jarpath>[=<options>
复制代码
javac
- Usage: javac <options> <source files>
- where possible options include:
- -g Generate all debugging info
- -g:none Generate no debugging info
- -g:{lines,vars,source} Generate only some debugging info
- -nowarn Generate no warnings
- -verbose Output messages about what the compiler is doing
- -deprecation Output source locations where deprecated APIs are u
- sed
- -classpath <path> Specify where to find user class files
- -cp <path> Specify where to find user class files
- -sourcepath <path> Specify where to find input source files
- -bootclasspath <path> Override location of bootstrap class files
- -extdirs <dirs> Override location of installed extensions
- -endorseddirs <dirs> Override location of endorsed standards path
- -d <directory> Specify where to place generated class files
- -encoding <encoding> Specify character encoding used by source files
- -source <release> Provide source compatibility with specified release
- -target <release> Generate class files for specific VM version
- -version Version information
- -help Print a synopsis of standard options
- -X Print a synopsis of nonstandard options
- -J<flag> Pass <flag> directly to the runtime system
复制代码
3. 寫第一個java程序進行測試(Hello World)
- class HelloWorld {
- public static void main(String[] args) {
- System.out.print("Hello World");
- }
- }
复制代码
另存爲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話了:) |
|