二、下载并安装JDK

选择一个适合自己的JDK版本下载并安装即可,具体流程不详述。

二、环境变量配置

  1、右键桌面上“我的电脑”>>“属性”,在弹出的页面上点击“高级系统设置”。

2、在弹出的“系统属性”窗口中“高级”标签页下点击“环境变量”按钮。

3、在弹出的“环境变量”窗口中,点击下方的“新建”按钮,在弹出的“新建系统变量”窗口中,新建一个名为“JAVA_HOME”的环境变量,变量值为Java的安装路径,本人为:D:\project\tool\Java\jdk_9.0.1。如图所示。

 4、设置Path环境变量,该变量已经存在,所以在列表中选择Path,点击下方的“编辑”按钮,在弹出的窗口中添加如下信息:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin,然后点击“确认”按钮即可。如图所示:

 5、和JAVA_HOME一样,新建一个名为“classpath”的环境变量,变量值为:%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar。如图所示:

  6、在配置好环境变量后,可以进入cmd中检查Java是否安装正确,检查的命令为 java -version,如图所示:

Windows下如何配置tomcat环境变量

 

Apache Tomcat 是一款 Java Servlet 和 JavaServer Pages 技术的开源软件实现,可以作为测试 Servlet 的独立服务器,而且可以集成到 Apache Web 服务器。下面是在电脑上安装 Tomcat 的步骤:

一、工具:

  1. 在配置tomcat之前需要配置好JDK的环境 。JDK配置可以参照博文《Windows环境下JDK安装与环境变量配置
  2. Tomcat 安装包。我这里选择的是 Tomcat 7  : apache-tomcat-7.0.57-windows-x64.zip

二、配置:

从 http://tomcat.apache.org/ 上下载最新版本的 Tomcat。例如,如果您使用的是 Windows,则解压缩到 D:\apache-tomcat-7.0.57 中,如果您使用的是 Linux/Unix,则解压缩到 /usr/local/ apache-tomcat-7.0.57 中,并创建 CATALINA_HOME 环境变量指向这些位置。直接解压就可以用了。

环境配置:

1,新建变量名:CATALINA_BASE,变量值:D:\apache-tomcat-7.0.57

2,新建变量名:CATALINA_HOME,变量值:D:\apache-tomcat-7.0.57

3,打开PATH,添加变量值:;%CATALINA_HOME%\lib;%CATALINA_HOME%\bin

三、启动Tomcat:

方式1:直接进入目录方式。

进入bin目录下:启动双击 startup.bat 启动。 在浏览器输入:http://localhost:8080/

(1)没有开启服务之前,不能访问。

配置MAVEN

Maven的下载
在Maven的官网即可下载,点击访问Apache Maven。

https://maven.apache.org/download.cgi
下载后解压即可,解压后目录结构如下:

Maven常用配置
在配置之前请将JDK安装好。

1. 环境变量配置
添加M2_HOME:对应Maven的解压目录即可。

编辑Path环境变量:

测试,在cmd窗口输入mvn -v查看
显示如下即配置成功:

2. 修改配置文件
通常我们需要修改解压目录下conf/settings.xml文件,这样可以更好的适合我们的使用。

此处注意:所有的修改一定要在注释标签外面,不然修改无效。Maven很多标签都是给的例子,都是注释掉的。
文章最后附上我的整个Settings.xml文件配置。

1. 本地仓库位置修改
在<localRepository>标签内添加自己的本地位置路径

<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\tools\repository</localRepository>

2. 修改maven默认的JDK版本
在<profiles>标签下添加一个<profile>标签,修改maven默认的JDK版本。

<profile>
<id>JDK-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>

3. 添加国内镜像源
添加<mirrors>标签下<mirror>,添加国内镜像源,这样下载jar包速度很快。默认的中央仓库有时候甚至连接不通。一般使用阿里云镜像库即可。这里我就都加上了,Maven会默认从这几个开始下载,没有的话就会去中央仓库了。

<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>

<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>

<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>

