MAC builds Java web development environment __web

Source: Internet
Author: User
Tags java web

New Start Mac Notebook, need to rebuild the Java development environment.

Environments that have been used before:

MyEclipse (with various plug-ins)

Weblogic

Oracle

This time on the Mac to build the environment:

Ecplise (website download, note that there are multiple versions, download the Eclipse IDE for Java EE Developers, if the Eclipse IDE for Java developers, you can not create a Web project, etc.)

Plug - ins

Tomcate

Mysql


Install Tomcate:

Configuring the Java_home:mac version configuration method

User root to create new. bash_profile--See another blog explaining MAC environment variables

Export java_home=$ (/usr/libexec/java_home)-Unlike the Windows version,/usr/libexec/java_home defines the true path of Java_home, which is installed by default, Of course, you can install it yourself.

. . bash_profile--"." is shorthand for the "source" command to load the contents of the. bash_profile file into memory (the configuration file is stored only on a physical disk for each load, and it must be in memory for the real effect)


Website download tomcate, recommend downloading Tomcate7, if tomcate8, must use JAVA7, otherwise will report "Unsupported Major.minor version 51.0" error

Unzip the tomgcate to any desired location

To assign a command to the Bin folder under Tomcate:

sudo chmod 777 *

Start Tomcate:

SH bin/startup.sh

To view the startup log:

TAIL-1000F Logs/catalina.out

Verify whether to start:

Browser input: http://localhost:8080

Stop tomcate:

SH bin/shutdown.sh


Set Tomcat Admin interface username and password

Tomcat7/conf/tomcat-users.xml:

<role rolename= "Manager-gui"/> <user username= "Tomcat" password= "Tomcat" roles= "Manager-gui"/>


Eclipse uses the Tomcate deployment program (which is not necessary, can be compiled by Eclipse Development, and put directly into Tomcat deployment, but not debug):

The properties configuration in the Mac version of Eclipse does not have the server option, and the way to configure Tomcate is to use Plug-ins:

Download Tomcat plugin: http://www.eclipsetotale.com/tomcatPlugin.html#A3

Extract into Eclipse's plugins directory, the menu bar will have 3 Tomcat control buttons after reboot, but the click will not use the error

Eclipse Configuration tomcate:

Tomcat Total configuration: Version selection 7.0,tomcat Home Select Tomcat installation directory that is Xxx/tomcat

Advanced: Select the Tomcat home path, tick the startup project, and make sure that there will be *.xml file generation after%tomcat%/conf/catalina/localhost

Start Tomcat through Eclipse:

Will extract the plugin after the com.sysdeo.eclipse.tomcat_3.3.0 directory of the Devloader.zip uncompressed, get the org file. Copy the resulting files to the Lib directory under the Tomcat installation directory by hitting the jar package (under the command line using JAR-CVF Devloader.jar *) Devloader.jar. Eclipse Click on the Kitten button Tomcat Start button to start Tomcat to your JEE program for breakpoint tracking debugging.

Click the Tomcat button on the menu bar, Tomcat starts normally, and opens the browser to the Tomcat main interface


The difference between Java Engineering and Web engineering:

MyEclipse You can choose Java Project when you create a new project, or you can choose Web project; But Eclipse has only Java project; What's the difference? How does eclipse create a new Web project?

To turn Java engineering into a Web project that Tomcat can deploy:

1. Create a new WebApp or any other folder with any name

2, the folder must contain the following child content

Web-inf

Classes

Lib

Xml

Web files such as HTML or JSP

3, the Java file compiled by the. class file under Web-inf/classes

4, all need to use the third party jar bag to put under web-inf/classes

5. Configure Web.xml

<?xml version= "1.0" encoding= "UTF-8"?> <web-app version=
"2.5" xmlns= "http://java.sun.com/xml/ns/" 
Java ee " 
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " 
xsi:schemalocation=" http://java.sun.com/ Xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ">
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

6. Copy WebApp to Tomcat's WebApps folder and change WebApp to program name, start tomcat OK

7, the browser input http://localhost:8080/program name, you can see HelloWorld


Reference Documentation:

1, "Java Engineering and Java Web Engineering differences" http://blog.csdn.net/qq635785620/article/details/7860822

2, "Integration of Tomcat plug-in to Eclipse process" http://blog.csdn.net/defonds/article/details/7845961

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.