Make the configuration take effect
[Root @ localhost java] # source/root/. bash_profile
Check whether some environment variables have been successfully configured.
[Root @ localhost java] # env
If the following information is similar, the setting is successful:
[Root @ localhost java] # mkdir/home/workspace/helloworld
[Root @ localhost java] # cd/home/workspace/helloworld
Write the simplest Java program
[Root @ localhost helloworld] # vi hello. java
Enter the following content:
Class hello
{
Public static void main (String [] args)
{
System. out. println ("Hello world! My Java! ");
}
}
3. Install Eclipse
First download Eclipse, web site for the current http://www.eclipse.org, Eclipse version 3.2.1,
Download its gtk version to the/opt Directory: eclipse-SDK-3.2.1-linux-gtk.tar.gz
[Root @ localhost root] # cd/opt
[Root @ localhost opt] #
[Root @ localhost opt] # tar zxvf eclipse-SDK-3.2.1-linux-gtk.tar.gz
[Root @ localhost opt] # cd eclipse
[Root @ localhost eclipse] # ls
About_files configuration eclipse. ini features libcairo-swt.so plugins startup. jar
About.html eclipse epl-v10.html icon. xpm notice.html readme
[Root @ localhost eclipse] #./eclipse &
[1] 16161
[Root @ localhost eclipse] #
Compile the first Eclipse Java program.
File-> New-> Project...
Select a Java Project, click Next, enter the Project name: hello, and click Finish to create a Project.
Can I see the hello string in the Workspace on the left?
Right-click it, select New-> Class, enter the Class Name: hello, and click Finish.
At this time, the editing page appears in the middle of Eclipse. Enter the following content:
Public class hello {
/**
* @ Param args
*/
Public static void main (String [] args ){
// TODO Auto-generated method stub
System. out. println ("Hello world! My Java! ");
}
}
Save and compile now.
Can I see the hello. java string in the Workspace on the left?
Right-click it and choose Run as-> 1 Java Application to compile and pull
In the lower Console dialog box of Eclipse, output:
Hello world! My Java!
Yes?
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