[Original] configuration of multi-version Java environment variables

Source: Internet
Author: User
Tags tomcat server

Cause: Accidental sudden interest, clean up their old T500 computer, used to make a home development machine.

There should be a ghost backup habit for every system, so you need to build your development environment in advance. And one of the purposes of the newly installed system is to study the problem of andriod development, so the configuration of the Java environment is started.

Problem: The operating system is 64-bit, the database software is also 64-bit, the development of the JSP program also uses the 64-bit Java JDK; However, when developing the Andriod program, the Java JDK 6.0 version is required for Andriod 4.4, and preferably 32-bit (the client is not necessarily 64-bit, for compatibility with the 32-bit version of the JDK). This creates a 32-bit JDK, 64-bit JJDK version of the problem, the configuration environment variables can not copy the online process.

========================================

First, hardware upgrade:

CPU: Replace the two Daicouri T9900.

Memory: Upgrade Samsung 8GB memory.

HDD: Replace the 160Gb Intel (G3) solid state Drive.

Video card: A treasure of the IBM Dock 2503, and purchased a shadow of the HD 7750 2G Blade version of the video card, the rest is endless pain ...   (Because the knife version of the graphics card length and thickness are not appropriate, take the blade to cut the heat sink, take the blades to the bottom of the dock plastic layer of a layer of grinding thin, and then put the graphics card with iron pads up, only to be a toss-up video card ...  This does not count, the first to buy a R7 350 graphics card, for several days after the test found that the power consumption exceeds the allowable range of the dock, a copy of the machine on the restart ..., and finally bought the HD 7750 ... Toss for several days)

Second, software upgrade:

Os:windows Enterprise X64 1607 中文版

Vs:visual Stuodio 2015

...... And so on coherent software

Third, the installation environment process ..... (Not table) ...

Iv. Configuring Java Environment variables

4.1 New environment variable java_bit_x64 with a value of (no quotation marks below): "C:\Program files\java\jdk1.8"

New environment variable java_bit_x86, whose value is: "C:\Program Files (x86) \java\jdk1.6"

New environment variable Java_home, whose value is: "%java_bit_x64%"

4.2 Create a new environment variable classpath with the value: ".; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar "

Modify the environment variable path (NOTE: Do not delete path original content), add at the front of its value: "%java_home%\bin\;%java_home%\jre\jbin\;" , followed by the original content.

Note: If it is Win10, modify the PATH environment variable, has been modified through the interface, directly add "%java_home%\bin\" and "%java_home%\jre\bin\" two things, and remember to move to the front.

This: When developing the Andriod application, change the value of the JAVA_HOME environment variable to: "%java_bit_x86%", and when developing the JSP program, change the Java_home to: "%java_bit_x64%".

( Note: At the beginning of the new environment variable java_ver, but later to consider this switch is more than a modified place, so it was removed.)

4.3 Testing the Java environment: in the cmd window, enter (without quotation marks): "Java-version", the interpreter version number appears.

In the cmd window, enter (without quotation marks): "Javac-version", the compiler version number appears.

Legend, I will not paste, the Internet is everywhere ....

V. Configuring the TOMCAT environment variable (unzip Tomcat 8.0.37 to C-drive)

5.1 New environment variable catalina_home with a value of (no quotation marks below): "C:\Program files\apache-tomcat-8.0.37"

5.2 Modify the environment variable path (NOTE: Do not delete path original content), add in front of its value: "%catalina_home%\lib\;", followed by the original content. Or at the end of the add: ";%catalina_home%\lib\", Win10 is also added in the form of an interface: "%catalina_home%\lib\"

Modify the environment variable classpath, adding after its value: ";%catalinna_home%\lib\servlet-api.jar;%catalina_home%\lib\jsp-api.jar"

5.3 Run the Startup.bat in the Bin folder under the Tomcat directory, if the previous Java_home variable is set, a DOS window will pop up showing some information similar to "Server startup in 768 MS". This illustrates the success of Tomcat launch;

At this point, enter in the browser: http://localhost:8080/will enter a Tomcat management interface to further verify the success of the installation;

5.4 Modify the relevant configuration (some XML files in the Conf folder under Tomcat):

5.4.1 Modify the Server.xml to resolve the HTTP GET method to pass the Chinese parameter garbled problem: Open the Server.xml file, find <connector port= "8080" ....> node, At the end of the node, add the attribute uriencoding= "UTF-8" and Change to:

<connector port= "8080"

Protocol= "http/1.1"

connectiontimeout= "20000"

Redirectport= "8443"

uriencoding= "UTF-8"/>

5.4.2 Modify Context.xml: Change the <Context> node to <context reloadable= "true" >. The purpose is that the Tomcat server will automatically reload the current web app and avoid restarting Tomcat when the file or Web. xml file is modified. Note: This modification will have a slight impact on Tomcat performance, but it is useful for the development phase, but if Tomcat is used as the server for the release phase of the product, it is best to modify the <context reloadable= "false" >

