Install JDK1.7 on Ubuntu14.0464. 1. Create a folder linuxidc @ linuxidc :~ $ Sudomkdir/usr/lib/jvm2 unzip the linuxidc file @ linuxidc :~ $Sudotarzxvfjdk-7u71-linux-x64.tar.gz-C/usr/lib/jvm3 open the set environment variable file linuxidc @ lin
Install JDK1.7 on Ubuntu14.04 64-bit.
1. Create a folder
Linuxidc @ linuxidc :~ $ Sudo mkdir/usr/lib/jvm
2. decompress the file
Linuxidc @ linuxidc :~ $ Sudo tarzxvf jdk-7u71-linux-x64.tar.gz-C/usr/lib/jvm
3. Open the environment variable file.
Linuxidc @ linuxidc :~ $ Sudo gedit/etc/profile
[Sudo] password for linuxidc:
(Gedit: 6266): IBUS-WARNING **: The owner of/home/linuxidc/. config/ibus/bus is not root!
(Gedit: 6266): Gtk-WARNING **: Calling Inhibit failed: grule. error: org. freedesktop. invalid. error. serviceUnknown: The name org. gnome. sessionManager was not provided by any. service files
(Gedit: 6266): Gtk-WARNING **: Calling Inhibit failed: grule. error: org. freedesktop. invalid. error. serviceUnknown: The name org. gnome. sessionManager was not provided by any. service files
4. Set Environment Variables
# Set java environment
Export JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 71
Export JRE_HOME =$ {JAVA_HOME}/jre
Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib
Export PATH =$ {JAVA_HOME}/bin: $ PATH
5. Set the default JDK
Linuxidc @ linuxidc :~ $ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7.0 _ 71/bin/java 300
Update-alternatives: using/usr/lib/jvm/jdk1.7.0 _ 71/bin/java to provide/usr/bin/java (java) in automatic mode
Linuxidc @ linuxidc-ThinkPad-Edge-E545 :~ $ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/jdk1.7.0 _ 71/bin/javac 300
Update-alternatives: using/usr/lib/jvm/jdk1.7.0 _ 71/bin/javac to provide/usr/bin/javac (javac) in automatic mode
6. Check whether JDK is successfully installed.
(1) java-version
Linuxidc @ linuxidc :~ $ Java-version
Java version "1.7.0 _ 71"
Java (TM) SE Runtime Environment (build 1.7.0 _ 71-b14)
Java HotSpot (TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Linuxidc @ linuxidc :~ $
(2) java
Linuxidc @ linuxidc :~ $ Java
Usage: java [-options] class [args...]
(Execution class)
Or java [-options]-jar jarfile [args...]
(Execute the jar file)
The options include:
-D32 uses a 32-bit data model (if available)
-D64 uses a 64-bit data model (if available)
-Server: Select "server" VM
The default VM is server,
Because you are running on a server computer.
-Cp <目录和 zip jar 文件的类搜索路径>
-Classpath <目录和 zip jar 文件的类搜索路径>
Separated directories and JAR files
And ZIP file list, used to search for class files.
-D <名称> = <值>
Set System Properties
-Verbose: [class | gc | jni]
Enable detailed output
-Version: output the product version and exit.
-Version: <值>
The specified version is required for running.
-Showversion: output the product version and continue
-Jre-restrict-search |-no-jre-restrict-search
Include/exclude user-specific JRE in version search
-? -Help: output the help message.
-X outputs help for non-standard options
-Ea [: ... |: ]
-Enableassertions [: ... |: ]
Enable assertions at the specified Granularity
-Da [: ... |: ]
-Disableassertions [: ... |: ]
Disable assertions with a specified Granularity
-Esa |-enablesystemassertions
Enable System assertions
-Dsa |-disablesystemassertions
Disable system assertions
-Agentlib: [= <选项> ]
Load local proxy Library For example,-agentlib: hprof
For more information, see-agentlib: jdwp = help and-agentlib: hprof = help.
-Agentpath: [= <选项> ]
Load the local proxy library by full path name
-Javaagent: [= <选项> ]
For more information about how to load Java programming language proxies, see java. lang. instrument.
-Splash:
Use the specified image to display the startup Screen
For more information, see http://www.oracle.com/technetwork/java/javase/documentation/index.html.
Linuxidc @ linuxidc :~ $
(3) javac
Linuxidc @ linuxidc :~ $ Javac
Usage: javac
Possible options include:
-G generates all debugging information
-G: none does not generate any debugging information
-G: {lines, vars, source} only generates some debugging information
-Nowarn does not generate any warning
-Verbose outputs messages about the operations being performed by the compiler.
-Deprecation: output the source location of an outdated API
-Classpath <路径> Specifies the location for searching user-class files and annotation handlers
-Cp <路径> Specifies the location for searching user-class files and annotation handlers
-Sourcepath <路径> Specifies the location of the Input Source file to be searched.
-Bootclasspath <路径> Overwrite the location of the bootstrap File
-Extdirs <目录> Overwrite the location of the installed Extension
-Endorseddirs <目录> Location that overwrites the standard path of the signature
-Proc: {none, only} controls whether to perform annotation processing and/or compilation.
-Processor [, , ...] Name of the annotation handler to run; bypassing the default search process
-Processorpath <路径> Location of the comment Handler
-D <目录> Location of the generated class file
-S <目录> Location of the generated source file
-Implicit: {none, class} specifies whether to generate class files for implicitly referenced files
-Encoding <编码> Specifies the character encoding used by the source file.
-Source <发行版> Provides source compatibility with the specified release
-Target <发行版> Generate class files for specific VM versions
-Version Information
-Help: output the summary of standard options.
-Option for passing the keyword [= value] To the annotation Handler
-X outputs a feed of non-standard options
-J <标记> Directly change <标记> Passed to the runtime system
-Terminate Compilation When Werror is warned
@ <文件名> Read from file option and file name
Install JDK 7 (with Clojure download) http://www.linuxidc.com/Linux/2012-10/71557.htm under Ubuntu
Install JDK1.7 http://www.linuxidc.com/Linux/2012-06/62239.htm in Ubuntu 12.04
CentOS6.3 install JDK and environment configuration http://www.linuxidc.com/Linux/2012-09/70780.htm
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-01/111102.htm