常用IDE下配置Maven
目前常用的开发工具如idea,eclipse都自身集成了一个版本的Maven。但是通常我们使用自己已经配置好的Maven。

IDEA下配置Maven

1:此处修改为自己解压的Maven目录

2:勾选Override,修改为自己目录下的settings.xml目录

3:修改为自己的本地仓库地址,一般会自动识别。

此处勾选,当修改pom文件时,Maven就能帮我们自动导包了。

Eclipse下配置Maven
将eclipse使用的Maven修改为自己的。点击add后选择自己Maven的安装目录即可。添加好之后记得勾选。

将所有的settings修改为自己Maven目录下的conf/settings.xml.点击Update Settings按钮,下面的Local Respository会自动识别出来。

附:完整的Settings.xml文件
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.conf}/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -gs /path/to/global/settings.xml
|
| The sections in this sample file are intended to give you a running start at
| getting the most out of your Maven installation. Where appropriate, the default
| values (values used when the setting is not specified) are provided.
|
|-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\tools\repository</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->

<!-- offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
-->

<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>

<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>

<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->

<!-- Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
</servers>

<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>

<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>

<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>

<!-- profiles
| This is a list of profiles which can be activated in a variety of ways, and which can modify
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
| specific paths and repository locations which allow the build to work in the local environment.
|
| For example, if you have an integration testing plugin - like cactus - that needs to know where
| your Tomcat instance is installed, you can provide a variable here such that the variable is
| dereferenced during the build process to configure the cactus plugin.
|
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
| section of this document (settings.xml) - will be discussed later. Another way essentially
| relies on the detection of a system property, either matching a particular value for the property,
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
| Finally, the list of active profiles can be specified directly from the command line.
|
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
| repositories, plugin repositories, and free-form properties to be used as configuration
| variables for plugins in the POM.
|
|-->
<profiles>
<!-- profile
| Specifies a set of introductions to the build process, to be activated using one or more of the
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
| or the command line, profiles have to have an ID that is unique.
|
| An encouraged best practice for profile identification is to use a consistent naming convention
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
| This will make it more intuitive to understand what the set of introduced profiles is attempting
| to accomplish, particularly when you only have a list of profile id's for debug.
|
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
<profile>
<id>jdk-1.4</id>

<activation>
<jdk>1.4</jdk>
</activation>

<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
-->

<!--
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
| might hypothetically look like:
|
| ...
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
| ...
|
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
| anything, you could just leave off the <value/> inside the activation-property.
|
<profile>
<id>env-dev</id>

<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>

<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
-->
<profile>
<id>JDK-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>

<!-- activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
-->
</settings>

配置教程-jdk-tomcat-maven的更多相关文章

  1. 初次配置eclipse, jdk, tomcat, maven, mysql, alt+/

    eclipse 官网下载eclipse-inst-win64.exe, 选择安装java ee. jdk 官网下载jdk-8u102-windows-x64.exe, next到底. 接下来配置环境变 ...

  2. mac系统Intellij Idea的java环境配置:JDK + Tomcat + Maven

    一.JAVA JDK查看与配置 1.查看java路径详细信息: /usr/libexec/java_home -V 2.java默认路径 jdk1.6: /System/Library/Java/Ja ...

  3. 15.Intellij中配置jdk/tomcat/maven

    转自:https://blog.csdn.net/u010414666/article/details/44465905 继上一篇安装好了Intellij之后,我们可以对Intellij,做一些简单的 ...

  4. Java开发环境配置(JDK+Tomcat+MyEclipsed)

    前言 这个项目一开始,我只能说我把自己整的很无语,所以我只能在调整心态的基础上,重新把思路缕了一遍,好了,接下来就说java运行环境以及发布运行方法还有SSH环境配置. 内容 本次配置用到的安装包: ...

  5. JDK TOMCAT MAVEN在myeclipse如何配置

    对于没有基础的人来说,本工具务必放在D盘根目录下. 1配置环境变量, "我的电脑-->右键-->属性" 貌似是这样吧,我电脑桌面没"我的电脑"或&q ...

  6. 在ubuntu 12.04 中配置java环境(安装jdk, tomcat, maven, eclipse)

    1. 安装jdk 1.7 在ubuntu( /usr/lib/jvm/java-7-openjdk-amd64 )中默认有安装jdk 1.7 如果没有 可下载 : http://www.oracle. ...

  7. IntelliJ IDEA 2017 JDK Tomcat Maven 配置步骤详解(一)

    要求   配置 Java基础环境(实际上应该在虚拟机linux环境下 安装CentOS 7,但是我这电脑实在承受不住了) 安装 开发工具 IntelliJ IDEA 2017.1 第一部分: JDK ...

  8. windows下安装jdk+tomcat+maven并配置

    一.下载安装jdk并配置 1.1 进行JDK下载 下载地址:一键直达 一般下载后,安装位置默认,一路下一步,一直到安装完毕-"关闭". 1.2 环境变量配置 不要管是不是一般情况, ...

  9. Java(JDK/Tomcat/Maven)运行环境配置及工具(idea/eclipse)安装

    Java (计算机编程语言) Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承.指针等概念,因此Java语言具有功能强大和简单易用两个特征. Java语 ...

  10. Java Web开发环境配置(JDK+Tomcat++IDEA 14)

    对于未接触过java web开发的大家而言,应该和我一样对java web编程开发比较迷茫,通过查一些资料,大致清楚了java web开发环境的一些基本配置,未做过相关编程的人员可以看一看,由于我刚接 ...