5.4.3 Modify Tomcat-users.xml: Add an element in it, such as: <user username= "Lzy" password= "Lzy" roles= "Admin,manager"/> Represents the user name, password, and user type for Tomcat management, which can be set by itself. When you are done, enter http://localhost:8080/, click the Tomcat Magager in administration, enter your username and password, and if you set it up, you can go to the Administration page.

Note: When you access the Tomcat administration page, you must first start the Tomcat service. If clicking Startup.bat fails to start, it may be because the Tomcat run window is shut down without Shutdown.bat to close Tomcat, and once the Shutdown.bat is executed, Startup.bat is executed again.

If you modify the XML file with Notepad, it is best to save it in utf-8 format.

For example:

<!--

<role rolename= "Tomcat"/>

<role rolename= "Role1"/>

<user username= "Tomcat" password= "Tomcat" roles= "Tomcat"/>

<user username= "Both" password= "Tomcat" roles= "Tomcat,role1"/>

<user username= "Role1" password= "Tomcat" roles= "Role1"/>

-

In the above paragraph, add the following:

<role rolename= "Manager-gui"/>

<role rolename= "Admin-gui"/>

<user username= "admin" password= "admin" roles= "Admin-gui,manager-gui"/>

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

To this we should know the username and password of the administrator we added is the number of it!

At this point, you can open your browser (http://localhost:8080) and click the "Server status" or "Manager App" button on the right side of the page to log in with your Tomcat account name to view service status information.

You can also click on the "Host Manager" button on the right to view the host information via the admin account.

VI. Configuring the development environment: Unzip the eclipse with Java EE to C drive and start Eclipse.

6.1 Optimizing Eclipse Performance Configuration parameters:

-startup

Plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444

-product

Org.eclipse.epp.package.jee.product

--launcher.defaultaction

OpenFile

-showsplash

Org.eclipse.platform

--launcher. Xxmaxpermsize
256m
--launcher.defaultaction

OpenFile

--launcher.appendvmargs

-vmargs

-dosgi.requiredjavaversion=1.8

-xx:+useg1gc

-xx:+usestringdeduplication

-dosgi.requiredjavaversion=1.8

-xms256m

-xmx2048m
-xx:newsize=768m
-xx:maxnewsize=768m
-xx:permsize=256m
-xx:maxpermsize=256m
-xx:+disableexplicitgc
-xx:compilethreshold=100
-xx:+userparnewgc
-xx:+userconcmarksweepgc
-xx:cmsinitiatingoccupancyfraction=80

6.2 Configuring the Tomcat server in eclipse: To run the JSP in Eclipse, you need to run the corresponding server, so you need to bind eclipse and Tomcat.

6.2.1 Configuring Eclipse Default JRE: (the default JRE for Eclipse is preconfigured here for the convenience of switching JRE environments in the future)

Open Eclipse, click Windows---Preferences window, then click Java-Installed JREs.

After you click Add, after selecting the standard VM, select the JRE home directory (C:\Program Files (x86) \java\jdk1.6), and then save and exit when you are finished.

6.2.2 Configure the Tomcat server: Open Eclipse, click Windows---Preferences window, then click on the right side of server-Runtime environments.

After clicking Add, after selecting the Tomcat version, go to the Tomcat directory and the JRE version selection and exit when you are finished.

6.2.3 Installing the Tomcat plugin and debugging: After downloading the tomcatPluginV3.3.6.1 plugin and extracting it, copy it to the plugins directory in the Eclipse directory and restart Eclipse, if you see the Tomcat icon on the menu bar, the installation is correct.

Click on the "Windows-Preferences" window, then click on the Java---Tomcat, on the right to tick version 8.x and select the Tomcat home directory, click OK.

After extracting the net.sf.eclipse.tomcat_3.3.6.1, locate the directory in the Devloader.zip again to extract the Org file. Then at the command line, the CD command switches to the Org folder, executes "JAR-CVF Devloader.jar *" (without quotation marks), and the resulting Devloader.jar file is copied to the Lib directory in the Tomcat installation directory. After that, you can click the Kitten button on Eclipse to start and track the Java EE program.

Note: The installation process can also be performed in the following way, using the local installation files to perform the installation, referring to the procedure below.

6.3 Configure SVN in eclipse: After downloading Subclipse-4.2.0.zip, open Eclipse,.

Click Help, Install New softwares ... , then click Add ..., in the pop-up window, click on the archive ... Select the Local installation package (install from local file, remember to cancel the "contact all update sites during install to find required software" option to speed up the installation. Alternatively, you can also cancel the "Show only The latest versions of available sofware "To install the specified version of the plug-in), and then all the way next to complete the installation.

At this point, Java EE IDE environment is configured okey.

[Original] configuration of multi-version Java environment variables

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.