Joke Collection Website - Cold jokes - About Java, SOS! ! !
About Java, SOS! ! !
first, you configure the environment according to the following, and then go to the file directory when running. For example, if your hello.java is on disk D, go to the bottom of disk D first, and then javac hello.java Java Hello. That's it.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
JDK installation setting environment variables
1. Preface
JDK(java Development Kit). It is a set of APIs, or some java Class. 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 win2 here.
second, download and install
The download address is the official JAVA website: java.sun.com, which is also everywhere in China.
under p>Windows, run the. exe file directly and install it in a directory. I use F:\jdk13 as an example here.
III. Configure
Select "My Computer" on the desktop (right click)
Advanced
Environment variables
In "System variables"-> "new"
enter: CLASSPATH in the variable name and:
F:\JDK13\LIB\dt.JAR in the variable value; F:\JDK13\LIB\TOOLS.JAR; F:\JDK13\BIN; Then determine;
well, after configuration, the environment variables will not be effective until the computer is restarted.
fourth, test
(1) write a simple java program with a text editor:
public class hello world {
public static void main (string args []) {
system. out.println ("hello world!") );
}
}
This example is the famous "Hello World", and its function is to display "Hello World".
note: the file name must be "HelloWorld.java" and it is case-sensitive. Careful friends will notice that it is the same as the name after public class.
(2) compile: execute at dos command prompt: (note case)
javac HelloWorld.java
if it is normal, the HelloWorld.class file will be generated.
(3) Run: execute at the dos command prompt: (pay attention to case)
java HelloWorld
Here is a problem that beginners of java are likely to encounter (I am not afraid of jokes, so am I), that is, input:
java HelloWorld.class
There is more. class behind it, so be sure to pay attention. Otherwise, the following error will appear:
exception in thread "main" java.lang.noclassDefoundError: Hello World/class
(I guess, did java translate "."with "/"or for other reasons I don't know)
Well, there should be a great "hello" when running java HelloWorld.
at this point, you have successfully configured the JDK, and you can start a long and painful java process (for friends like me who didn't know Java before, it can be described as "pain", unfamiliar concepts, unfamiliar java api ..., but don't worry, I will get started and improve slowly with you ...).
- Previous article:How did Yongzheng die?
- Next article:Asian humorous jokes
- Related articles
- 500-word storyline, early flowers and late flowers.
- Depression joke
- Humorous jokes about family planning
- Does anyone know which area Nanhui Hangtou will row to?
- Foreign films that travel through time and space
- Industry humor jokes
- What should I do if my penis feels short?
- Although Daming is the son of heaven to protect the country, is it a joke that the king died in his own country?
- What if the baby can't talk?
- Film and War