开发工具及环境配置

一、jdk下载、安装与环境变量配置

1、下载

(1)打开下载网址Java Downloads | Oracle或直接搜索Oracle JDK下载

(2)根据电脑系统(win/linux等)选择需要的JDK系统版本

(3)选择需要的JDK

2、windows安装及环境变量配置

(1)安装

直接解压zip文件到需要的目录下如D:\dev\java

改名为jdk-17

(这里下载的版本为jdk-17.0.2)

(2)环境变量配置

1>打开bin目录在地址栏输入cmd并回车,打开命令控制台

2>输入

java -version

并回车,查看版本号,确认是否安装成功。

3>右键此电脑,打开属性(或者在设置里找到关于,win11关于在系统下),点击高级系统设置

4>点击环境变量,开始设置

5>在系统变量中添加,添加方式为:单击新建,输入变量名,并选择变量值(安装目录),然后确定即可

变量名:HOME_JAVA
变量值:D:\dev\java\jdk-17

6>编辑Path目录,选中后点击编辑,添加java下bin目录,即点击新建,输入%JAVA_HOME%\bin(不建议直接选定目录,那样java位置变更之后需要再次更改目录,使用%%只需要更改前边的用户变量和系统变量)

%JAVA_HOME%\bin

7>点击确定并关闭窗口,环境变量即配置完毕

3、linux安装及环境变量配置

(1)安装

1>打开官网下载linux版本jdk

2>在主目录中创建opt文件

3>在opt目录下将选择在终端中打开

4>输入解压代码

tar -zxvf jdk-17_linux-x64_bin.tar.gz -C ../opt/

5>解压完成后将更改文件夹名称,重命名或使用以下代码进行更改

mv ../opt/jdk-17.0.2  ../opt/jdk-17

(2)环境配置

1>打开主目录

2>按Ctrl+h打开隐藏文件

3>打开.bashrc文件

4>在文件末尾输入

export JAVA_HOME=/home/lhz/opt/jdk-17
​
export PATH=$PATH:$JAVA_HOME/bin

并保存文件

5>打开终端,输入java -version即可查看版本号

二、maven

Maven翻译为"专家"、"内行",是 Apache 下的一个纯Java开发的开源项目。基于项目对象模型(缩写∶POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。

Maven 是一个项目管理工具,可以对 Java 项目进行构建、依赖管理。

Maven 也可被用于构建和管理各种项目,例如 C#,Ruby,Scala 和其他语言编写的项目。Maven 曾是 Jakarta项目的子项目,现为由Apache 软件基金会主持的独立 Apache 项目。

1、安装及环境配置

(1)在windows中

1>打开下载网址Maven – Download Apache Maven,选择zip压缩包下载

2>将压缩包解压到D:\dev\java目录下,并将文件夹重命名为maven

3>在java目录下新建m2文件夹,并在m2目录下新建repository文件夹(应用会在此目录下放一些配置文件,如果不建,应用会在c盘生成此目录)

4>配置环境变量,同样打开环境变量配置页,在系统变量下添加

变量名:M2_HOME
变量值:D:\dev\java\maven

在Path变量下添加

%M2_HOME%\bin

5>打开命令提示符,输入

mvn -version

查看版本号如能出现则安装成功

6>修改maven/conf下的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.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.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:/dev/java/m2/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 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值