Joke Collection Website - Cold jokes - MyEclipse This pops up when Tomcat starts. Is it a JDK problem? But I installed jdk 1.6 and this pops up again.

MyEclipse This pops up when Tomcat starts. Is it a JDK problem? But I installed jdk 1.6 and this pops up again.

Install jdk, configure environment variables and test java

1. Install jdk and configure environment variables

Download: jdk1.5.0_08: With this installation program, You can develop and run JAVA-related programs

Follow the JDK prompts to install, and set the environment variables after installation

The steps to configure JDK environment variables are as follows:

1. My Computer--gt; Properties--gt; Advanced--gt; Environment Variables.

2. Configure user variables:

a. Create new JAVA_HOME

C:\Program Files\Java\j2sdk1.5.0 (JDK installation path)

b. Create a new PATH

JAVA_HOME\bin; JAVA_HOME\jre\bin

c. Create a new CLASSPATH

.; JAVA_HOME\lib; JAVA_HOME\lib\tools.jar

3. Test whether the environment variable configuration is successful:

Start--gt; Run-->CMD

Type: JAVAC JAVA

If the corresponding command appears instead of an error message, it means the configuration is successful!

The first simple program HelloWorld:

Open Notepad and enter the following code:

class HelloWorld{

public static void main (String[] args) {

System.out.println("Hello World!");

}

}

Save it as HelloWorld.java (the file name must be consistent with the class name in the file, and the case must be the same)

Then open DOS (enter "cmd" in the command box and press Enter)

Enter the folder where the HelloWorld.ava file is located (the "cd" command can enter the folder)

Enter the following command:

javac HelloWorld.java (compile)

Enter

java HelloWorld (run)

Enter

OK! Check whether "Hello World!" is output.

jdk configuration environment variables

Right-click My Computer, Properties, select Advanced, Environment Variables

1 First Create a new system variable with the name java_home and the value is your installation path. For example, if your installation path is jdk1.5 under the C drive, then your value should be written as C:\jdk1.5

2 Create another system variable CLASSPATH. The value is your class library, which is the .jar file under the lib under jdk.

Write the basic class library you want to use in the value section.

p>

If your installation path is c:\jdk1.5 then the value is.; c:\jdk1.5\lib\dt.jar; c:\jdk1.5\lib\tools.jar (note The first thing added is a period and a semicolon).

3 Finally, add the environment variable PATH after the original value; c:\jdk1.5\bin

For those who have just started learning, it is recommended to change the installation path to C:jdk1.5 , and then the value of the environment variable can be copied from this. After you understand the principle of writing this way, you can write it yourself.

After the settings are completed, you can run your java program under dos.

First, please make sure to configure the jdk as follows.

If your stuff is on the D drive, first go to the D drive and then execute javac hello.java java hello to run;

JDK installation and setting environment variables

1. Foreword

JDK (Java Development Kit) is the foundation of all java applications. It can be said that all java applications are built on this. It is a set of APIs, which can also be said to be some java Classes. The latest version that has been officially released is JDK1.3. Considering that I am not familiar with Linux and most of them are under MS system, I use win2000 here.

2. Download and install

The download address is the official JAVA site: java.sun.com, which is also available everywhere in China.

Under Windows, run the .exe file directly and install it into a directory. I use F:\jdk13 as an example.

3. Configuration

Select "My Computer" on the desktop (right-click)

Advanced

Environment Variables

In "System Variables" ---gt; "New"

Enter in the variable name: CLASSPATH, enter in the variable value:

F:\JDK13\LIB\dt .JAR; F:\JDK13\LIB\TOOLS.JAR; F:\JDK13\BIN; and then confirm;

Okay, after the configuration is completed, the environment variables can only be effective after restarting the computer.

4. Test

(1) Use a text editor to write a simple java program:

public class HelloWorld {

public static void main(String args[]) {

System.out.println("Hello World!");

}

}

This example is the famous "Hello World", its function is to display "Hello World".

Note: The file name must be "HelloWorld.java" and is case-sensitive. Careful friends will notice that it is the same as the name after public class.

(2) Compilation: Execute at the dos command prompt: (note the case)

javac HelloWorld.java

If normal, HelloWorld will be generated .class file.

(3) Run: Execute in dos command prompt: (note the case)

java HelloWorld

It is very likely that there is a java beginner here The problem I encountered (I’m not afraid of jokes, me too) is typing:

java HelloWorld.class

There is an extra .class at the end, so be sure to pay attention, otherwise the following error will occur:

Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class

(I guess, whether java replaced "." with "/" when translating ".", or It's for other reasons that I don't know)

Okay, running java HelloWorld should give you a great "Hello World".

At this point, you have successfully configured the JDK, and you can start the long and painful process (for friends like me who did not understand Java before, it can be described as "painful" and do not understand Concepts, unfamiliar java api..., but don't worry, I will slowly get started with you and slowly improve the Java process...).