zoukankan      html  css  js  c++  java
  • rails 安装路径

    ~/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9/gems/rails-3.0.1/bin

    java home enviroment set

    http://confluence.atlassian.com/display/JIRA/Installing+Java+on+Ubuntu+or+Debian

    Installing Java on Ubuntu or Debian

    Some linux distributions (notably Debian and Ubuntu) come with a free version of Java called GIJ (from the GCJ project) pre-installed:

    jturner:~$ java -version
    java version "1.4.2"
    gij (GNU libgcj) version 4.1.2 (Ubuntu 4.1.2-0ubuntu5)
    
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    jturner:~$ 
    

    Unfortunately GCJ is incomplete, and unable to run Atlassian Java applications without problems.

    The solution is to install Sun's version of Java:

    jturner:~$ sudo apt-get install sun-java6-jdk 
    Password:
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      java-common libltdl3 odbcinst1debian1 sun-java6-bin sun-java6-jre unixodbc
    Suggested packages:
      equivs sun-java6-demo sun-java6-doc sun-java6-source sun-java6-plugin ia32-sun-java6-plugin sun-java6-fonts
      ttf-sazanami-gothic ttf-sazanami-mincho libmyodbc odbc-postgresql libct1
    Recommended packages:
      gsfonts-x11
    The following NEW packages will be installed:
      java-common libltdl3 odbcinst1debian1 sun-java6-bin sun-java6-jdk sun-java6-jre unixodbc
    0 upgraded, 7 newly installed, 0 to remove and 3 not upgraded.
    Need to get 42.6MB of archives.
    After unpacking 127MB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    
    ....
    
    Setting up java-common (0.25ubuntu2) ...
    
    Setting up libltdl3 (1.5.22-4) ...
    
    Setting up odbcinst1debian1 (2.2.11-13) ...
    
    Setting up unixodbc (2.2.11-13) ...
    
    Setting up sun-java6-bin (6-00-2ubuntu2) ...
    
    Setting up sun-java6-jre (6-00-2ubuntu2) ...
    
    Setting up sun-java6-jdk (6-00-2ubuntu2) ...
    
    jturner:~$
    

    After doing this, make sure the correct version of Java is in use by running java -version:

    jturner:~$ java -version
    java version "1.6.0"
    Java(TM) SE Runtime Environment (build 1.6.0-b105)
    Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
    jturner:~$ 
    

    If the GCJ Java is still being used, you will need to explicitly set Sun's Java as the default:

    jturner:~$ sudo update-alternatives --config java
    
    There are 2 alternatives which provide `java'.
    
      Selection    Alternative
    -----------------------------------------------
    *         1    /usr/bin/gij-wrapper-4.1
     +        2    /usr/lib/jvm/java-6-sun/jre/bin/java
    
    Press enter to keep the default[*], or type selection number: 2
    Using `/usr/lib/jvm/java-6-sun/jre/bin/java' to provide `java'.
    jturner:~$ 
    

    Setting JAVA_HOME

    Some programs like Tomcat (bundled with most Atlassian products) need a JAVA_HOME variable set, so they know where Java is installed. This can be set system-wide in /etc/profile:

    jturner:~$ sudo su -
    Password:
    root:~# cat >> /etc/profile
    JAVA_HOME=/usr/lib/jvm/java-6-sun
    export JAVA_HOME
    root:~# 
    

    The variable will be set for new terminals:

    jturner:~$ echo $JAVA_HOME
    /usr/lib/jvm/java-6-sun
    jturner:~$
    
     

    Ubuntu Linux Install Sun Java Development Kit ( JDK ) and Java Runtime Environment ( JRE )

    by VIVEK GITE on FEBRUARY 2, 2008 · 90 COMMENTS

    Q. How do I install Sun Java Development Kit (JDK) and Java Runtime Environment (JRE) under Ubuntu Linux? It appears that there are multiple JRE installed by default under Ubuntu. How do I select and use Sun JRE only? Can you explain steps required to set the environment to run java programs or apps?
     
    A. Ubuntu Linux 7.10 has following packages from Sun:
    => sun-java6-bin : Sun Java Runtime Environment (JRE) 6

    => sun-java6-demo : Sun Java Development Kit (JDK) 6 demos

    => sun-java6-jdk : Sun Java Development Kit (JDK) 6

    => sun-java6-jre : Sun Java Runtime Environment (JRE) 6

    Install Sun Java 6

    To install proprietary Java, you must have the Multiverse repository enabled. Click on System > Administration > Software Source > Select Multisource > Close
    Adding the Universe and Multiverse Repositories

    Open a shell prompt (terminal) and type the following to install JDK and JRE:
    $ sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

    Setup the default Java version

    Ubuntu Linux comes with update-java-alternatives utility to updates all alternatives belonging to one runtime or development kit for the Java language. To select, Sun's JVM as provided in Ubuntu 7.10, enter:
    $ sudo update-java-alternatives -s java-6-sun
    You also need to edit a file called /etc/jvm. This file defines the default system JVM search order. Each JVM should list their JAVA_HOME compatible directory in this file. The default system JVM is the first one available from top to bottom. Open /etc/jvm
    $ sudo vi /etc/jvm
    Make sure /usr/lib/jvm/java-6-sun is added to the top of JVM list
    /usr/lib/jvm/java-6-sun
    At the end your file should read as follows:
    /usr/lib/jvm/java-6-sun
    /usr/lib/jvm/java-gcj
    /usr/lib/jvm/ia32-java-1.5.0-sun
    /usr/lib/jvm/java-1.5.0-sun
    /usr

    Save and close the file.

    Setup the environment variable

    You also need to setup JAVA_HOME and PATH variable. Open your $HOME/.bash_profile or /etc/profile (system wide) configuration. Open your .bash_profile file:
    $ vi $HOME/.bash_profile
    Append following line:
    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    export PATH=$PATH:$JAVA_HOME/bin

    Save and close the file.

    Test your new JDK

    Type the following command to display version:
    $ java -version
    Output:

    java version "1.6.0_03"
    Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
    Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode) 

    Try HelloWorld.java - first java program

    $ vi HelloWorld.java
    Append code:

    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello, World!");
        }
    }

    Save and close the file. Compile HelloWorld.java and execute program by typing following two instructions:
    $ javac HelloWorld.java
    $ java HelloWorld

    Output:

    Hello, World!

    Further readings:

    • Official Sun Java tutorial - The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into "trails".
    • man pages java, javac

    Featured Articles:

    { 90 comments… read them below or add one }

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    reference:http://www.cyberciti.biz/faq/howto-ubuntu-linux-install-configure-jdk-jre/

  • 相关阅读:
    一个疑难杂症 IIS URL区分大小写(FF的自动变换URL问题)?
    炉石传说 C# 设计文档(序)
    炉石传说 C# 开发笔记(BS上线尝试)
    炉石传说 C# 开发笔记(BS模式Demo)
    炉石传说 C# 开发笔记(6月底小结)
    炉石传说 C# 开发笔记 (初版)
    使用python+requests实现接口自动化测试
    SpringMVC之数据传递二
    SpringMVC之数据传递一
    SpringMVC之HandlerMapping的使用
  • 原文地址:https://www.cnblogs.com/lexus/p/1865675.html
Copyright © 2011-2022 走看看