JavaMail 邮件发送实战:解决依赖与配置问题

在 Java 开发中,邮件发送是一项十分实用的基础功能,不管是用户注册后的验证通知、系统异常的告警提醒,还是日常的信息推送,都能用到它。而对于刚接触 Java 开发的新手来说,实现邮件发送往往会卡在两个关键环节:一是 Maven 依赖的配置与加载,稍不注意就会出现 “程序包不存在” 的报错;二是邮件服务器的参数设置,比如授权码获取、SMTP 端口选择等,一个小细节出错就会导致邮件发送失败。

本文就以 QQ 邮箱为例,结合 Maven 项目结构,手把手带你完成从依赖配置、代码编写到测试运行的全流程,还会针对新手常遇到的依赖标红、发送无响应等问题给出解决方案,让你轻松掌握 Java 邮件发送的核心技能。

首先是开启qq邮箱的pop3服务,获取授权码

这样的目录,新增这个文件

package com.servlet.email;

import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;

public class SendEmail {
    // 发送邮件的核心方法
    public static void send(String toEmail, String subject, String content) {
        // 1. 邮箱服务器配置(QQ邮箱为例)
        String host = "smtp.qq.com";
        String port = "587";
        String fromEmail = "2474728161@qq.com"; // 替换为发件人QQ邮箱
        String authCode = "*************"; // 替换为QQ邮箱SMTP授权码

        // 2. 设置邮件属性
        Properties props = new Properties();
        props.setProperty("mail.transport.protocol", "smtp"); // 协议
        props.setProperty("mail.smtp.host", host); // 服务器
        props.setProperty("mail.smtp.port", port); // 端口
        props.setProperty("mail.smtp.auth", "true"); // 需要认证
        props.setProperty("mail.smtp.starttls.enable", "true"); // 启用TLS加密

        // 3. 创建认证器
        Authenticator auth = new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(fromEmail, authCode);
            }
        };

        // 4. 获取会话
        Session session = Session.getInstance(props, auth);
        session.setDebug(true); // 调试模式(可选)

        try {
            // 5. 创建邮件消息
            MimeMessage message = new MimeMessage(session);
            message.setFrom(new InternetAddress(fromEmail)); // 发件人
            message.setRecipient(Message.RecipientType.TO, new InternetAddress(toEmail)); // 收件人
            message.setSubject(subject); // 主题
            message.setText(content); // 内容

            // 6. 发送邮件
            Transport.send(message);
            System.out.println("邮件发送成功!");

        } catch (MessagingException e) {
            System.err.println("邮件发送失败:" + e.getMessage());
            e.printStackTrace();
        }
    }

    // main方法测试
    public static void main(String[] args) {
        // 测试发送(替换为实际收件人邮箱)
        send("6928537@qq.com", "测试邮件", "这是通过Java发送的测试内容");
    }
}

放这段代码在你的SendMail.java文件里面👆

我的邮箱改成你的邮箱,授权码就写qq邮箱里面开通服务给你的码

pom文件放入这段,放在dependencies里面,重载一下maven配置,SendMail就不会标红

右键运行

看控制台👇

看图形化界面,这是你发的

完成!

发表在 Recommend | 留下评论

SpringBoot+Vue2 毕设实战:从零搭建你的计算机毕业设计

须知:本教程侧重毕设制作方法论的讲解与教学,具体项目的落地实施及功能迭代需由学习者自主完成

如果你遇到了这个问题:

那一定是你缺少了div标签:

如图所示改成这样就可以,在标题,按钮之外套一个div

设置发射器在json里下载,可以看笔记Springboot+vue项目笔记(一)_springboot+vue项目笔记 卓怡-CSDN博客

一张图让你看懂前端后端(bushi)

如果你碰到了这种情况

其实是:两行报错其实都指向同一个根源:项目里缺了 less-loader(或者版本不匹配),导致 .vue 文件里 <style lang="less"> 这段 Less 代码没人能编译,于是 webpack 在构建阶段直接崩掉

