FAQ for java basic edition --- [jdk installation]

Source: Internet
Author: User

Q: Where can I download JDK?

A:J2SE 5.0 J2SE 5.0 Japanese J2SE 1.4.1 J2SE 1.4.2 Japanese

Q: How to Set JAVA environment variables?

A:If it is Win95/98, add the following three lines at the end of autoexec. bat:

Set JAVA_HOME = c: j2sdk1.4.2

Set PATH = % JAVA_HOME % in; % PATH %

Set CLASSPATH = .;

After reading the first "." In CLASSPATH, this indicates the current directory. Many people HelloWorld does not run because of this.

For Win2000 or XP, right-click "my computer"-> properties-> advanced-> Environment Variables

System variable-> New-> variable name: JAVA_HOME variable value: c: j2sdk1.4.2

System variable-> edit-> variable name: Path is added at the beginning of the variable value: % JAVA_HOME % in;

System variable-> New-> variable name: CLASSPATH variable value :.;

The "." In front of CLASSPATH has the same meaning as above.

Q: How to Use JDK?

A:Follow the prompts to install JDK successfully, set environment variables, open notepad, and enter:

Public class HelloWorld {

Public static void main (String [] args ){

System. out. println ("Hello, world! ");

}

} // Case sensitive !!!

Save as HelloWorld. java. Be sure to select "all types" when saving, open the command prompt (Dos), and enter the directory of your saved files,

Javac HelloWorld. java(Compilation) if there is no error, then

Java HelloWorld(Run)

Java.sun.com official tutorial on writing the first Java program.

Your First Cup of Java (for Microsoft Windows)

Q: Why error: cannot read: HelloWorld. java 1 error when running javac HelloWorld. java

A:First, check the spelling of the file name, Case sensitivity, and check whether the directory is correct.

Q: Why does java HelloWorld fail?

A:This error is often found:

Java. lang. NoClassDefFoundError: HelloWorld

Exception in thread "main"

First, it may be because your CLASSPATH is not correctly set. Please follow

Step. If your path is set correctly, make sure that your class name is

Whether the class name is correct. in JAVA, upper and lower case are differentiated to see if your class name is correct.

Q: How to run the Applet?

A:There are two main methods:

1. JDK applet browser.

2. IE browser

Both methods must embed the Applet into an HTML file, as shown in figure

<Applet code = "MyApplet. class", width = 200 height = 150>

</Applet>

The file name is xxx.html.

In the applet browser, run

Appletviewer xxx. heml

Double-click the html file with IE.

Q: Why is it blank when I use IE to run the Applet?

A:IE itself does not support running the Applet. You need to download a plug-in (java plug_in) from www.java.sun.com)

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.