Java Concurrency 简明教程
Java Concurrency - Environment Setup
在本章,我们将讨论为 Java 设置宜人环境的事物的不同方面。
In this chapter, we will discuss on the different aspects of setting up a congenial environment for Java.
Local Environment Setup
如果您仍然希望为 Java 编程语言设置您的环境,本文将指导您如何在您的机器上下载和设置 Java。以下是设置环境的步骤。
If you are still willing to set up your environment for Java programming language, then this section guides you on how to download and set up Java on your machine. Following are the steps to set up the environment.
Java SE 可以通过链接 Download Java 免费获得。您可以根据您的操作系统下载一个版本。
Java SE is freely available from the link Download Java. You can download a version based on your operating system.
按照说明下载 Java 并运行 .exe 以在您的机器上安装 Java。一旦您在您的机器上安装了 Java,您将需要设置环境变量来指向正确的安装目录 −
Follow the instructions to download Java and run the .exe to install Java on your machine. Once you installed Java on your machine, you will need to set environment variables to point to correct installation directories −
Setting Up the Path for Windows
假设你已将 Java 安装在 c:\Program Files\java\jdk 目录中 −
Assuming you have installed Java in c:\Program Files\java\jdk directory −
-
Right-click on 'My Computer' and select 'Properties'.
-
Click the 'Environment variables' button under the 'Advanced' tab.
-
Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.
Setting Up the Path for Linux, UNIX, Solaris, FreeBSD
应该设置环境变量 PATH 以指向已安装 Java 二进制文件的位置。如果您遇到困难,请参阅您的 shell 文档。
Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation, if you have trouble doing this.
例如,如果您使用 bash 作为您的 shell,那么您将向 '.bashrc 的尾部添加以下行: export PATH = /path/to/java:$PATH'
Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH = /path/to/java:$PATH'
Popular Java Editors
要编写 Java 程序,您将需要一个文本编辑器。市场上有更复杂的 IDE。但现在,您可以考虑以下内容之一 −
To write your Java programs, you will need a text editor. There are even more sophisticated IDEs available in the market. But for now, you can consider one of the following −
-
Notepad − On Windows machine, you can use any simple text editor like Notepad (Recommended for this tutorial), TextPad.
-
Netbeans − A Java IDE that is open-source and free which can be downloaded from https://netbeans.org/index.html.
-
Eclipse − A Java IDE developed by the eclipse open-source community and can be downloaded from https://www.eclipse.org/.