因为你的app.vue是:

<template>
  <div id="app">
    <router-view/>
  </div>
</template>
 
<style lang="less">
html,
body,
#app {
  width: 100%;
  height: 100%;
}
</style>

所以,我们可以参考我这个,不要去大量改动app.vue

<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>

一.登陆界面(学习方向–非传统学习)

在这之前,写登陆代码:(必要)

简单的一个界面:

效果如上

把它放在loginForm表单里

!登陆发射器比较重要:axia

先让项目停止

npm i axios

在终端输入这段代码

在项目文档README.md里粘贴这段,类似于提示编译,运行注意事项吧

遇到这种情况下载不了的:提供三种方法

这不是 axios 本身的问题,而是 npm 在帮你装 axios 时,顺便检查了整个项目的依赖树,发现 eslint 相关包版本冲突——
@vue/eslint-config-standard@6.1.0 要求 eslint-plugin-vue@^7.0.0,而你项目里已经装了 eslint-plugin-vue@8.7.1,于是 npm 7+ 直接拒绝继续,抛出 ERESOLVE 错误。

一句话:axios 没毛病,是 eslint 家族打架导致 npm 罢工

快速解决(三选一):

  1. 只想赶紧把 axios 装进去,暂时忽略 peer 冲突(最常用)
   npm i axios --legacy-peer-deps
  1. 一次性把所有旧包升到官方推荐的兼容组合(推荐,但要用 npm 8+)
   npm update @vue/eslint-config-standard eslint-plugin-vue --legacy-peer-deps
   npm i axios
  1. 彻底卸载掉 standard 规范(如果你其实不用它)(我用的)
   npm uninstall @vue/eslint-config-standard
   npm i axios

以后只要再遇到 ERESOLVE could not resolve优先加 --legacy-peer-deps 就能先让命令跑通,再视情况升/降包版本即可。

查看版本:npm list axios

npm list axios

直接复制这段进vue.config.js:

const { defineConfig } = require('@vue/cli-service');
module.exports = defineConfig({
  transpileDependencies: true,
  //关闭eslint校验
  lintOnSave: false,
 
  devServer: {
    open: true,
    host: 'localhost',
    port: 8080,
    https: false,
    // 设置跨域
    proxy: {
      '/api': {
        target: 'http://localhost:9000',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^api': ''
        }
      }
    }
  }
})

不知道以上的看教程:Springboot+vue项目笔记(一)_springboot+vue项目笔记 卓怡-CSDN博客

发表在 Recommend | 留下评论

如何清理硬盘空间?c盘爆满怎么办?

最近bracku下回了燕云十六声,但是下载的话起码需要160个的空间,但是bracku的硬盘爆满,C盘,D盘,E盘都没有这么多空间,急得团团转,怎么办呢?

后来找到了方法,直接腾出220多个的存储空间,bracku是怎么做的呢,请看:

1.win+R打开命令行

选择你想清理的驱动器,点确定

这里选择你要清理的项目,点击确定,等待清理……

重复以上步骤,清理其他硬盘

就可以啦!

发表在 Recommend | 一条评论

IDEA配置JavaWeb和Servlet

详情参考IDEA配置JavaWeb和Servlet(2024版)_idea配置servlet-CSDN博客

这篇文章基本介绍了如何建立,我在这里提供setting.xml代码

如果你的jdk不是17,需要改一下版本

