Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Java Development Environment with ubuntu

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to build a Java development environment with ubuntu". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build a Java development environment with ubuntu".

1. Jdk installation

All right, I choose jdk1.6, isn't it a little out?

1, download jdk1.6, you can go to the official website to download, please see your own version of the system, remember to download the corresponding version.

2. Place the downloaded files in the / usr/lib/java directory (you need to create the java directory manually), and modify the executable permissions of the files, such as chmod 777 jdk-6u41-linux-x64.bin

[ps: if you are prompted that the file java already exists and cannot create a java, you can name the directory java1.6 (indicating that this is jdk version 1.6)]

3. Installation file, sudo. / jdk-6u41-linux-x64.bin

4. After installation, you need to configure the system environment sudo vi / etc/environment, or configure the user environment variable vi / home/username/.bashrc, establish javahome, classpath, and modify the path variable.

For example, my setting is:

Java_home= "/ usr/lib/java1.6/jdk1.6.0_41" path= "/ usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/java1.6/jdk1.6.0_41/bin:/usr/lib/java1.6/jdk1.6.0_41/jre/bin" classpath= "/ usr/lib/java1.6/jdk1.6.0_41/lib:/ Usr/lib/java1.6/jdk1.6.0_41/jre/lib "

5. Execute the command to make the configuration effective. Source / etc/environment (source / home/username/.bashrc)

6. Verify whether the installation is complete, use java-version or directly use javac to see whether it is effective or not.

7. If it has not yet taken effect, it is very likely that there is already a default jdk in ubuntu, such as openjdk, so in order to use the jdk we installed by default, we need to do the following work.

Sudo update-alternatives-install / usr/bin/java java/ usr/lib/java/jdk1.6.0_41/bin/java 300sudo update-alternatives-install / usr/bin/javac javac / usr/lib/java/jdk1.6.0_41/bin/javac 300

Add our installed jdk to the java menu through this step.

Then execute:

Update-alternatives-config java

II. Myeclipse installation

Download the installation package, after the download is complete, modify the permissions directly and then install it.

Third, the first hello world program

1) create a new java project and name it helloworld

2) create a new package with the name com.cricode

3) create a new class sayhello in the package com.cricode, as follows:

Package com.cricode; public class sayhello {public static void main (string [] args) {system.out.println ("hello,world");}}

Running result: hello,world

Thank you for reading, the above is "how to use ubuntu to build Java development environment" content, after the study of this article, I believe you have a deeper understanding of how to use ubuntu to build Java development environment, the specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report