Installing a Linux virtual machine to execute Java programs

Source: Internet
Author: User

1. Installing VMware

2. Installing the CentOs image (Centos-7.2-x86_64-dvd-1511.iso) in VMware

3. If you cannot surf the web after starting CentOS, or if you do not have a ifconfig command, you need to install Net-tools tools, etc.

The CENTOS7 is minimized in the virtual machine and cannot be connected to the Internet because the CENTOS7 default NIC is not activated.
And there is no Ifconfig file in the Sbin directory, this is because CENTOS7 has not used the Ifconfig command, has been replaced with the IP command;
And the NIC name is not eth0, but instead changed to eno16777736 (random name).
Resolve Ifconfig not available: IP addr To view the allocation of network cards.
Activating the network card: in the file/etc/sysconfig/network-scripts/ifcfg-enp0s3
Enter edit mode, change Onboot=no to Onboot=yes, OK

Reference resolution CENTOS7 cannot be networked and Ifconfig appears command not found

Restart NIC after saving: Service network restart
The Internet is available at this time. (If you do not know how to determine whether the Internet, ping the URL can be, it is so simple, such as command: Ping www.baidu.com)

4. If the ifconfig command is still not supported, you will need to install the Net-tools tool

[Root@localhost ~]# cd/sbin

[Root@localhost sbin]# ls

Check to see if there isifconfig

No ifconfig , install it.net-tools package

[Root@localhost sbin]# sudo yum install net-tools-y

Refer to Centos7:ifconfig command not found to resolve

After the installation is successful, you can use the Ifconfig command

5. Installing RZ and SZ commands

# yum-y Install Lrzsz

Refer to the Linux CentOS installation rz and sz command Lrzsz

6. Download Java SDK 1.8 Install Java environment

Go to the official website to download the JDK installation package http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Download Linux x64 jdk-8u171-linux-x64.rpm 167.14 MB

7. After downloading the local, upload the file via the RZ command

8. Installing the Java SDK

RPM-IVH jdk-8u171-linux-x64.rpm

The difference between Yum and RPM in Linux

9. Use command java-version after installation to determine if the installation was successful

10. Create a new Java file using the VI command

Input

public class test1{

public static void Main (string[] args) {

System.out.println ("Hello World");

}

}

Then: Wq save exit (ensure that the file name is consistent with the class name, if inconsistent use the MV original filename to rename the new file name)

11. Compiling files Java-c Test1.java

12. Execute Command Java Test1

13. View byte code javap-c Test1

Linux Yum command

Installing a Linux virtual machine to execute Java programs

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.