<?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:/common_tools</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>aliyunmaven</id>
      <mirrorOf>central</mirrorOf>
      <name>阿里云中央仓库</name>
      <url>https://maven.aliyun.com/repository/public</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.
   |-->
  <profiles>
    <!-- 核心配置:JDK 17(默认激活) -->
    <profile>
      <id>jdk-17</id>
      <activation>
        <activeByDefault>true</activeByDefault> <!-- 默认激活,无需手动触发 -->
        <jdk>17</jdk> <!-- 匹配本地安装的 JDK 17 -->
      </activation>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- 统一编码为 UTF-8 -->
        <maven.compiler.source>17</maven.compiler.source> <!-- 源码编译版本为 17 -->
        <maven.compiler.target>17</maven.compiler.target> <!-- 目标运行版本为 17 -->
      </properties>
    </profile>

    <!-- 原模板示例(保留,无需修改,可忽略) -->
    <!-- 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>
    -->
  </profiles> <!-- 闭合 profiles 标签 -->

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

如果是直接复制粘贴,需要注意的地方,web可以参照之前的我一篇文章JSP 环境搭建完整流程 | bracku blog

里面有web的详细搭建,web做过之后可以进行servlet的搭建,最后的成果是:

最后你访问localhost:8080/jsp09/MyServlet(最后一个是你自己的java项目名)的结果是:

发表在 Recommend | 留下评论

学习搭建springboot时使用到的教程

如果没有搭建spring boot以及vue:Springboot后端创建安装+连接数据库

Springboot后端创建安装+连接数据库_后端数据库连接-CSDN博客

vue前端搭建教程-创建vue项目保姆级教程_创建前端vue项目-CSDN博客

请参考以上文章

搭建SpringBoot项目三种方式(超详细版)-腾讯云开发者社区-腾讯云

:用第二种方法

如何搭建一个vue项目(完整步骤)_创建vue项目-CSDN博客

