MAC OS JAVA Development Environment Configuration Brief

Source: Internet
Author: User
Tags java se

The original source of this article: http://blog.csdn.NET/johnstrive/article/details/7791451

1.Mac comes with jdk1.6 (my machine is such as the new MAC comes with the version is not clear)

    • First download jdk1.7
    • Download the dedicated Mac version of the jdk1.7, the address is as follows: http://jdk7.java.net/macportpreview/, there is the latest version (but still beta), version update frequency every two weeks will probably release a build, I installed the version is b223 (update, the latest version is b227, it is not openjdk).
    • Next, double-click on the DMG to open, and then simply a drag and drop (this will not nonsense, will not drag the wall).
    • Change the JVM preference order, search in Spotlight [Java Preferences] (Chinese version should be Java Preferences?). ), you should be able to see a few virtual machines already there, drag Java SE 7 to the top, you can (for example, I dragged the 64-bit version).
    • Confirm the version that Java is using: Open a terminal, enter Java-version, and confirm that the JVM version number is jdk1.7.0.

2. Configure Java_home

    • Setting java_home environment variables in Mac
    • Environment variables to be configured in the profile file under the ETC directory, this is the permanent configuration.
    • Cd/etc
    • VI Profile
    • Press the I key to enter write mode

      Enter the following content:

      Java_home=/library/java/javavirtualmachines/1.7.0.jdk/contents/home
      Export Java_home

      Press ESC to exit write mode when you are finished writing

      command [: wq!] Force save to exit

3. Install Eclipse or MyEclipse

    • Here is the download installation eclipse is free to download and unzip can be used. There's nothing to say.
    • As for MyEclipse, it's not good. Address: http://pan.baidu.com/share/link?shareid=3668676447&uk=3580314255
    • As for activating people to solve their own on-line PJ method

4. Modify the default JRE for Eclipse

    • Open Preferences->java->installed JREs, see the right side of the JRE list, if you already use the default jdk1.6, click Add, select MacOS X VM, in the path to the location of the jdk7 to point to the installation.
    • If you can't find the place where the damn jdk1.7 is installed, consider sticking to this address (this is the location of my system, I guess everyone should be about the same). /library/java/javavirtualmachines/1.7.0.jdk/contents/home

5. Install Tomcat

  • Download the latest Tomcat binary code package on the Apache website: (Be careful not to download the installation package for Windows) http://tomcat.apache.org/
  • When you're done downloading, unzip and name the folder Tomcat
    Move the renamed folder to the root directory/library (available elsewhere), and the installation process is complete.
    Perform/library/tomcat/bin under Startup.sh, and then open http://localhost:8080 to see if Tomcat is started, to stop the server running in the same directory as the shutdown.sh
    If you encounter problems such as the inability to find directories and file places, it is generally because the file permissions are causing problems that you can resolve:
  • sudo chmod 755/library/tomcat/bin/*.sh
    sudo chmod 755/library/tomcat/bin/*.bat
  • Meet "Java_home not defined" JAVA path undefined error, execute the following command in Terminal:

    sudo setenv java_home/library/java/home
  • To configure the Tomcat startup script:

    Use the text editor to add the following code:

    #!/bin/bash

    Case $ in
    Start
    sh/library/tomcat/bin/startup.sh
    ;;
    Stop
    sh/library/tomcat/bin/shutdown.sh
    ;;
    Restart
    sh/library/tomcat/bin/shutdown.sh
    sh/library/tomcat/bin/startup.sh
    ;;
    *)
    echo "Usage:start|stop|restart"
    ;;
    Esac

    Exit 0
    • Save the file as Tomcat, lowercase with no suffix. Place this file in the path contained in the terminal, such as/usr/bin, and then simply enter Tomcat start and Tomcat stop in the terminal to enable Tomcat.
    • The installation process may appear with the following error:Startup.sh:command not found. command before adding bash or sh or.

      Represents the current directory, if the executing program or script does not join the environment variable path, precede the current directory with "./"

      Executing the TOMCAT command in terminal will prompt permission denied.
      Need to empower. sudo chmod 755/usr/bin/tomcat

MAC OS JAVA Development Environment Configuration Brief

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.