Install jdk-under Linux to solve the problem that wget cannot download JDK __linux

Source: Internet
Author: User
Tags parent directory
Author: fbysss
QQ: Wine bar Bar I scattered
Blog:blog.csdn.net/fbysss
Statement: This article by fbysss Original, reprint please indicate the source we all know that the JDK can not be downloaded directly through the wget. Cookies were originally needed, as follows: First, download
wget--no-check-certificate--no-cookie--header "Cookie:oraclelicense=accept-securebackup-cookie;" http:// download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.rpm
sudo rpm-ivh jdk-7u79-linux-x64.rpm



Now the download requirements have changed, in the original way has not. is to generate a parameter dynamically. Solution: Under the chrome, open the Developer tool (I use the Mac version), click on the need to download the package, see Console->logs will see a line of words: Resource interpreted as Document but transferred With MIME type Application/x-redhat-package-manager: "http://download.oracle.com/otn/java/jdk/7u80-b15/ jdk-7u80-linux-x64.rpm? Authparam=1461049990_341c3c217ccd4554c0a065149ff156c8 ". , so just use this directly.
Wget-o jdk-7u80-linux-x64.rpm http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.rpm? Authparam=1461049990_341c3c217ccd4554c0a065149ff156c8
2018, with the above method again. Back to the original approach:
Wget-o jdk-8u161-linux-x64.tar.gz--no-check-certificate--no-cookies--header "cookie:oraclelicense= Accept-securebackup-cookie "http://download.oracle.com/otn-pub/java/jdk/8u161-b12/ 2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz




Second, installation:
sudo rpm-ivh jdk-7u80-linux-x64.rpm installed, the default is installed in the/usr/java/jdk1.7.0_80 directory. So set java_home sudo vi/etc/profile
Export java_home=/usr/java/jdk1.7.0_80
Export classpath= $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JAVA _home/jre/lib/rt.jar
Source/etc/profile
third, testingMany of the Java veteran may not be able to successfully write the Java Helloword. Notice, not in Eclipse, nor ant, with the command line, package Oh, let's revisit it.

Package com.sss.test;
public class Testjava {public
    static void Main (string[] args) {
        System.out.println (' Hello World ');
    }



JAVAC-CP $CLASSPATH Com/sss/test/testjava.java-it's OK to do it without CLASSPATH. However, once another jar package is added, it is needed. ll com/sss/test/
You can see that the class file has generated $ java-cp $CLASSPATH Com/sss/test/testjava Error: Cannot find or Load main class Com.sss.test.TestJava $ export CLASSP Ath= $CLASSPATH:. JAVA-CP $CLASSPATH Com/sss/test/testjava Hello World Here's a note: the location where the command is executed, the parent directory of the COM directory, the Java or class file path is fully played.

Related Article

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.