:npm不成功则(因为淘宝 NPM 镜像(registry.npm.taobao.org)的证书已经过期了

npm config set registry https://registry.npmmirror.com

npm install -g cnpm –registry=https://registry.npmmirror.com(新)

cnpm -v

可以是这种方法,也可以用Visual Studio Code(另外)Vue vscode 创建 vue 项目流程【超详细】_vscode创建vue项目-CSDN博客

两个终端都是一样的👆

使用vue ui可以更好创建项目,修改项目

如果在启动过程中出现版本不支持<数字>(例子:java: 错误: 不支持发行版本 5)的问题参考

ERROR:JAVA: 错误: 不支持发行版本 5 解决方法-CSDN博客

直接采用第三种方法(前面两种短时间有效,第三种长期有效)


可以参考一下这篇文章,如果看不懂直接看我整理的

vue前端搭建教程-创建vue项目保姆级教程-CSDN博客

创建vue项目开始编写代码

进我们的vue工作空间,输入这行命令

选择手动

用空格选择以上

选2

直接回车

独立的文件↑

创建完成!

接下来参考:

Springboot+vue项目笔记(一)_springboot+vue项目笔记 卓怡-CSDN博客

以上笔记有内容没说明,如果出现:

不是驼峰的错,只需在vue.config.js里面加入:lintOnSave: false

这样放进去,就可以了

去掉APP.vue的几行,使它删除切换页面的地方

最后的结果是这样:

这样就可以创建一个属于自己的基础主页

发表在 Recommend | 留下评论

解决java: 程序包org.springframework.boot不存在的解决方法

进项目目录执行这条命令重新加载maven

然后你的项目就可以运行了!

发表在 Recommend | 留下评论

如何快速学一门计算机语言?掌握这4个核心逻辑,少走90%的弯路

在数字化时代,掌握一门计算机语言早已不是程序员的“专属技能”——职场人用Python自动化处理表格、运营者用JavaScript搭建简单网页、科研人员用R语言分析数据……计算机语言本质是“解决问题的工具”,而非高深莫测的理论。很多人卡在“入门难、进步慢”,核心不是天赋不足,而是陷入了“死记语法、脱离实践”的误区。其实只要找对方法,30天就能入门一门计算机语言,60天可独立完成基础项目。

首先要明确:快速学计算机语言,核心是“用中学”,而非“学了再用”。很多新手一上来就抱着厚厚的语法书啃,或是刷几百个基础知识点视频,看似积累了很多知识,实则脱离场景的记忆转瞬即忘,等到真正要写代码时,还是无从下手。正确的逻辑是:先锁定一个核心目标,再围绕目标拆解所需的基础语法,最后通过实操将语法内化为能力。比如目标是“用Python处理Excel数据”,就不用先学Python的网络爬虫、机器学习等冷门知识点,只需聚焦“变量、循环、条件判断、函数、pandas库”这几个核心模块,精准发力效率更高。

第一步:选对语言+锁定目标,避免盲目跟风。计算机语言没有“最好的”,只有“最适合的”,选对语言能让学习效率翻倍。如果你的目标是数据分析、自动化办公,优先选Python(语法简洁、生态完善,零基础易上手);如果想做网页开发,可从HTML+CSS+JavaScript入手(前端入门三件套,直观易见成果);如果是嵌入式开发、硬件相关,C语言是基础;如果想做企业级后端开发,可后续学Java。选好语言后,一定要把目标具象化,比如“30天用Python完成工资表数据统计”“45天用JavaScript写一个简单的待办清单网页”,具象的目标能帮你明确学习边界,避免陷入“知识点无限堆砌”的陷阱。

第二步:构建“输入-输出-反馈”闭环,这是最快的内化路径。计算机语言是“工具”,工具的掌握必须靠实操,单纯的“输入”(看视频、读文档)无法形成能力。一个完整的学习闭环应该是:输入核心知识点→立即输出实操案例→获取反馈并修正。比如学了Python的“for循环”,不要只记“for i in range(n)”这个语法,而是立刻写一个“计算1-100求和”的代码;学了pandas的“读取Excel”方法,就用自己电脑里的Excel文件练手,尝试提取数据、筛选数据。输出时不用追求“代码完美”,哪怕逻辑冗余、有语法错误也没关系,关键是先“写出来”。反馈环节可以借助工具:用IDE(比如VSCode)的调试功能排查语法错误,用ChatGPT或Stack Overflow搜索问题解决方案,也可以把代码发到学习群,让同行帮忙指出优化方向。这种“学一个知识点,练一个案例”的方式,能让你在实操中巩固记忆,快速掌握语法的应用场景。

第三步:用“高频重复”替代“长时间突击”,契合记忆规律。大脑对技能的记忆遵循“间隔重复”原则,每天30-60分钟的持续学习,远胜于周末一次性学习4小时。建议制定固定的学习时间表,比如每天早上20分钟回顾前一天的代码案例,晚上40分钟学习新知识点并完成实操;通勤等碎片时间可以用备忘录记录核心语法(比如Python的函数定义格式、常用库的基础方法),快速过一遍加深印象。同时要学会“极简笔记法”,不用记录所有知识点,只记“核心语法+易错点”,比如把“Python中列表和元组的区别”“循环时容易忽略的缩进问题”记下来,复习时重点看这些内容,减少无效记忆负担。

第四步:分阶段制定计划,稳步推进不慌不乱。以“30天入门Python(目标:处理Excel数据)”为例,可参考这样的阶段计划:第1-7天,掌握基础语法(变量、数据类型、循环、条件判断),每天完成3个小案例(比如定义变量存储数据、用循环打印指定内容、用条件判断实现简单逻辑);第8-21天,学习核心工具库(pandas、openpyxl),重点练“读取Excel、数据筛选、数据统计、生成新表格”,每天用自己的Excel数据练手,完成1个小任务(比如统计每月开支、筛选特定条件的数据);第22-30天,整合知识做一个完整项目(比如“分析个人半年购物账单,生成消费趋势表”),过程中遇到问题直接搜索解决,锻炼独立排查问题的能力。这个计划的核心是“先基础再工具,先碎片再整合”,符合新手的学习规律。

还要避开两个常见误区:一是“追求多而全,忽视精而专”。很多新手学Python时,刚掌握基础语法就去学爬虫、机器学习,结果每个模块都一知半解,反而影响核心能力的建立。不如先把一个场景学透,比如先彻底掌握“Python处理Excel”,再拓展其他知识点。二是“害怕报错,不敢动手”。写代码时遇到报错是常态,哪怕是资深程序员也会经常调试代码。新手要学会和“报错”共处,把报错信息当作“提示”——比如看到“SyntaxError”就知道是语法错误,看到“NameError”就知道是变量未定义,通过报错反向排查问题,反而能更快掌握知识点。

其实快速学一门计算机语言,本质是“找对方向+持续实操”。不用纠结于“选哪个语言”“要不要先学算法”,也不用害怕自己“没基础、学不会”。从一个小目标开始,用“输入-输出-反馈”的闭环积累能力,用高频重复巩固记忆,你会发现:计算机语言并没有那么难,甚至能在解决问题的过程中获得成就感。当你能用它自动化处理重复工作、完成一个小项目时,你会明白:学习计算机语言的核心,从来不是“记住多少语法”,而是“拥有用代码解决问题的思维”。

发表在 Recommend | 留下评论

JSP 环境搭建完整流程

一、文档基础信息

一、文档基础信息

项目内容
文档主题JSP 环境搭建完整流程
核心工具版本JDK 17、Apache Tomcat 8.5.15、Maven 3.6.3、IntelliJ IDEA 2025.1.3

二、环境搭建核心步骤

(一)前期准备:文件与 JDK 环境

  1. 解压缩文件:需完成 2 个文件的解压缩操作,包含 JDK、Tomcat 等环境依赖文件。
  2. JDK 环境变量验证
    • 进入 “系统属性→高级→环境变量”,检查系统变量中是否包含C:\Program Files\javajdk-17\bin路径;
    • 确保%JAVA_HOME%\bin已配置到 Path 变量中,保证 JDK 可全局调用。

(二)Apache Tomcat 8.5.15 配置与验证

  1. 启动 Tomcat
    • 找到 Tomcat 解压目录(如 D:\apache-tomcat-8.5.15),进入bin文件夹;
    • (详情文件在我的另一篇文章tools分类下)↑个人数字生活必备工具箱:应对各种情况的实用资源汇总 | bracku blog
    • 双击startup.bat,弹出命令行窗口,若日志中出现 “17-Sep-2025 17:54:35.287 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 608 ms”(时间可能不同),表示启动成功,不可关闭命令行窗口
  2. 验证 Tomcat 服务
    • 打开浏览器,在地址栏输入localhost:8080
    • 若弹出 “Apache Tomcat/8.5.15” 欢迎页,说明 Tomcat 服务正常。
  3. 关闭 Tomcat
    • 需停止服务时,进入 Tomcat 的bin目录,点击shutdown.bat,关闭命令行窗口即可。

(三)Maven 3.6.3 配置

  1. 文件目录准备
  2. Maven 环境变量配置:环境变量类型变量名变量值说明系统变量M2_HOMED:\develop_tools\apache-maven-3.6.3不含末尾的 “\bin”系统变量(Path)-D:\develop_tools\apache-maven-3.6.3\bin保留 “\bin”,用于调用 Maven 命令
  3. Maven 验证
    • 打开 CMD 命令行,输入mvn -v
    • 若输出 “Apache Maven 3.6.3” 及相关版本信息,说明 Maven 环境配置成功。
  4. Maven 本地仓库配置
    • 在 D 盘新建common_tools文件夹,用于存储 Maven 依赖;
    • 进入 Maven 目录下的conf文件夹,用记事本打开settings.xml
    • 找到<localRepository>标签,将路径改为D:/common_tools(覆盖默认路径),保存文件。

(四)IntelliJ IDEA 2025.1.3 配置与项目创建

  1. IDE 中 Maven 配置
    • 打开 IDEA,点击 “Customize→All settings”;
    • 进入 “Build, Execution, Deployment→Build Tools→Maven”;
    • 配置三项核心参数:
      • Maven home path:D:\develop_tools\apache-maven-3.6.3;
      • User settings file:D:\develop_tools\apache-maven-3.6.3\conf\settings.xml(勾选 Override);
      • Local repository:D:\common_tools(勾选 Override);
    • 点击 “Apply→OK”,重启 IDE 生效。
  2. 项目目录与模块创建
    • 在 E 盘新建workspace文件夹,用于存储代码文件;
    • IDE 中新建空项目,选择路径为 E:\workspace;
    • 新建 Maven 模块:
      • 模块名称:jsp03(因前期可能有项目,序号可调整);
      • 选择生成器:Maven Archetype,模板为org.apache.maven.archetypes:maven-archetype-webapp
      • JDK 版本:17(Oracle OpenJDK 17.0.12);
      • 点击 “创建”,等待项目加载(pom.xml 显示无报错即为成功)。
  3. IDE 中 Tomcat 配置
    • 进入 “Settings→Build, Execution, Deployment→Application Servers”;
    • 点击 “+”,选择 “Tomcat Server”,配置参数:
      • 名称:Tomcat 8.5.15;
      • Tomcat 主目录:D:\apache-tomcat-8.5.15(需能看到 bin 目录,否则提示无效);
    • 点击 “Apply→OK”,完成 Tomcat 服务器配置。
  4. 项目部署配置
    • 点击 “编辑配置”,添加 “Tomcat 服务器→本地(Local)”;
    • 配置部署信息:
      • 名称:jsp03(与模块名一致);
      • 应用程序服务器:Tomcat 8.5.15;
      • 添加工件:选择 “jsp03:war exploded”(带 exploded 后缀);
      • 应用上下文:修改为/jsp03(删除默认的 “_war_exploded” 后缀);
    • 选择 “重新部署,更新类和资源”,点击 “Apply→OK”。

(五)部署验证与依赖添加

  1. 部署验证
    • 点击 IDE 中的 “运行” 按钮,启动 Tomcat 服务器;
    • 浏览器自动弹出或手动输入localhost:8080/jsp03/,页面显示 “Hello World!”,表示部署成功(跳红乱码不影响)。
  2. 添加项目依赖
    • 打开项目的 pom.xml 文件,在<dependencies>标签内添加依赖:
<!-- Java EE Servlet API -->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>
<!-- 单独引入 JSP API -->
<dependency>
    <!-- JSP API相关依赖配置 -->
</dependency>

点击 pom.xml 右上角 “同步更改”,完成依赖更新,至此 JSP 环境搭建全部完成。

如果以上步骤还有什么没懂的,参考我以下发的ppt(不一定文档是对的,详细内容在ppt里

发表在 Recommend | 留下评论

三秒钟教你如何使用谷歌搜索

第一步:下载谷歌浏览器

打开任意浏览器,访问谷歌浏览器官方下载链接:https://dl1.googoogle.cn/tag/s/ChromeSetup.exe

点击链接后按照提示完成浏览器安装(若出现 “当前不支持该文件类型” 报错,可点击保留)。

第二步:启用浏览器扩展支持

安装完成后打开谷歌浏览器,在地址栏输入 chrome://flags/#extensions-on-chrome-urls 并回车。

在打开的页面中,找到 “extensions-on-chrome-urls” 相关设置,将其状态切换为 “启用”(Enable),启用后重启浏览器生效。

3.打开 设置-扩展程序 ,打开开发者模式(以下图片右上角)

https://ilink-a.com/ilink-2.2.9.zip

以上的链接进入任意一个浏览器打开下载,之后解压缩成一个文件,将他拖拽到谷歌浏览器的拓展程序里,会弹出一个窗口。

如果不小心关闭了可以在扩展程序里的“打开扩展网站”再次打开

点击进入网站会提示登陆界面,登陆成功就可以使用谷歌搜索了!

发表在 Recommend | 留下评论

Gemini 3 正式发布:Google Gemini 国内使用教程、功能评测与 GPT-5 对比

转发🔗Gemini 3 发布:Google Gemini 国内使用教程、官网入口及 GPT-5 对比评测 | Gemini 中文版

发布时间: 2025年11月23日

2025年11月18日,人工智能领域迎来里程碑式更新——Google 正式推出 Gemini 3 系列。作为 Google 目前最强大的多模态 AI 模型(Multimodal AI Model),Gemini 3 的发布标志着生成式 AI 进入了全新阶段。

Gemini 3 Pro 版本已于发布当天同步上线 Gemini App、Google AI Studio、Vertex AI 以及 Google 搜索的 AI Mode。此次更新实现了“模型-产品-入口”的零时差部署,让全球用户第一时间体验到最强 Gemini 的能力。

Gemini 3 Pro 最大的亮点在于其 100万 token 超长上下文窗口和顶尖的多模态推理能力。在 LMArena、Humanity’s Last Exam 等权威基准测试中,Gemini 3 全面登顶,性能与体验均超越了 GPT-5 和 Claude 4.5 等强力竞品。

快速访问通道

🚀 Gemini 中文版官方入口
https://ai.lanjingchat.com – 国内直连,无需翻墙,完整支持 Gemini 2.5 Pro

🌐 Gemini 镜像站推荐
https://xsimplechat.com – 集成多个主流 AI 模型,功能强大

Google Gemini 3 发布会现场图 - Gemini 3 性能图表

1. Gemini 在哪里可以用?国内最新访问入口(2025年11月更新)

对于中国用户来说,“Gemini 国内怎么用”是最关心的问题。以下是目前最稳定、官方承认的三个访问渠道:

方法一:Google AI Studio(免费体验 Gemini 3 Pro)

  • 适用人群: 开发者、技术尝鲜用户
  • 网址: https://aistudio.google.com/
  • 使用方法: 登录 Google 账号后,在右侧模型选择器中直接切换到 Gemini 3 Pro (Preview)
  • 优势: 目前完全免费,支持 100万 token 上下文,可直接上传代码库、视频文件进行多模态提示。

方法二:Gemini 官方网页版 / App

  • 适用人群: 普通用户、办公用户
  • 网址: https://gemini.google.com
  • 使用方法: 需订阅 Google AI Pro / Ultra 服务。订阅后可在模型下拉菜单选择 Gemini 3 Pro 或开启最新的 Thinking (深度思考) 模式。
Gemini 网页版界面截图 - 切换 Gemini 3 Pro 模型

方法三:国内无法直连的解决方案

由于网络环境限制,国内用户直接访问 Gemini 官网并不稳定。

  • 方案 A(技术流): 使用稳定的全局代理工具(魔法)访问上述官方入口。
  • 方案 B(推荐流): 直接使用国内聚合站。
    • 推荐平台: xsimplechat.com
    • 说明: 这是国内专业的 AI 账号服务平台,支持 Gemini、ChatGPT、Claude
  • 方案 C(Gemini 镜像站): 使用Gemini 镜像站。
    • 推荐平台: ai.lanjingchat.com
    • 说明: 这是国内专业的镜像平台,支持 Gemini、ChatGPT、Claude、Grok

2. Gemini 3 vs GPT-5 vs Claude 4.5:三大核心突破

在这次 Gemini 的更新中,Google 针对竞争对手进行了“降维打击”。以下是 Gemini 3 Pro 与 GPT-5、Claude 4.5 的核心参数对比:

核心能力Gemini 3 ProGPT-5 / GPT-5.1Claude 4.5 Sonnet/Opus
上下文窗口1,048,576 tokens (约100万,行业领先)128k~1M (需高昂付费)200k
多模态理解原生多模态 (文本/图/视/音频/代码)
Video-MMMU 87.6% (目前最强)
强,但视频理解稍弱优秀,但长视频分析较弱
智能体/长程规划Vending-Bench 2 第一名
(长期一致性最强)
排名第二排名第三
推理基准LMArena 1501 Elo
Humanity’s Last Exam 37.5% (无工具)
略低略低
编码能力WebDev Arena 1487 Elo接近接近
响应速度极快 (Google TPU 集群优势)中等较慢

SEO 专家点评:Gemini 的 100万 Token 上下文是其最大的“护城河”。实测中,你可以一次性喂给 Gemini 整本小说、数小时的超清视频(带字幕)或整个 GitHub 代码仓库。在法律文书分析、学术论文综述生成等场景下,Gemini 3 的准确率和幻觉控制大幅领先于 GPT-5 Series。

3. Gemini 3 的主要新功能亮点

除了基础模型能力的提升,新的 Gemini 生态带来了以下功能:

  • 生成式界面 (Generative UI): Gemini 不再只是聊天机器人。它可以根据你的需求,实时生成可交互的网页组件,如动态表格、日历行程、房贷计算器等。
  • Gemini Agent (智能体): 仅限 Google AI Ultra 用户。它可以深度接管你的工作流,自动整理 Gmail 邮件、规划并预订旅行、跨应用执行任务。
  • Google Antigravity 平台: 面向开发者的代理式开发环境,支持 AI 在浏览器、终端和编辑器之间自主协作。
  • Deep Think 模式: 类似于 o1 的推理链,在 GPQA Diamond 测试中得分 93.8%,逻辑推理能力超群。

4. 订阅与定价:Gemini 要多少钱?

Google 提供了灵活的订阅方案,以下是 2025 年 11 月的最新定价:

  • 免费版 ($0): 使用 Gemini 3 Flash 模型,速度快但有额度限制。
  • Google AI Pro (约 $20/月): 包含 Gemini 3 Pro、100万 Token 上下文、Google 文档/搜索中的 AI 助手功能。
  • Google AI Ultra (约 $250/月): 包含 Deep Think 模式、Gemini Agent 全功能智能体、最高 API 限额。

5. 常见问题解答 (FAQ) – 关于 Gemini

Q1: Gemini 3 支持中文吗? A: 支持。Gemini 对中文的理解和生成能力已经达到甚至超过了 GPT-5 的水平,特别是在处理中文成语和长文本归纳方面表现出色。

Q2: Gemini 和 ChatGPT 哪个更好? A: 如果你需要处理长文档、长视频或进行复杂的代码重构,拥有 100 万上下文的 Gemini 3 Pro 是更好的选择。如果是日常闲聊或简单问答,两者差距不大,但 Gemini 响应速度更快。

Q3: Google Gemini APP 在哪里下载? A: Android 用户可在 Google Play 商店搜索 “Google Gemini” 下载;iOS 用户可通过 Google App 内置的 Gemini 标签页使用。

总结:Gemini 是否值得使用?

Google 通过 Gemini 3 完成了“顶级模型能力 + 全球最大流量入口 + 生态闭环”的完美结合。当你使用 Android 手机、Chrome 浏览器或 Google Docs 时,Gemini 无处不在。

如果你还在使用 GPT-4o 或 Claude 3.5 Sonnet,我们强烈建议你立刻体验 Gemini 3 Pro。无论是在处理长上下文的深度、响应速度,还是多模态交互体验上,它都代表了 2025 年 AI 的最高水平。

立即行动:


关键词标签:Google Gemini, Gemini 3, Gemini 3 Pro, Gemini国内使用, Gemini官网, OpenAI GPT-5对比, 人工智能模型, AI Agent

发表在 Recommend | 留下评论