In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you about how to analyze the installation, configuration and operation of the Java running environment. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
JRE is the abbreviation of JavaRunTimeEnvirment, and the Java runtime environment (including JavaPlug-in) is the product of Sun, which includes two parts: JavaRuntimeEnvironment and JavaPlug-inJavaRuntimeEnvironment (JRE) are the Java platforms on which applications can be run, tested, and transferred.
Installation, configuration and Operation of Java operating Environment
I. purpose of the experiment
1. Master downloading JavaSDK software package.
2. Master the method of setting up the running environment of Java program.
3. Master the method of writing and running Java programs.
4. Get an overview of the Java language.
5. Install and master JCreator software to prepare for learning Java language and experimenting with Java program.
6. Browse the Applet program
2. Experimental requirements
1. Install and set up the JavaSDK package.
2. Write a simple Java program that outputs "hello,java!" on the screen.
PublicclassHello {publicstaticvoidmain (Stringargs []) {System.out.println ("hello,java!");}}
3. Master the steps of running the Java program.
4. Browse Mini Program, the Applet app that comes with SDK.
III. Content of the experiment
(1) download and installation of SDK
1. Machine requirements
Java does not have high requirements for machine operation. The following are the machine requirements based on the Windows platform.
Hardware requirements: CPUPII or above, 64m memory, 1OOM hard disk space can be.
Software requirements: Windows98/Me/XP/NT/2000,IE5 or above.
2. Download SDK
In order to build a SDK-based Java runtime environment, you need to download Sun's free SDK package first. SDK contains a complete set of development tools, including the Java compiler, Applet viewer, and Java interpreter that are most useful for programming.
Enter http://java.sun.com/ in the browser and choose to download the J2SEv1.4.2_01SDK package in the "DownloadJ2SEv1.4.2_01" bar of the page. There are two options: one is to install "WindowsInstallation" online, and the other is to install "WindowsOfflineInstallation" offline.
3. Install SDK
Run the downloaded "j2sdk-1_4_2_01-windows-i586.exe" package, you can install SDK, you can set the installation path and select components during the installation process, the default installation path of the system is C:\ j2sdk1.4.2_01 (choose E disk here), and the default component selection is all installation.
Main folders and files in 4.SDK
After successful installation, the files and subdirectories in E:\ j2sdk1.4.2_01 contain the compiler (javac.exe), interpreter (javac.exe), and Applet viewer (appletviewer.exe) in the bin folder.
5. Wait for executable file
(2) set Java running environment variables
The tools in SDK are command-line tools, and you need to run them from the command line, the MS-DOS prompt. A lot of people might not
Habit, but this is a strategy deliberately adopted by Sun to focus more on the Java language itself than on development tools.
In order to use SDK correctly and conveniently, you can configure some Windows environment variables manually. The configuration of Windows98 is slightly different from that of Windows/xp/NT/2000. Take Windows/xp/NT/2000 as an example to illustrate the relevant configuration.
1. Set WindowsXP/NT/2000
Right-click on the "my computer" icon on the desktop, select the "Properties" menu, and the system property settings interface will appear.
Click the Environment variables button on the Advanced tab. The Environment variables setting interface appears
Select Path in the system variable box, and then click the Edit button in the Edit system variable dialog box that appears
Add the "E:\ j2sdk1.4.2_01\ bin;" command before the command in the "variable value" column
Set the environment variable "classpath" in the same way, with the value of the "E:\ j2sdk1.4.2_01\ lib;" command.
When the setting is complete, click the "start" → all programs "→" attachment "→" command prompt to open the DOS window, enter "java" or "javac" at the command prompt, and if the prompt for its usage parameters appears, the installation is correct.
2. Set the starting position of DOS
In order to open the DOS window and go directly to the path that contains the java program you developed, here is an example of WindowsXP/2000 to illustrate the setup process.
First of all, establish a path and folder to store the java source programs, such as storing all the java source programs established in the experiment in the "e:\ java\ programs" folder.
Click the "start" → all programs "→" attachment "→" command prompt, select the "command prompt" option, right-click
Select the Properties menu from the drop-down menu that appears, and the Command prompt Properties dialog box opens.
Select the Shortcut option in the Command prompt Properties dialog box, enter e:\ java\ Program in the start location bar, and click the OK button.
After making the above settings, when you open the DOS window, you will go directly to the "e:\ java\ Program >" path.
If you do not have the above settings, you can use the DOS command, directly enter "e:" press enter to enter the e disk, then enter "cdjava" to the java subdirectory of the e disk, and then enter "cd program" to the "e:\ java\ program >" path.
(3) write and compile Java source programs
1. Open a plain text editor and type the following program:
PublicclassHello {publicstaticvoidmain (Stringargs []) {System.out.println ("Hello,welcome!");}}
2. Name the file Hello.java, save it as a text file format, and pay attention to the path to save the file. According to the previous setting of the environment variable, Hello.java should be saved in the path of "e:\ java\ Program >".
(4) compiling Java source programs
After the Java source program is written, it is compiled using the Java compiler (javac.exe) to compile the Java source program into executable program code. Java source programs are text files with the extension .java. When compiling, first read into the Java source program, then check the syntax, and terminate the compilation if there is a problem. After the syntax check is passed, the executable program code is generated, the bytecode file name is the same as the source file name, and the extension is .class.
1. Open a command prompt window (MS-DOS window) to enter the path where the Java source program is located.
2. Type the compiler file name and the source program file name to translate. JavacHello.java
3. Press enter to start the compilation (note: the file name H should be capitalized, otherwise there will be problems with running).
If there is no error in the source program, there is no output on the screen. Type "dir" and press enter to see that a .class file "Hello.class" with the same name is generated in the directory. Otherwise, an error message is displayed.
(5) run the Java program
Use the Java interpreter (java.exe) to interpret the compiled bytecode file Hello.class as local computer code. Type the interpreter file name and the bytecode file name javaHello to be interpreted in the command prompt window or MS-DOS window, press enter to start the explanation and see the running result.
(VI) installation and use of JCreator software
Edit, write and run Java programs under JCreator environment
(7) browse the Applet app Mini Program that comes with SDK.
Open the web page file example1.html with a browser in the downloaded\ j2sdk1.4.2_01\ demo\ applets\ Clock folder, and you can see that an Applet embedded in the Web page starts running and an analog clock appears on the web page. This section covers the installation, configuration, and operation of the Java runtime environment.
The above is the editor for you to share how to analyze the installation and configuration of the Java operating environment and running, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.