Installation configuration and use of Java Toolkit

Source: Internet
Author: User
Tags variable
1. Download J2sdk 1.4.1 or later (http://java.sun.com, it is recommended to download its Java documentation at the same time, this is the Java Help document)

2. Run just downloaded J2sdk-1_4_1_02-windows-i586.exe file for formal installation (the following assumptions installed in c:\j2sdk1.4.1, the recommended installation path should not have spaces, should not be installed in the \program Files directory!) )。

3. Set the operating environment parameters: a. If it is win95/98, add the following 3 line statements at the end of \autoexec.bat:
Set java_home=c:\j2sdk1.4.1
Set path=%java_home%\bin;%path%
Set classpath=.; %java_home%\lib
Note: Use the DOS command Notepad c:\autoexec.bat to open Notepad, add the above 3 lines of statement.

B. If it is WIN2000,XP use the mouse to right-click the "My Computer"-> Properties-> advanced-> Environment variables
System variable-> new-> variable name: Java_home variable Value: c:\j2sdk1.4.1
System variable-> new-> variable name: CLASSPATH variable value:.; %java_home%\lib
System variable-> edit-> variable name: Path at the front of the variable value plus:%java_home%\bin;
(There is an English period in the Classpath "." followed by a semicolon indicating the meaning of the current path)

4. Use a text editor (for example: edit.com/notepad/ultraedit/editplus) to write the following code and save it as a file: Helloworld.java (must be case correct!). assumed to be C:\test\HelloWorld.java)

<CCID_NOBR>
<ccid_code>/* Helloworld.java */public class HelloWorld {public static void main (String arg[]) {System.out.printl N ("Hello, world!"); }}</ccid_code>
</CCID_NOBR>

5. Open a DOS window, CD (that is, jump/change directory) to the directory where Helloworld.java resides
C:\&GT;CD \test
C:\test>_

6. Compile Helloworld.java as Helloworld.class
C:\test>javac Helloworld.java

7. Run Helloworld.class
C:\test>java HelloWorld
Hello, world!.
C:\test>_

Note: If the exception in thread "main" java.lang.noclassdeffounderror:helloworld/javaerror:ccan′n appears Read:HelloWorld.java Mistakes like that, then write Javac and Java back.

If the bad command or file name indicates that the JAVAC command does not work, you need to: C:\>set path= "C:\jdk\bin" registers the command in the bin directory with this command

Also pay attention to case. (T111)


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.