随机推荐

  1. 制作并量化GGUF模型上传到HuggingFace和ModelScope

    llama.cpp 是 Ollama.LMStudio 和其他很多热门项目的底层实现,也是 GPUStack 所支持的推理引擎之一,它提供了 GGUF 模型文件格式.GGUF (General Gau ...

  2. Mysql篇-Buffer Pool中的三大链表

    为什么要有 Buffer Pool? 虽然说 MySQL 的数据是存储在磁盘里的,但是也不能每次都从磁盘里面读取数据,这样性能是极差的. 要想提升查询性能,那就加个缓存.所以,当数据从磁盘中取出后,缓 ...

  3. Python之JSON用法解析

    前景 Python编写HDFS服务安装的过程中,需要将构建好的JSON对象输出到文件,采用那种方式更便捷 方案1 open 函数 def writeExecCmdCheckActionsFile(se ...

  4. Stratum挖矿协议&XMR挖矿流量分析

    目录 前言 区块链和挖矿相关概念 挖矿木马 挖矿协议Stratum Stratum工作过程 XMR挖矿流量分析 环境搭建 流量分析 总结 前言 之前参与了一个关于"挖矿行为检测"的 ...

  5. 读书笔记-C#8.0本质论-03

    15. 委托和lambda表达式 15.1 委托概述 namespace ConsoleApp1; internal static class Program { private enum SortT ...

  6. x-easypdf 初始

    一.概述 一个 java 语言简化处理 pdf 的框架 项目主页 https://x-easypdf.cn 项目概述 x-easypdf是一个java语言简化处理pdf的框架,包含fop模块与pdfb ...

  7. Git学习【1】 -- 基本常用命令

    目录 1.设置用户名 2.设置用户邮箱 3.初始化文件夹 4.如何修改文件 5.如何删除文件 6. 远程github操作 7. 设置密码 安装完Git,如何玩呢?下面是一些初始化和初级的常用命令. 新 ...

  8. ZCMU-1129

    数学公式题罢了 学长 1.斯特灵公式: 2.对数公式(因为以10为底,得到的是10^x,所以最后向下取整加上1): #include<cstdio> #include<cmath&g ...

  9. 怎么实时更新echarts图标数据?

    function getData(){ var request . nem XPHLHttpRequest () ; request . open("get",'http://lo ...

  10. 在 VS Code 中可以免费使用 GitHub Copilot了!

    今天,有一个重大的好消息要分享给大家: 从现在开始,我们可以在 Visual Studio Code 中,免费使用强大的 GitHub Copilot 进行开发啦! 每个人都可以享受到 AI 加持下的 ...