<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>老卫（柳伟卫）的技术站 - 关注编程、系统架构、性能优化</title>
    <description>老卫（柳伟卫）的技术站 - 关注编程、系统架构、性能优化 | waylau.com</description>
    <link>https://waylau.com/</link>
    <atom:link href="https://waylau.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 03 Apr 2026 03:03:26 +0000</pubDate>
    <lastBuildDate>Fri, 03 Apr 2026 03:03:26 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Harness Engineering让AI项目工程化</title>
        <description>&lt;p&gt;当AI大模型市场规模持续攀升，2024年中国市场已达294.16亿元，预计2026年突破700亿元时，AI技术的狂飙突进并未完全转化为企业可落地的生产力。多数AI项目仍停留在“Demo惊艳、落地艰难”的困境，从技术研发到实际应用的“最后一公里”始终难以打通。背后的核心症结的是：AI开发缺乏标准化、体系化的工程化支撑，而Harness Engineering（驾驭工程）的出现，正是为了破解这一困局，让AI项目从“零散试点”走向“规模化落地”，真正实现工程化、标准化、可运维。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260403-harness-001.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;一现有ai应用开发的核心痛点从实验室到生产线的断层&quot;&gt;一、现有AI应用开发的核心痛点：从“实验室”到“生产线”的断层&lt;/h2&gt;

&lt;p&gt;当前AI应用开发的困境，并非源于模型能力不足，而是缺乏一套贯穿全生命周期的工程化体系，导致技术与业务脱节、效率低下、风险难控，具体可归结为五大核心痛点：&lt;/p&gt;

&lt;p&gt;其一，数据基础薄弱，开发“无米下锅”。AI模型的训练依赖高质量数据，但当前数据获取与跨域交换存在“玻璃门”，医疗、金融等垂直领域开发者常面临适配场景的高质量数据匮乏、数据格式混乱、标注粗糙等问题。大量时间耗费在数据清洗上，仍难以满足模型训练需求，成为开发初期的沉重负担，也为后续模型不稳定埋下隐患。&lt;/p&gt;

&lt;p&gt;其二，模型适配困难，落地“水土不服”。多数主流模型基于国外算力生态开发，与国产算力适配难度大，企业切换至昇腾等国产算力时，需投入大量人力优化代码、调整参数，且常出现“模型能训练却跑不起来”的尴尬。同时，模型在实验室环境中的表现与真实业务场景脱节，泛化能力不足，“过拟合”现象突出，难以应对复杂多变的实际需求。&lt;/p&gt;

&lt;p&gt;其三，工具链分散，开发效率低下。AI开发涉及的镜像、微调、部署等基础工具五花八门，且散落于不同平台，开发者需在多个社区反复切换，不仅浪费时间，还易因工具兼容性问题阻碍开发流程。此外，AI代码生成效率提升5-10倍，但人工审核、调试效率远跟不上，逻辑漏洞、兼容性问题频发，形成“开发快、验证慢”的瓶颈。&lt;/p&gt;

&lt;p&gt;其四，成本高企且风险难控。模型训练、推理验证需海量算力支撑，中小团队和个人开发者购置或租赁算力成本高昂，常因“算力卡脖子”被迫暂停项目。同时，AI开发缺乏安全管控，易出现越权操作、数据泄露、执行死循环等问题，某企业无人监控的AI智能体曾陷入无限循环，导致API账单累积5万美元才被发现，安全与合规风险突出。&lt;/p&gt;

&lt;p&gt;其五，协作机制缺失，规模化落地受阻。AI开发早已进入“协同作战”时代，但当前开发者多处于“各自为战”状态：有人擅长模型优化却缺数据，有人手握算力却不懂场景落地，缺乏集结群体智慧的平台，导致共性问题反复出现，难以形成突破合力，也无法支撑AI项目的规模化、标准化部署。&lt;/p&gt;

&lt;p&gt;这些痛点相互交织，让AI项目陷入“高投入、低产出、难落地”的恶性循环，也催生了对新型工程化方法论的迫切需求——Harness Engineering应运而生。&lt;/p&gt;

&lt;h2 id=&quot;二harness-engineering的产生背景ai规模化落地的必然选择&quot;&gt;二、Harness Engineering的产生背景：AI规模化落地的必然选择&lt;/h2&gt;

&lt;p&gt;Harness Engineering的爆发，并非偶然，而是AI技术演进与企业实际需求碰撞的必然结果，其产生源于三个核心驱动力，标志着AI工程化从“单点优化”进入“系统管控”的新阶段。&lt;/p&gt;

&lt;p&gt;首先，AI技术范式的迭代催生新需求。从2023-2024年的Prompt Engineering（提示工程），到2025年的Context Engineering（上下文工程），AI工程化经历了“优化指令”“丰富信息”的两个阶段，但均存在明显局限：Prompt Engineering仅关注单次交互的指令优化，脆弱性高、无法处理长上下文、缺乏状态管理；Context Engineering虽引入检索增强（RAG）优化上下文管理，但仍以短轮次交互为主，无法约束AI的违规行为，难以支撑复杂长周期任务。随着大语言模型（LLM）基础能力饱和与AI智能体（Agent）技术爆发，模型智商已足够高，行业瓶颈转向可靠性、安全性和长程规划能力，Harness Engineering正是为解决这一瓶颈而生。&lt;/p&gt;

&lt;p&gt;其次，企业规模化落地的痛点倒逼方法论升级。当企业试图将AI从“玩具级工具”转化为“生产力核武器”时，传统工程模式已无法适配需求：仅依靠Prompt或Context Engineering，只能解决单次交互的理解问题，无法根治AI的概率性行为、无状态、无自我校验、无权限边界的底层缺陷。企业亟需一套标准化、可运维、可审计的工程体系，将“野生、不可控”的LLM，转化为可工业化部署、可重复使用、可监控运维的稳定AI智能体，Harness Engineering成为必然选择。&lt;/p&gt;

&lt;p&gt;最后，工程师角色转型的需求提供支撑。AI时代，工程师的角色正从“写代码、写提示词”的操作员，转变为“设计环境、制定规则、搭建反馈闭环”的架构师。这种角色转型需要一套完整的方法论支撑，而Harness Engineering恰好明确了工程师的核心职责——构建约束AI行为的“马具”，引导AI在可控边界内自主、高效地完成任务，实现“人类掌舵，AI执行”的理想模式。&lt;/p&gt;

&lt;p&gt;简言之，Harness Engineering是AI技术发展到一定阶段的产物，是解决AI落地痛点、实现规模化应用的核心工程化方法论，其核心定义为：设计、构建和迭代一套完整的运行环境与制度体系，引导和约束AI智能体，使其能够自主、可靠地完成复杂长周期任务，而无需人类实时干预。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260403-harness-002.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;三如何通过harness-engineering实现ai项目工程化&quot;&gt;三、如何通过Harness Engineering实现AI项目工程化&lt;/h2&gt;

&lt;p&gt;Harness Engineering实现AI项目工程化的核心逻辑，是构建一套“环境-工具-反馈-管控”的全生命周期闭环体系，将工程化思维贯穿AI项目从需求分析到部署运维的每一个环节，打破“实验室”与“生产线”的断层，具体可通过四大核心路径落地。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260403-harness-003.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;一搭建隔离式运行环境筑牢安全与稳定底座&quot;&gt;（一）搭建隔离式运行环境，筑牢安全与稳定底座&lt;/h3&gt;

&lt;p&gt;环境管控是AI项目工程化的基础，核心是通过沙箱隔离与资源管控，避免AI错误操作污染生产环境，同时解决模型适配与算力成本问题。一方面，为每个任务或AI智能体实例分配独立的临时文件系统、容器或虚拟机，限制网络访问权限（白名单机制），并设置CPU、内存、时间上限等资源配额，防止AI陷入死循环或过度消耗资源。另一方面，构建标准化的算力适配层，兼容国产与国外算力生态，通过代码优化、参数调整等工具，降低模型适配难度，帮助企业自由切换算力，摆脱“算力卡脖子”困境。此外，搭建本地优先或混合部署的环境架构，确保数据隐私安全，满足金融、医疗等敏感领域的合规需求。&lt;/p&gt;

&lt;h3 id=&quot;二构建标准化工具链提升开发与协作效率&quot;&gt;（二）构建标准化工具链，提升开发与协作效率&lt;/h3&gt;

&lt;p&gt;工具链的标准化的是AI工程化的核心，目的是解决工具分散、兼容性差、协作不畅的问题。首先，整合AI开发全流程工具，包括数据清洗、模型训练、微调、部署、监控等，形成统一的操作平台，避免开发者在多个工具间切换，提升开发效率。其次，封装标准化API接口（如OpenAPI/Swagger），预置代码执行器、数据库连接器、UI自动化控制器等常用工具库，明确工具的文档、参数校验和错误返回码，让AI能够准确理解和调用工具，赋予AI改变现实世界的能力而非仅停留在文本生成。最后，搭建协同平台，整合数据、算力、人才等资源，打破“各自为战”的局面，实现资源共享与分工协作，让擅长不同领域的开发者形成合力，提升项目推进效率。&lt;/p&gt;

&lt;h3 id=&quot;三建立闭环反馈与自愈机制保障项目可靠性&quot;&gt;（三）建立闭环反馈与自愈机制，保障项目可靠性&lt;/h3&gt;

&lt;p&gt;AI项目的工程化，离不开持续的迭代优化，而闭环反馈与自愈机制是实现这一目标的关键。Harness Engineering通过“Plan-Act-Observe-Reflect-Correct”的循环流程，实现AI的自我纠错与持续优化：AI智能体先生成执行计划并调用工具执行，Harness系统实时捕获执行结果（成功日志或错误堆栈），若出现失败，将错误信息结构化后反馈给AI，AI根据反馈调整策略并重新执行，直至成功或达到最大重试次数。同时，建立错误复盘机制，记录AI在测试与运行中的所有失误（如幻觉、格式错误、权限越界），将每一类错误转化为明确的约束规则、校验逻辑与修复逻辑，通过代码、配置文件嵌入Harness系统，让AI永远不再犯同类错误，实现可靠性的指数级提升。&lt;/p&gt;

&lt;h3 id=&quot;四完善可观测性与合规管控实现全流程可控&quot;&gt;（四）完善可观测性与合规管控，实现全流程可控&lt;/h3&gt;

&lt;p&gt;AI项目工程化的核心要求是“可控、可追溯、可合规”，而可观测性与合规管控是实现这一要求的核心手段。一方面，建立全链路追踪体系，记录AI每一步的思考链、工具调用参数及返回值，实现操作全流程可追溯，便于调试与问题排查；设置人类介入点，在删除数据、发布生产代码等关键决策节点，强制人工审批，降低风险。另一方面，构建多层级校验与安全护栏，包括格式校验、业务规则校验、语法检测、安全过滤、违规拦截等，杜绝AI越权访问、数据泄露等问题；同时，监控任务成功率、平均修复时间、Token消耗成本、异常频率等核心指标，实时掌握项目运行状态，及时发现并解决问题，确保项目符合行业合规要求与企业业务标准&lt;/p&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;本文同步至:  &lt;a href=&quot;https://waylau.com/about-harness-engineering/&quot;&gt;https://waylau.com/about-harness-engineering/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;开源项目“跟老卫学AI大模型开发” &lt;a href=&quot;https://github.com/waylau/ai-large-model-tutorial/&quot;&gt;https://github.com/waylau/ai-large-model-tutorial/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 03 Apr 2026 00:22:00 +0000</pubDate>
        <link>https://waylau.com/about-harness-engineering/</link>
        <guid isPermaLink="true">https://waylau.com/about-harness-engineering/</guid>
        
        <category>Harness</category>
        
        
        <category>Harness</category>
        
      </item>
    
      <item>
        <title>JDK 26发布</title>
        <description>&lt;p&gt;JDK 26 是 Oracle 发布的非LTS版本，2026年3月17日正式GA，聚焦&lt;strong&gt;云原生适配、性能优化、安全演进&lt;/strong&gt;三大核心方向，包含&lt;strong&gt;6个正式特性+5个预览/孵化特性&lt;/strong&gt;，无破坏性核心变更，以下为基于官方发布及指定文章的精准特性整理，所有JEP编号与特性状态均与原文一致。&lt;/p&gt;

&lt;p&gt;本文总结了JDK 26发布的新特性。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h2 id=&quot;安装包下载&quot;&gt;安装包下载&lt;/h2&gt;

&lt;p&gt;主要分为OpenJDK版本和Oracle版本，下载地址如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;OpenJDK版本：&lt;a href=&quot;https://jdk.java.net/26/&quot;&gt;https://jdk.java.net/26/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Oracle版本：&lt;a href=&quot;https://www.oracle.com/java/technologies/downloads/&quot;&gt;https://www.oracle.com/java/technologies/downloads/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;上述版本，如果是个人学习用途，则差异不大。但如果是用于商业用途，则需要仔细看好相关的授权。Oracle JDK商用需要遵循 &lt;a href=&quot;https://www.oracle.com/downloads/licenses/no-fee-license.html&quot;&gt;Oracle No-Fee Terms and Conditions (NFTC)&lt;/a&gt;协议，而OpenJDK根据&lt;a href=&quot;https://openjdk.java.net/legal/gplv2+ce.html&quot;&gt;GPL v2许可&lt;/a&gt;获得许可。&lt;/p&gt;

&lt;p&gt;更多有关Java的基本知识，可以参阅《&lt;a href=&quot;https://item.jd.com/12868796.html&quot;&gt;Java核心编程&lt;/a&gt;》这本书，描述的非常详细。&lt;/p&gt;

&lt;h2 id=&quot;jdk-26-新特性说明&quot;&gt;JDK 26 新特性说明&lt;/h2&gt;

&lt;h2 id=&quot;一正式标准化特性ga可直接生产使用&quot;&gt;一、正式标准化特性（GA，可直接生产使用）&lt;/h2&gt;
&lt;h3 id=&quot;1-jep-516aot缓存支持任意gc&quot;&gt;1. JEP 516：AOT缓存支持任意GC&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心改进&lt;/strong&gt;：解决此前AOT缓存仅支持特定GC的问题，将缓存对象以&lt;strong&gt;GC无关的逻辑索引格式&lt;/strong&gt;存储，启动时通过后台线程流式加载到堆，而非GC特定的内存映射方式。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;支持GC&lt;/strong&gt;：G1、ZGC、Shenandoah、Serial GC等所有垃圾收集器。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;核心收益&lt;/strong&gt;：Serverless/微服务场景冷启动速度提升（此前AOT可提效约40%），流式加载隐藏磁盘IO延迟，且不影响应用峰值吞吐。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;适用场景&lt;/strong&gt;：云原生弹性扩缩容、低延迟服务启动场景。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2-jep-517http3-标准化支持&quot;&gt;2. JEP 517：HTTP/3 标准化支持&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;状态&lt;/strong&gt;：从JDK 24孵化器模块正式纳入标准&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;java.net.http&lt;/code&gt; API。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;核心特性&lt;/strong&gt;：基于QUIC协议，实现TLS 1.3+QUIC 0-RTT握手、彻底解决队头阻塞、多路复用性能提升、移动网络连接迁移更顺畅。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;使用方式&lt;/strong&gt;：通过&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.version(HttpClient.Version.HTTP_3)&lt;/code&gt;显式启用，&lt;strong&gt;默认仍为HTTP/2&lt;/strong&gt;，并可透明降级至HTTP/1.1。
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 启用HTTP/3示例&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HttpClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;newBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;HttpClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;Version&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;HTTP_3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;3-jep-522g1-gc-吞吐量优化&quot;&gt;3. JEP 522：G1 GC 吞吐量优化&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心机制&lt;/strong&gt;：引入&lt;strong&gt;双卡表（Dual Card Table）&lt;/strong&gt;，实现应用线程与GC优化器线程的读写分离。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;具体改进&lt;/strong&gt;：应用线程无锁更新第一张卡表，GC线程处理第二张卡表，消除同步竞争，&lt;strong&gt;大幅降低写屏障开销&lt;/strong&gt;。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;收益&lt;/strong&gt;：高吞吐量场景（批处理、大数据计算）性能提升显著，大堆应用稳定性增强。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4-jep-496ml-dsa-后量子密码算法正式版&quot;&gt;4. JEP 496：ML-DSA 后量子密码算法（正式版）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心定位&lt;/strong&gt;：Java平台首个标准化后量子签名算法，应对量子计算对RSA/ECC的潜在威胁。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;关键特性&lt;/strong&gt;：基于NIST标准化的格密码理论，SUN安全提供者实现，x86_64平台AVX2指令集优化，性能较实验版显著提升。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;使用方式&lt;/strong&gt;：&lt;strong&gt;不替换默认签名算法&lt;/strong&gt;，需开发者显式选用，适合安全合规、长期数据保护场景。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;5-jep-504移除applet-api&quot;&gt;5. JEP 504：移除Applet API&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;移除背景&lt;/strong&gt;：JDK 9标记废弃、JDK 17标记废弃待移除，因现代浏览器与JDK均不再支持Applet。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;核心影响&lt;/strong&gt;：彻底终结浏览器Java小程序时代，减少JDK体积，清除无维护的过时代码，&lt;strong&gt;无业务代码兼容性影响&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;6-jep-500让final真正意味着不可变过渡性变更&quot;&gt;6. JEP 500：让Final真正意味着不可变（过渡性变更）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心变化&lt;/strong&gt;：通过深度反射（&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Unsafe&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MethodHandles&lt;/code&gt;）修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;final&lt;/code&gt;字段时，&lt;strong&gt;从无提示变为抛出警告&lt;/strong&gt;，为未来强制不可变做准备。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;默认配置&lt;/strong&gt;：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--illegal-final-field-mutation=warn&lt;/code&gt;（警告但允许修改）；未来将升级为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deny&lt;/code&gt;（抛出&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IllegalAccessException&lt;/code&gt;）。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;适配建议&lt;/strong&gt;：序列化库（Jackson/Gson）迁移至&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sun.reflect.ReflectionFactory&lt;/code&gt;，DI/测试框架避免修改final字段，改用构造函数注入。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;排查命令&lt;/strong&gt;：
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 记录final字段修改行为&lt;/span&gt;
java &lt;span class=&quot;nt&quot;&gt;-XX&lt;/span&gt;:StartFlightRecording:filename&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;recording.jfr ...
&lt;span class=&quot;c&quot;&gt;# 分析记录&lt;/span&gt;
jfr print &lt;span class=&quot;nt&quot;&gt;--events&lt;/span&gt; jdk.FinalFieldMutation recording.jfr
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二预览特性preview需开启--enable-preview&quot;&gt;二、预览特性（Preview，需开启&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--enable-preview&lt;/code&gt;）&lt;/h2&gt;
&lt;h3 id=&quot;1-jep-525结构化并发第六次预览&quot;&gt;1. JEP 525：结构化并发（第六次预览）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心设计&lt;/strong&gt;：将多线程相关任务组视为单一工作单元，简化并发编程。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;JDK 26关键API调整&lt;/strong&gt;：
    &lt;ul&gt;
      &lt;li&gt;新增&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Joiner.onTimeout()&lt;/code&gt;：超时可返回默认结果；&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Joiner::allSuccessfulOrThrow()&lt;/code&gt;：返回结果列表而非Stream；&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;open()&lt;/code&gt;静态工厂方法：参数从&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Function&lt;/code&gt;改为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UnaryOperator&lt;/code&gt;。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;核心能力&lt;/strong&gt;：自动处理任务取消/超时传播、避免线程资源泄漏、错误处理更清晰、线程dump展示父子任务树。
    &lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 结构化并发使用示例&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StructuredTaskScope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fork&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;findUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;order&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fork&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fetchOrder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Subtask&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;State&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SUCCESS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Subtask&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;State&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;SUCCESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 子任务失败自动取消其他任务&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2-jep-524pem编码支持第二次预览&quot;&gt;2. JEP 524：PEM编码支持（第二次预览）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心功能&lt;/strong&gt;：官方提供PEM格式的编解码API，支持加密密钥、证书、CRL等密码学对象，&lt;strong&gt;无需依赖Bouncy Castle等第三方库&lt;/strong&gt;。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;适用场景&lt;/strong&gt;：DevOps/云原生部署的密钥管理，配合ML-DSA实现后量子密钥证书的便捷管理。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;3-jep-530原始类型模式匹配第四次预览&quot;&gt;3. JEP 530：原始类型模式匹配（第四次预览）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心增强&lt;/strong&gt;：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;instanceof&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;switch&lt;/code&gt;全面支持8大原始类型（int/long/double/float/char/byte/short/boolean）。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;关键能力&lt;/strong&gt;：
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;instanceof&lt;/code&gt;：直接检查原始类型并&lt;strong&gt;安全转换&lt;/strong&gt;（仅值匹配时转换）；&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;switch&lt;/code&gt;：新增long/float/double/boolean支持，此前仅支持byte/short/char/int。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;不兼容变更&lt;/strong&gt;：引入严格的Dominance检查，覆盖性case后编写子case会报编译错误。
```java
// instanceof原始类型匹配
int i = 1000;
if (i instanceof byte b) {
  System.out.println(“安全转换为byte: “ + b);
} else {
  System.out.println(“值太大，无法转换: “ + i);
}&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;// switch支持long类型
long id = 10_000_000_000L;
switch (id) {
    case 1L -&amp;gt; System.out.println(“普通用户”);
    case 10_000_000_000L -&amp;gt; System.out.println(“VIP用户”);
    default -&amp;gt; System.out.println(“其他”);
}
```&lt;/p&gt;

&lt;h3 id=&quot;4-jep-526惰性常量第二次预览&quot;&gt;4. JEP 526：惰性常量（第二次预览）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心特性&lt;/strong&gt;：声明延迟初始化的常量字段，JVM视为&lt;strong&gt;原生常量&lt;/strong&gt;，享受&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;final&lt;/code&gt;字段的性能优化（常量折叠、内联）。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;核心优势&lt;/strong&gt;：初始化时机灵活（&lt;strong&gt;首次使用时初始化&lt;/strong&gt;，而非类加载时），适合复杂初始化逻辑但需编译期常量优化的场景。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三孵化特性incubator实验性&quot;&gt;三、孵化特性（Incubator，实验性）&lt;/h2&gt;
&lt;h3 id=&quot;jep-529vector-api第十一次孵化&quot;&gt;JEP 529：Vector API（第十一次孵化）&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;核心设计&lt;/strong&gt;：让Java直接表达向量计算，可靠编译为CPU最优向量指令（AVX/SSE/NEON），实现SIMD加速。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;核心收益&lt;/strong&gt;：AI推理、科学计算、图像处理等数据密集型场景，&lt;strong&gt;无需编写JNI代码&lt;/strong&gt;即可利用CPU硬件加速，性能优于标量计算。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;状态&lt;/strong&gt;：经十一轮孵化API日趋稳定，是Java高性能计算的核心演进方向。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;四jdk-26-核心架构价值&quot;&gt;四、JDK 26 核心架构价值&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;云原生/Serverless&lt;/strong&gt;：AOT+任意GC兼顾低启动延迟与低延迟GC，弹性扩缩容效率提升；&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;微服务通信&lt;/strong&gt;：HTTP/3基于QUIC协议，广域网多链接并发场景性能大幅提升；&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;高吞吐场景&lt;/strong&gt;：G1双卡表机制降低写屏障开销，批处理/大数据计算收益显著；&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;安全合规&lt;/strong&gt;：ML-DSA正式版开启Java后量子密码时代，适合金融/政务等数据保护场景；&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;并发编程&lt;/strong&gt;：结构化并发减少线程泄漏，让高并发代码更健壮、可观测性更强；&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;高性能计算&lt;/strong&gt;：Vector API持续孵化，Java可原生利用CPU SIMD指令，替代JNI实现硬件加速。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;五官方升级建议按场景划分&quot;&gt;五、官方升级建议（按场景划分）&lt;/h2&gt;
&lt;p&gt;| 应用场景                | 升级建议                                  |
|————————-|——————————————-|
| 生产环境LTS稳定运行     | 继续使用JDK 21 LTS或JDK 25 LTS             |
| 技术尝鲜/测试环境       | 可部署体验，重点测试HTTP/3和AOT+任意GC    |
| 云原生/Serverless       | 值得升级，核心特性对场景提效显著          |
| 安全合规/金融/政务      | 关注ML-DSA，提前布局量子安全架构          |
| 密码学应用开发          | 关注PEM编码，减少第三方库依赖              |
| AI/科学计算/图像处理    | 跟踪Vector API演进，测试硬件加速效果      |&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;回滚策略&lt;/strong&gt;：非LTS版本无长期维护，若升级遇问题直接回退至当前稳定版本（JDK 21/25）。&lt;/p&gt;

&lt;h2 id=&quot;六核心亮点总结&quot;&gt;六、核心亮点总结&lt;/h2&gt;
&lt;p&gt;| JEP编号 | 特性核心               | 特性类型       | 核心适用场景               |
|———|————————|—————-|—————————-|
| 516     | AOT缓存支持任意GC      | 正式特性       | 云原生/Serverless          |
| 517     | HTTP/3标准化           | 正式特性       | 微服务跨网通信             |
| 496     | ML-DSA后量子密码       | 正式特性       | 安全合规/长期数据保护      |
| 522     | G1 GC吞吐量优化        | 正式特性       | 批处理/大数据计算          |
| 525     | 结构化并发             | 第六次预览     | 高并发服务开发             |
| 529     | Vector API             | 第十一次孵化   | AI/高性能计算/图像处理     |&lt;/p&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;本文同步至:  &lt;a href=&quot;https://waylau.com/jdk-26-released/&quot;&gt;https://waylau.com/jdk-26-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-25-released/&quot;&gt;https://waylau.com/jdk-25-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-24-released/&quot;&gt;https://waylau.com/jdk-24-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-23-released/&quot;&gt;https://waylau.com/jdk-23-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-22-released/&quot;&gt;https://waylau.com/jdk-22-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-21-released/&quot;&gt;https://waylau.com/jdk-21-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-17-released/&quot;&gt;https://waylau.com/jdk-17-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-16-released/&quot;&gt;https://waylau.com/jdk-16-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-15-released/&quot;&gt;https://waylau.com/jdk-15-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://waylau.com/jdk-14-released/&quot;&gt;https://waylau.com/jdk-14-released/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《&lt;a href=&quot;https://item.jd.com/12868796.html&quot;&gt;Java核心编程&lt;/a&gt;》&lt;/li&gt;
  &lt;li&gt;开源项目“现代Java案例大全” &lt;a href=&quot;https://github.com/waylau/modern-java-demos&quot;&gt;https://github.com/waylau/modern-java-demos&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Sat, 21 Mar 2026 00:22:00 +0000</pubDate>
        <link>https://waylau.com/jdk-26-released/</link>
        <guid isPermaLink="true">https://waylau.com/jdk-26-released/</guid>
        
        <category>JDK</category>
        
        <category>Java</category>
        
        
        <category>JDK</category>
        
        <category>Java</category>
        
      </item>
    
      <item>
        <title>“Java+AI全栈工程师”解锁高薪赛道，做AI时代的技术掌舵者</title>
        <description>&lt;p&gt;AI浪潮席卷开发领域，纯CRUD岗位需求暴跌22%，而&lt;strong&gt;AI+Java全栈复合型人才&lt;/strong&gt;岗位需求暴涨210%，年薪中位数直冲45-70万！你还在做被AI替代的基础开发？不如抢占风口，从Java开发升级为&lt;strong&gt;AI Native全栈工程师&lt;/strong&gt;，一手抓Java全栈硬实力，一手握AI原生开发核心能力，成为企业疯抢的技术稀缺人才！&lt;/p&gt;

&lt;!-- more --&gt;

&lt;p&gt;慕课网“&lt;a href=&quot;https://class.imooc.com/sale/javaaifullstack&quot;&gt;Java+AI全栈工程师&lt;/a&gt;”课程重磅上线，&lt;strong&gt;24周系统化教学+12个月全程伴学&lt;/strong&gt;，从零基础入门到高阶实战，手把手带你打通&lt;strong&gt;后端+前端+AI原生开发&lt;/strong&gt;全场景，以企业级「仿某书」项目贯穿全程，完成从单体架构到分布式、前后端分离、微服务、AI融合、容器化部署的全链路实战，手敲代码锤炼真功夫，让你毕业即能独当一面，轻松拿下高薪offer！&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260320-javaai-001.jpg&quot; alt=&quot;课程主页&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;六大阶段进阶从入门到全栈高手全程ai驱动&quot;&gt;六大阶段进阶，从入门到全栈高手，全程AI驱动&lt;/h2&gt;

&lt;p&gt;拒绝零散知识点，采用&lt;strong&gt;演进式教学体系&lt;/strong&gt;，从基础到高阶层层递进，AI全程融入开发全流程，让你不仅会用AI工具，更能设计AI友好的系统架构，真正实现“AI赋能开发，开发落地AI”：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;AI辅助单体架构&lt;/strong&gt;：吃透Spring全家桶、权限安全、前端基础，完成仿某书单体项目全功能开发，AI助力代码校验、加密与性能优化&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AI融合分布式系统&lt;/strong&gt;：掌握Redis、Kafka、MongoDB核心中间件，实现项目分布式重构，打造高可用、高并发分布式架构&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AI赋能前后端分离&lt;/strong&gt;：精通Vue3前端开发，完成项目前后端分离改造，AI辅助前端组件开发与交互优化&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AI驱动微服务架构&lt;/strong&gt;：吃透Spring Cloud Alibaba生态，基于DDD完成微服务拆分，落地分布式事务与服务治理&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AI原生智能化落地&lt;/strong&gt;：掌握Spring AI生态、提示词工程，实现AI文案生成、评论助手等实战功能，让项目具备真正的AI能力&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AI协同容器化部署&lt;/strong&gt;：精通Docker+K8s容器化技术，完成项目一键编排与部署，掌握AI全栈工程师必备运维能力&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260320-javaai-002.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;企业级实战贯穿学完即拥有可写进简历的核心项目&quot;&gt;企业级实战贯穿，学完即拥有可写进简历的核心项目&lt;/h2&gt;
&lt;p&gt;课程以&lt;strong&gt;企业级社交平台「仿某书」&lt;/strong&gt;为核心实战项目，覆盖笔记发布、内容推荐、互动评论、后台管理等全核心业务场景，架构从&lt;strong&gt;单体→前后端分离→分布式→微服务→AI原生开发→容器化部署&lt;/strong&gt;逐步演进，深度融合AI技术，落地AI辅助开发、智能文案生成等实用功能。
全程都有实操案例、企业级项目实战，从需求分析、架构设计到工程落地、部署运维，还原真实企业开发流程，让你掌握“业务分析→数据应用→架构设计→工程落地”全流程能力，学完即可将高含金量项目写入简历，面试时更有底气！&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260320-javaai-003.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;低门槛入门高含金量输出专为应届生初级工程师转行人士定制&quot;&gt;低门槛入门，高含金量输出，专为应届生/初级工程师/转行人士定制&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;零基础友好&lt;/strong&gt;：技术大咖亲授，从Java基础到AI开发，层层拆解难点，手把手教学，即使是编程小白也能轻松入门&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;全程伴学保障&lt;/strong&gt;：120小时高清视频+12个月教学服务，学习过程全程答疑，解决你的后顾之忧&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;实战能力至上&lt;/strong&gt;：拒绝纸上谈兵，手敲代码，每一个知识点都搭配实战案例，学完即能用，真正做到“学以致用”&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;高薪赛道适配&lt;/strong&gt;：精准对接面向未来的企业核心需求，掌握AI+Java全栈核心技能，适配AI应用开发、微服务架构师、云原生开发等高薪岗位，毕业即具备职场竞争力&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260320-javaai-004.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;现在报名抢占ai时代高薪先机&quot;&gt;现在报名，抢占AI时代高薪先机&lt;/h2&gt;

&lt;p&gt;零风险试学，12个月全程教学服务，让你学透、学懂、学出成果！
告别被AI替代的焦虑，抓住AI时代的技术红利，从Java开发升级为&lt;strong&gt;AI+全栈双料人才&lt;/strong&gt;，从此告别低薪内卷，成为企业争抢的高薪开发工程师！&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260320-javaai-005.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;👉&lt;strong&gt;&lt;a href=&quot;https://class.imooc.com/sale/javaaifullstack&quot;&gt;立即报名&lt;/a&gt;&lt;/strong&gt;，在享受上新特惠价基础上，还能再额外领取优惠券！&lt;/p&gt;

&lt;p&gt;AI时代，技术不升级，就会被淘汰！现在入局，未来可期，你的高薪全栈开发之路，从这里开始！&lt;/p&gt;

&lt;p&gt;视频演示&lt;a href=&quot;https://www.bilibili.com/video/BV1xrAnzdEwr/&quot;&gt;https://www.bilibili.com/video/BV1xrAnzdEwr/&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 20 Mar 2026 00:22:00 +0000</pubDate>
        <link>https://waylau.com/java-ai-fullstack-video/</link>
        <guid isPermaLink="true">https://waylau.com/java-ai-fullstack-video/</guid>
        
        <category>Java</category>
        
        <category>AI</category>
        
        
        <category>Java</category>
        
      </item>
    
      <item>
        <title>不信谣！仓颉编程语言真不是中文编程语言</title>
        <description>&lt;p&gt;在“&lt;a href=&quot;https://coding.imooc.com/class/927.html&quot;&gt;HarmonyOS NEXT+AI大模型打造智能助手APP(仓颉版)&lt;/a&gt;”课程里面以及在一些自媒体平台，有网友提到了这样一个问题：
仓颉编程语言不是中文编程语言吗？怎么语法还是英文？&lt;/p&gt;

&lt;!-- more --&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260202-cangjie-001.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;说实话，看到这种问题，笔者还是比较震惊的，毕竟，仓颉编程语言面市差不多有2年了吧。2024年6月21日下午，华为开发者大会主题演讲《鸿蒙原生应用，全新出发！》中向全球开发者介绍了华为自研编程语言“仓颉”，并发布了HarmonyOS NEXT仓颉编程语言开发者预览版。这是华为首次公开发布仓颉编程语言。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260202-cangjie-006.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;这里就这位网友的问题，统一做下回复，以方便其他同学参考。往期问答，可以在我主页查到。&lt;/p&gt;

&lt;h2 id=&quot;谣言从何而起&quot;&gt;谣言从何而起&lt;/h2&gt;

&lt;p&gt;谣言从何而起呢？时至今日，在网上很多自媒体还在传播仓颉是中文编程语言的谣言。比如以下:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260202-cangjie-002.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260202-cangjie-003.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260202-cangjie-004.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260202-cangjie-005.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;那么，为什么很多人都确信仓颉是中文编程语言的谣言呢？网上流传仓颉是中文编程语言的谣言，根源在于名称联想、信息差、传播机制与认知偏差叠加，再加上官方早期信息不透明，最终形成并扩散。具体原因如下：&lt;/p&gt;

&lt;h3 id=&quot;1名称与文化符号的误导&quot;&gt;1、名称与文化符号的误导&lt;/h3&gt;
&lt;p&gt;“仓颉”源自中文造字神话，天然关联“中文/汉字”意象，易让公众将“语言命名”与“语法本质”混淆。早期讨论中，部分自媒体为吸引眼球，刻意强化“国产自研=中文语法”的错误绑定，放大认知偏差。&lt;/p&gt;

&lt;h3 id=&quot;2官方早期信息不透明与碎片化解读&quot;&gt;2、官方早期信息不透明与碎片化解读&lt;/h3&gt;
&lt;p&gt;仓颉在2022年曝光至2023年逐步公开期间，官方仅强调“鸿蒙生态语言”，未及时明确否认中文语法，给谣言留下传播空间。少量内测截图被断章取义，如中文注释、中文标识符示例被误传为“中文关键字”，进一步加剧误解。&lt;/p&gt;

&lt;h3 id=&quot;3传播机制与流量驱动&quot;&gt;3、传播机制与流量驱动&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;自媒体与社交平台&lt;/strong&gt;：为博流量，部分账号发布“仓颉=中文编程”的标题党内容，利用“国产替代”情绪制造话题，导致错误信息病毒式传播。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;信息茧房效应&lt;/strong&gt;：中文社区对“本土语言降低入门门槛”的期待，使谣言在同类群体中反复强化，形成“三人成虎”的传播闭环。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4概念混淆与认知偏差&quot;&gt;4、概念混淆与认知偏差&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;中文命名≠中文语法&lt;/strong&gt;：公众易将编程语言的“命名”与“关键字/语法体系”等同，忽视关键字仅为助记符，与底层编译逻辑无关。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;中文编程的刻板印象&lt;/strong&gt;：部分人认为“国产语言必须用中文”，忽略全球编程生态以英文为通用规范的现实，将“中文友好”误读为“中文语法”。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;技术细节认知不足&lt;/strong&gt;：多数非开发者不了解编译器、工具链基于英文优化，中文语法需重构工具链的技术成本，从而轻信“仓颉用中文语法”的传言。&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;5中文编程的市场期待与情绪放大&quot;&gt;5、中文编程的市场期待与情绪放大&lt;/h3&gt;
&lt;p&gt;国内长期存在“中文编程降低入门门槛”的呼声，易语言等案例强化了“中文编程可行”的认知，公众将对“本土语言”的期待投射到仓颉上，进一步推动谣言传播。&lt;/p&gt;

&lt;h2 id=&quot;仓颉编程语言是英文编程语言&quot;&gt;仓颉编程语言是英文编程语言&lt;/h2&gt;

&lt;p&gt;仓颉编程语言并非中文编程语言，其关键字、语法体系均采用国际通用的英文范式，仅名称源自中文造字神话，官方也明确否认其为中文编程。核心原因可归纳为以下几点：&lt;/p&gt;

&lt;h3 id=&quot;1设计定位与生态兼容&quot;&gt;1、设计定位与生态兼容&lt;/h3&gt;
&lt;p&gt;仓颉的核心目标是打造鸿蒙生态的全场景现代编程语言，追求高性能、强安全与跨平台能力，需兼容全球开发者社区与主流技术栈。若采用中文关键字，会与C/C++、Java、TypeScript等主流语言的语法习惯割裂，大幅增加开发者迁移成本，阻碍生态扩张。&lt;/p&gt;

&lt;h3 id=&quot;2技术与工程效率考量&quot;&gt;2、技术与工程效率考量&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;输入与编码效率&lt;/strong&gt;：英文关键字（如if、for、class）字符少、输入快，适配ASCII/Unicode的底层编码体系；中文关键字易出现编码不一致、大小写/全半角混淆等问题，增加协作与调试难度。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;编译与工具链适配&lt;/strong&gt;：现有编译器、IDE、静态检查工具均基于英文关键字优化，中文语法需重构整套工具链，研发成本高且兼容性风险大。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;性能无增益&lt;/strong&gt;：关键字仅为助记符，最终都会编译为二进制指令，中文与否不影响运行性能。&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;3社区协作与知识共享&quot;&gt;3、社区协作与知识共享&lt;/h3&gt;
&lt;p&gt;全球编程生态以英文为通用语言，技术文档、开源项目、社区讨论均依赖英文体系。仓颉采用英文语法，可降低跨国协作门槛，快速融入全球开源社区，吸引更多开发者参与共建。&lt;/p&gt;

&lt;h3 id=&quot;4中文编程的局限性&quot;&gt;4、中文编程的局限性&lt;/h3&gt;
&lt;p&gt;中文编程语言（如易语言）虽降低入门门槛，但存在语法冗余、工具链不完善、跨平台适配差等问题，难以满足系统级开发与大规模团队协作需求。仓颉优先保障语言的专业性与通用性，中文仅作为辅助文档语言，而非核心语法元素。&lt;/p&gt;

&lt;h2 id=&quot;谣言止于智者&quot;&gt;谣言止于智者&lt;/h2&gt;

&lt;p&gt;仓颉编程语言虽然不是中文编程语言，但它是中国的编程语言，由华为公司自研，是国产自研的代表作！&lt;/p&gt;

&lt;p&gt;要终止谣言，最好的方式就是去接触它，了解它。&lt;/p&gt;

&lt;p&gt;更多仓颉学习资料，详见：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;原文同步至：&lt;a href=&quot;https://waylau.com/cangjie-programming-language-is-not-a-chinese-programming-language/&quot;&gt;https://waylau.com/cangjie-programming-language-is-not-a-chinese-programming-language/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学HarmonyOS开发》：&lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial&quot;&gt;https://github.com/waylau/harmonyos-tutorial&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学仓颉编程语言开发》：&lt;a href=&quot;https://github.com/waylau/cangjie-programming-language-tutorial&quot;&gt;https://github.com/waylau/cangjie-programming-language-tutorial&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;“HarmonyOS NEXT+AI大模型打造智能助手APP(仓颉版)”：&lt;a href=&quot;https://coding.imooc.com/class/927.html&quot;&gt;https://coding.imooc.com/class/927.html&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《仓颉编程从入门到实践》（北京大学出版社）：&lt;a href=&quot;https://coding.imooc.com/class/927.html&quot;&gt;https://coding.imooc.com/class/927.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 02 Feb 2026 00:22:00 +0000</pubDate>
        <link>https://waylau.com/cangjie-programming-language-is-not-a-chinese-programming-language/</link>
        <guid isPermaLink="true">https://waylau.com/cangjie-programming-language-is-not-a-chinese-programming-language/</guid>
        
        <category>Cangjie</category>
        
        <category>HarmonyOS</category>
        
        
        <category>Cangjie</category>
        
      </item>
    
      <item>
        <title>首本鸿蒙架构师培养手册《鸿蒙架构师修炼之道》简介</title>
        <description>&lt;p&gt;《鸿蒙架构师修炼之道》已于近日上市，该书由北京大学出版社出版。该书主要介绍如何培养鸿蒙架构师，内容涉及HarmonyOS架构设计思维/原理/模式、工具、编程语言、UI设计、线程模型设计、通信设计、持久化设计、安全性、测试、调优调测等多方面。&lt;/p&gt;

&lt;p&gt;本文希望与读者朋友们分享下这本书里面的大致内容。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h2 id=&quot;封面部分&quot;&gt;封面部分&lt;/h2&gt;

&lt;p&gt;首先是介绍封面部分。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260127-harmonyos-architect-001.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;《鸿蒙架构师修炼之道》封面右上角是本书的书名，清晰凸显出“鸿蒙”及“HarmonyOS”字眼。&lt;/p&gt;

&lt;p&gt;封面整体色调是青色，小清新、富有活力。&lt;/p&gt;

&lt;p&gt;右下角貌似是一只蜂鸟。蜂鸟寓意着坚韧与勇气‌：蜂鸟体型虽小，却拥有惊人的飞行能力，能悬停、倒飞，象征着以微小之躯挑战巨大困难的精神。本书封面配以蜂鸟，体现了在鸿蒙架构师修炼道路上，需要极大的勇气与自我价值的肯定。‌&lt;/p&gt;

&lt;p&gt;封面左下角体现了本书的一些特色，比如：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;本书附赠完整的源代码和习题，所有代码均经过严格测试验证，确保能够顺利运行并达到预期效果。这对于大中院校的师生来说非常友好，直接可以将这本书作为学习鸿蒙的上课教材。&lt;/li&gt;
  &lt;li&gt;本书介绍专家级架构师的思维方式与工作方法。&lt;/li&gt;
  &lt;li&gt;本书介绍HarmonyOS架构设计思维/原理/模式、工具、编程语言、UI设计、线程模型设计、通信设计、持久化设计、安全性、测试、调优调测等多方面。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;封面底部是出版社“北京大学出版社”字样。&lt;/p&gt;

&lt;h2 id=&quot;封底部分&quot;&gt;封底部分&lt;/h2&gt;

&lt;p&gt;介绍封底部分。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260127-harmonyos-architect-002.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;封底部分较为简介，跟封面内容相似。&lt;/p&gt;

&lt;p&gt;全书400页，较为丰富，定价为119元，也不算贵，非常极具有性价比。&lt;/p&gt;

&lt;h2 id=&quot;内容简介&quot;&gt;内容简介&lt;/h2&gt;

&lt;p&gt;所有程序员都有成为架构师的潜力，只要掌握了架构师的思维方式和工作方法，你也能成长为架构师。 鸿蒙操作系统是华为自研的、面向万物互联的全场景分布式操作系统，支持手机、平板、PC、智能穿戴、智慧屏等多种终端设备运行，是提供应用开发、设备开发的一站式服务的平台。随着 HarmonyOS NEXT 正式 发布，市面上对于鸿蒙架构设计方面的需求呈井喷之势。 本书以最新的 HarmonyOS 版本为基石，详细介绍成为鸿蒙架构师应具备和掌握的核心能力和工 作方法，包括架构设计思维、架构设计原理、架构设计模式、工具、编程语言、UI 设计、线程模型设计、通信设计、持久化设计、安全性、测试、调优调测等多个主题。 本书不但通过真实案例讲解架构设计流程和经验，还总结了丰富的鸿蒙架构师工作原则和技巧，尤其适合广大鸿蒙程序员进阶学习。同时，学习本书也有助于产品经理、测试人员、运维人员和其他行业从业者理解鸿蒙软件架构设计工作。&lt;/p&gt;

&lt;p&gt;全书总共包含13章，包括：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;第1章 成为鸿蒙架构师&lt;/li&gt;
  &lt;li&gt;第2章 架构设计思维&lt;/li&gt;
  &lt;li&gt;第3章 架构设计原理
8 第4章 架构设计模式&lt;/li&gt;
  &lt;li&gt;第5章 工具&lt;/li&gt;
  &lt;li&gt;第6章 编程语言&lt;/li&gt;
  &lt;li&gt;第7章 UI设计&lt;/li&gt;
  &lt;li&gt;第8章 线程模型设计&lt;/li&gt;
  &lt;li&gt;第9章 通信设计&lt;/li&gt;
  &lt;li&gt;第10章 持久化设计&lt;/li&gt;
  &lt;li&gt;第11章 安全性&lt;/li&gt;
  &lt;li&gt;第12章 测试&lt;/li&gt;
  &lt;li&gt;第13章 调优调测&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;更多介绍，详见“参考引用”。&lt;/p&gt;

&lt;h2 id=&quot;写作背景&quot;&gt;写作背景&lt;/h2&gt;

&lt;p&gt;自HarmonyOS面世之时，笔者便已经开始关注HarmonyOS的发展。笔者在各大论坛也对HarmonyOS进行过非常多的文章介绍以及技术布道。本书所选用HarmonyOS版本的也是市面上能看到的最新正式版本。&lt;/p&gt;

&lt;p&gt;由于笔者长期混迹于鸿蒙开发与推广，出版过多本关于鸿蒙的专著，包括《鸿蒙HarmonyOS手机应用开发实战》《鸿蒙HarmonyOS应用开发从入门到精通》《鸿蒙之光HarmonyOS NEXT原生应用开发入门》《鸿蒙之光HarmonyOS 6应用开发入门》等等，并在长期维护一本开源书《&lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial&quot;&gt;跟老卫学HarmonyOS开发&lt;/a&gt;》，但这些书籍都是介绍如何入门鸿蒙生态，如何进行HarmonyOS应用开发。《鸿蒙架构师修炼之道》不同点在于，这是一本专注于培养鸿蒙架构师的教程，是一名鸿蒙开发老兵的经验升华，在业界尚属首例。&lt;/p&gt;

&lt;p&gt;本书的内容聚焦于告诉读者鸿蒙架构师是如何修炼的，成为鸿蒙架构师应具备怎么样的核心能力和工作方法，包括架构设计思维、架构设计原理、架构设计模式、工具、编程语言、UI设计、线程模型设计、通信设计、持久化设计、安全性、测试、调优调测等。本书不但通过真实案例讲解架构设计流程和经验，还总结了丰富的鸿蒙架构师工作原则和技巧，尤其适合广大鸿蒙开发人员进阶学习。&lt;/p&gt;

&lt;h2 id=&quot;源代码&quot;&gt;源代码&lt;/h2&gt;

&lt;p&gt;本书提供的素材和源代码可从以下网址下载：
&lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial&quot;&gt;https://github.com/waylau/harmonyos-tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;勘误和交流&quot;&gt;勘误和交流&lt;/h2&gt;

&lt;p&gt;本书如有勘误，会在以下网址发布：
&lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial/issues&quot;&gt;https://github.com/waylau/harmonyos-tutorial/issues&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;原文同步至：&lt;a href=&quot;https://waylau.com/about-the-cultivation-of-harmonyos-architect-book/&quot;&gt;https://waylau.com/about-the-cultivation-of-harmonyos-architect-book/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;视频介绍可见B站：&lt;a href=&quot;https://www.bilibili.com/video/BV1hw6TBiEgQ/&quot;&gt;https://www.bilibili.com/video/BV1hw6TBiEgQ/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://item.jd.com/15299684.html&quot;&gt;京东&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://product.dangdang.com/30005979.html&quot;&gt;当当&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Tue, 27 Jan 2026 00:22:00 +0000</pubDate>
        <link>https://waylau.com/about-the-cultivation-of-harmonyos-architect-book/</link>
        <guid isPermaLink="true">https://waylau.com/about-the-cultivation-of-harmonyos-architect-book/</guid>
        
        <category>HarmonyOS</category>
        
        
        <category>HarmonyOS</category>
        
      </item>
    
      <item>
        <title>2026新年首发《鸿蒙之光HarmonyOS 6应用开发入门》简介</title>
        <description>&lt;p&gt;《鸿蒙之光HarmonyOS 6应用开发入门》已于近日上市，该书由清华大学出版社出版。该书以HarmonyOS 6版本为核心，从基础知识到实战案例，引领读者逐步探索“纯血鸿蒙”原生开发的奥秘。&lt;/p&gt;

&lt;p&gt;本文希望与读者朋友们分享下这本书里面的大致内容。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h2 id=&quot;封面部分&quot;&gt;封面部分&lt;/h2&gt;

&lt;p&gt;首先是介绍封面部分。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260108-harmonyos6-001.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;《鸿蒙之光HarmonyOS 6应用开发入门》封面左上角是本书的一些案例介绍，包括计算器、打卡应用、图片轮播播放器、购物车、录音机、音乐播放器、购物应用、仿微信应用、AI扫描应用、AI语音识别等原生应用。&lt;/p&gt;

&lt;p&gt;封面中部也体现了本书的一些特色，比如本书附赠完整的上机练习、源代码和PPT课件，所有代码均经过严格测试验证，确保能够顺利运行并达到预期效果。这对于大中院校的师生来说非常友好，直接可以将这本书作为学习鸿蒙的上课教材。&lt;/p&gt;

&lt;p&gt;封面底部是出版社“清华大学出版社”字样以及防伪标签。&lt;/p&gt;

&lt;h2 id=&quot;封底部分&quot;&gt;封底部分&lt;/h2&gt;

&lt;p&gt;介绍封底部分。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20260108-harmonyos6-002.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;封底部分主要分为以下几个部分。&lt;/p&gt;

&lt;h3 id=&quot;1-主要特色&quot;&gt;1. 主要特色&lt;/h3&gt;

&lt;p&gt;本书以新的原生鸿蒙HarmonyOS 6版本为基石，详细介绍如何基于HarmonyOS进行应用开发，内容包括HarmonyOS架构、DevEco Studio的使用、应用结构、ArkTS语言、Ability组件、ArkUI开发、公共事件、窗口管理、网络编程、安全管理、数据管理、多媒体开发、多端部署、应用测试、AI能力等多个主题。
本书还介绍从0开始开发计算器、WeLink打卡应用、图片轮播播放器、购物车、录音机、音乐播放器、购物应用、仿微信应用、图片查看器、Al扫描应用等大量实战案例，便于读者即学即练，快速提升实战技能。
本书各章还提供上机练习，并针对每个上机练习给出步骤指南，读者按着步骤操作即可轻松设计出目标应用。&lt;/p&gt;

&lt;h3 id=&quot;2-适合的读者&quot;&gt;2. 适合的读者&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;初学者：对于刚开始接触HarmonyOS应用开发的读者，本书提供从基础概念到具体实践的全面介绍，包括HarmonyOS架构、DevEco Studio的使用、应用结构等基础知识。&lt;/li&gt;
  &lt;li&gt;转型鸿蒙HarmonyOS的开发者：已经具有早期HarmonyOS版本知识的开发者或转型鸿蒙系统的开发人员，可以通过本书了解原生鸿蒙HarmonyOS 6系统的新特性，提升多方面的开发技能，增强个人职场竞争力。&lt;/li&gt;
  &lt;li&gt;教育工作者和学生：培训机构或大专院校相关专业的教师和学生可以将本书作为教学参考书使用，书中丰富的内容和实战案例有助于理论与实践的结合。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;3-篇幅和定价&quot;&gt;3. 篇幅和定价&lt;/h3&gt;

&lt;p&gt;全书380页，较为丰富，定价为99元，也不算贵，非常极具有性价比。&lt;/p&gt;

&lt;h2 id=&quot;内容简介&quot;&gt;内容简介&lt;/h2&gt;

&lt;p&gt;《鸿蒙之光HarmonyOS6应用开发入门》以HarmonyOS6版本为核心，从基础知识到实战案例，引领读者逐步探索“纯血鸿蒙”原生开发的奥秘。本书共分18章，内容涵盖HarmonyOS架构、DevEcoStudio使用、应用结构解析、ArkTS编程语言、Ability组件、ArkUI开发、公共事件处理、窗口管理、网络编程、安全管理、数据管理、多媒体开发、多端部署、应用测试及AI能力等关键主题。书中不仅详细阐述了相关理论知识，还结合了多个实战项目，如计算器开发、WeLink打卡系统、图片轮播播放器、购物车功能实现、录音机与音乐播放器创建、视频AI字幕与语音识别功能实现、购物应用设计与应用模拟、图片查看器构建、AI扫描应用开发等，旨在通过实际操作提升读者的动手能力和解决实际问题的能力。此外，《鸿蒙之光HarmonyOS 6应用开发入门》还附赠完整的源码和PPT课件，所有源码均经过严格测试验证，确保能够顺利运行并达到预期效果。《鸿蒙之光HarmonyOS 6应用开发入门》技术新颖，案例丰富，突出实战，特别适合作为HarmonyOS应用开发初学者、爱好者和进阶者的自学用书，也适合作为培训机构和大中专院校的教学用书。&lt;/p&gt;

&lt;h2 id=&quot;写作背景&quot;&gt;写作背景&lt;/h2&gt;

&lt;p&gt;早在HarmonyOS 6正式发布之前，笔者便已密切关注其发展路线图，参加了多次华为组织的HarmonyOS 6开发者预览版Beta定向招募活动，开发了多款HarmonyOS 6应用。在各大论坛，笔者撰写了大量关于HarmonyOS 6新特性的文章，并进行技术布道，主讲了包括“鸿蒙HarmonyOS 6 AI应用开发”在内的多门视频课程。本书所选用的HarmonyOS 6版本是市面上首个正式版，具有重要的参考价值。&lt;/p&gt;

&lt;p&gt;笔者此前已出版多本专著，如《鸿蒙HarmonyOS手机应用开发实战》《鸿蒙HarmonyOS应用开发从入门到精通》《鸿蒙HarmonyOS应用开发入门》和《鸿蒙之光HarmonyOS NEXT原生应用开发入门》，并长期维护开源书《跟老卫学HarmonyOS开发》。因此，撰写本书并未遇到太多困难。本书聚焦于HarmonyOS 6版本的常用核心功能，这些功能均经过笔者验证，确保可用性。其他非核心功能或存在bug的功能未收录本书，但会收入《跟老卫学HarmonyOS开发》并以开源方式不断演进。&lt;/p&gt;

&lt;h2 id=&quot;内容介绍&quot;&gt;内容介绍&lt;/h2&gt;

&lt;p&gt;本书以HarmonyOS 6版本为核心，通过循序渐进的方式，从基础理论到项目实战，引领读者深入探索“纯血鸿蒙”原生开发的精髓。全书内容从逻辑上分为三个主要部分：&lt;/p&gt;

&lt;p&gt;入门（第1章）：介绍HarmonyOS 6的背景，并指导如何搭建开发环境，以及创建一个基础的HarmonyOS 6应用程序。&lt;/p&gt;

&lt;p&gt;进阶（第2~14章）：深入讲解HarmonyOS 6的核心开发功能，包括ArkTS语言、Ability框架、ArkUI开发、公共事件处理、窗口管理、网络编程、安全管理、数据管理、多媒体开发、一次开发多端部署、应用测试及AI能力等多个方面。&lt;/p&gt;

&lt;p&gt;实战（第15~18章）：通过综合案例，如“仿微信应用”“一多图片查看器”“购物应用”和“AI扫描应用”，展示HarmonyOS 6的实际应用开发。&lt;/p&gt;

&lt;p&gt;本书不仅详细阐述了相关理论知识，还配合核心功能给出了诸多开发案例，如计算器开发、WeLink打卡、图片轮播播放器、购物车功能实现、录音机与音乐播放器创建、视频AI字幕与语音识别功能实现等，还在各章安排了上机练习题，旨在通过实际操作提升读者的动手能力和解决实际问题的能力。&lt;/p&gt;

&lt;h2 id=&quot;技术版本&quot;&gt;技术版本&lt;/h2&gt;

&lt;p&gt;技术的版本非常重要，因为不同版本之间存在兼容性问题，且不同版本的软件功能各异。本书列出的技术版本相对较新，均经过笔者测试。建议读者将相关开发环境设置为与本书一致，或不低于本书所列配置，以避免版本兼容性问题。&lt;/p&gt;

&lt;p&gt;本书所采用的技术与版本的详细配置如下：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;DevEco Studio 6.0.0 Release（6.0.0.858）&lt;/li&gt;
  &lt;li&gt;HarmonyOS 6.0.0 Release SDK&lt;/li&gt;
  &lt;li&gt;操作系统：Windows 10 64位、Windows 11 64位&lt;/li&gt;
  &lt;li&gt;内存：16GB及以上&lt;/li&gt;
  &lt;li&gt;硬盘：100GB及以上&lt;/li&gt;
  &lt;li&gt;分辨率：1280*800像素及以上&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;源代码&quot;&gt;源代码&lt;/h2&gt;

&lt;p&gt;本书提供的素材和源代码可从以下网址下载：
&lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial&quot;&gt;https://github.com/waylau/harmonyos-tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;勘误和交流&quot;&gt;勘误和交流&lt;/h2&gt;

&lt;p&gt;本书如有勘误，会在以下网址发布：
&lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial/issues&quot;&gt;https://github.com/waylau/harmonyos-tutorial/issues&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;原文同步至：&lt;a href=&quot;https://waylau.com/about-harmonyos-6-tutorial-book/&quot;&gt;https://waylau.com/about-harmonyos-6-tutorial-book/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;视频介绍可见B站：&lt;a href=&quot;https://www.bilibili.com/video/BV1b1rwBREbk/&quot;&gt;https://www.bilibili.com/video/BV1b1rwBREbk/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://item.jd.com/10208282739020.html&quot;&gt;京东&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://search.dangdang.com/?key=%BA%E8%C3%C9%D6%AE%B9%E2HarmonyOS%206%D3%A6%D3%C3%BF%AA%B7%A2%C8%EB%C3%C5&amp;amp;act=input&quot;&gt;当当&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Thu, 08 Jan 2026 00:22:00 +0000</pubDate>
        <link>https://waylau.com/about-harmonyos-6-tutorial-book/</link>
        <guid isPermaLink="true">https://waylau.com/about-harmonyos-6-tutorial-book/</guid>
        
        <category>HarmonyOS</category>
        
        
        <category>HarmonyOS</category>
        
      </item>
    
      <item>
        <title>Amazon EC2云服务器搭建OpenVPN</title>
        <description>&lt;p&gt;本文演示如何使用Amazon EC2云服务器来搭建OpenVPN。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h2 id=&quot;登录aws管理控制台创建ec2实例&quot;&gt;登录AWS管理控制台创建EC2实例&lt;/h2&gt;

&lt;p&gt;登录AWS管理控制台&lt;a href=&quot;http://aws.amazon.com/console&quot;&gt;http://aws.amazon.com/console&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;创建ec2实例&quot;&gt;创建EC2实例&lt;/h2&gt;

&lt;p&gt;进入EC2控制台，操作系统可以选自己熟悉的，比如Ubuntu。实例名字自己定义，比如填“openvpn”。点击“启动实例”。&lt;/p&gt;

&lt;p&gt;创建密钥，比如“openvpn-key.pem”，然后下载。&lt;/p&gt;

&lt;h2 id=&quot;配置ec2实例&quot;&gt;配置EC2实例&lt;/h2&gt;

&lt;p&gt;在EC2实例中，选择安全组，入站规则加一条：使用UDP 1194端口。这个是OpenVPN的端口，UDP端口号可以自己定义。&lt;/p&gt;

&lt;h2 id=&quot;使用脚本配置openvpn服务器&quot;&gt;使用脚本配置OpenVPN服务器&lt;/h2&gt;

&lt;p&gt;切换到root模式。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;没有root用户，可以启用下&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;passwd root 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;下载执行脚本&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x openvpn-install.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行脚本&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./openvpn-install.sh interactive
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;交互过程中，可以都选择默认的选项。最后一步会要求输入一个OpenVPN客户端的名称，可以自定义比如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;waylau&lt;/code&gt;。脚本执行完成后，会生成一个配置文件，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/root/&lt;/code&gt;目录下会有一个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;waylau.opvn&lt;/code&gt; 文件。复制该文件内容或者下载该文件到你的本地，然后使用OpenVPN客户端配置导入这个.opvn 文件建立连接即可。&lt;/p&gt;
</description>
        <pubDate>Tue, 30 Dec 2025 00:22:00 +0000</pubDate>
        <link>https://waylau.com/quick-setup-openvpn-server-on-aws/</link>
        <guid isPermaLink="true">https://waylau.com/quick-setup-openvpn-server-on-aws/</guid>
        
        <category>OpenVPN</category>
        
        <category>AWS</category>
        
        
        <category>OpenVPN</category>
        
      </item>
    
      <item>
        <title>Cangjie新作《仓颉编程从入门到实践》简介</title>
        <description>&lt;p&gt;《仓颉编程从入门到实践》由北京大学出版社出版，已于近期上市。该书基于Cangjie 0.53.8编写，提供41个实战案例+3个综合案例，可谓是目前市面上最新的仓颉力作。&lt;/p&gt;

&lt;p&gt;本文对《仓颉编程从入门到实践》一书做个大致的介绍。&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h2 id=&quot;封面部分&quot;&gt;封面部分&lt;/h2&gt;

&lt;p&gt;首先是介绍封面部分。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20251128-cangjie-01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;《仓颉编程从入门到实践》封面部分主体是采用了蓝白风格，具有科技感，充满活力。&lt;/p&gt;

&lt;p&gt;可以看到，左下角和右上角体现了本书的特色，知识点涵盖丰富，案例新颖，同时本书也提供了全套源码，方便教学。&lt;/p&gt;

&lt;p&gt;底部是出版社“北京大学出版社”字样。&lt;/p&gt;

&lt;h2 id=&quot;封底部分&quot;&gt;封底部分&lt;/h2&gt;

&lt;p&gt;介绍封底部分。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;../images/post/20251128-cangjie-02.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;封底部分比较简洁，除了ISBN码和定价之外，还有出版社的联系方式。全书篇幅366页，定价为99元，也算良心了。极具性价比。&lt;/p&gt;

&lt;h2 id=&quot;内容简介&quot;&gt;内容简介&lt;/h2&gt;

&lt;p&gt;随着万物互联以及智能时代的到来，软件的形态将发生巨大的变化。一方面，移动应用和移动互联网领域仍然强力驱动人机交互、设备协同、智能化、安全性等方向的创新，另一方面人工智能也同样驱动软件朝智能化、端边云协同等方向演进。新技术、新场景下应用软件的开发对编程语言提出了新的诉求和挑战。&lt;/p&gt;

&lt;p&gt;华为自研的仓颉（Cangjie）编程语言作为一款面向全场景应用开发的现代编程语言，通过现代语言特性的集成、全方位的编译优化和运行时实现、以及开箱即用的工具链支持，为开发者打造友好开发体验和卓越程序性能。本书主要是介绍仓颉编程语言开发，内容涉及仓颉编程语言的通用编程概念、基本数据类型、类、接口、扩展、模式匹配、泛型、集合类型、异常处理、包、基础I/O操作、函数式编程、并发编程、宏编程、网络编程、自动化测试、CJPM包管理等众多话题，可谓是仓颉编程语言的“百科全书”。其中综合实战部分，演示了KV数据库、雪花算法、HarmonyOS瀑布流的实现过程，可以令读者从0开始掌握仓颉编程语言。&lt;/p&gt;

&lt;p&gt;本书实例丰富，将理论讲解最终落实到代码实现上。本书由浅及深、层层推进、结构清晰、实例丰富、通俗易懂、实用性强，适合仓颉编程语言的初学者和进阶读者作为自学教程，也适合培训学校作为培训教材，还适合各大院校的相关专业作为教学参考书。&lt;/p&gt;

&lt;p&gt;具体来说，全书分为以下部分。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;（1）入门（第1～10章）：介绍仓颉编程语言的基础知识，包括开发环境、通用编程概念、基本数据类型、类、接口、扩展、模式匹配、泛型、集合类型、异常处理、包、模块、基础I/O操作等；&lt;/li&gt;
  &lt;li&gt;（2）进阶（第11～14章）：介绍仓颉编程语言的函数式编程、并发编程、宏编程、网络编程等；&lt;/li&gt;
  &lt;li&gt;（3）高阶（第15～16章）：介绍仓颉编程语言的CJPM包管理、自动化测试等方面的内容；&lt;/li&gt;
  &lt;li&gt;（4）实战（第17～19章）：介绍颉编程语言的综合实战案例，包括业界主流的KV数据库、雪花算法、HarmonyOS瀑布流。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;写作背景&quot;&gt;写作背景&lt;/h2&gt;

&lt;p&gt;在2024年6月21日华为开发者大会上，华为正式官宣了其自研仓颉编程语言。该语言历经5年研发沉淀，终于开启了开发者预览。&lt;/p&gt;

&lt;p&gt;作为一款面向全场景应用开发的现代编程语言，仓颉编程语言通过现代语言特性的集成、全面的编译优化和运行时实现，以及开箱即用的工具链支持，为开发者打造了友好开发体验和卓越程序性能。然而，作为一门新兴语言，仓颉在教程、书籍、课程等方面的学习资源比较少，因此出版一本全面、深入、实用的仓颉编程语言专著，对于满足市场需求、推动仓颉编程语言的发展具有重要意义。&lt;/p&gt;

&lt;p&gt;本书的定位是一本全面介绍仓颉编程语言的专著。本书从基础知识讲起，逐步深入高级特性和最佳实践。同时，本书还将结合具体的案例和项目，让读者能够在实际操作中掌握仓颉编程语言的编程技巧。希望本书能够带领读者入门仓颉编程语言，扫清学习障碍。&lt;/p&gt;

&lt;h2 id=&quot;配套资源&quot;&gt;配套资源&lt;/h2&gt;

&lt;p&gt;本书提供的素材和源代码可从以下网址下载：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/waylau/cangjie-programming-language-tutorial&quot;&gt;https://github.com/waylau/cangjie-programming-language-tutorial&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;勘误和交流&quot;&gt;勘误和交流&lt;/h2&gt;

&lt;p&gt;本书如有勘误，会在以下网址发布：
&lt;a href=&quot;https://github.com/waylau/cangjie-programming-language-tutorial/issues&quot;&gt;https://github.com/waylau/cangjie-programming-language-tutorial/issues&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;视频介绍&quot;&gt;视频介绍&lt;/h2&gt;

&lt;p&gt;见B站：&lt;a href=&quot;https://www.bilibili.com/video/BV1iBSWBEEMu/&quot;&gt;https://www.bilibili.com/video/BV1iBSWBEEMu/&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;配套书籍课程&quot;&gt;配套书籍、课程&lt;/h2&gt;

&lt;p&gt;如果你喜欢本开源书，也欢迎支持下该书的正式出版物，实体店及各大网店有售。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://item.jd.com/15220500.html&quot;&gt;京东&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://product.dangdang.com/29968628.html&quot;&gt;当当&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;原文同步至：&lt;a href=&quot;https://waylau.com/about-cangjie-programming-language-tutorial-book/&quot;&gt;https://waylau.com/about-cangjie-programming-language-tutorial-book/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学仓颉编程语言开发》：&lt;a href=&quot;https://github.com/waylau/cangjie-programming-language-tutorial&quot;&gt;https://github.com/waylau/cangjie-programming-language-tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 28 Nov 2025 00:22:00 +0000</pubDate>
        <link>https://waylau.com/about-cangjie-programming-language-tutorial-book/</link>
        <guid isPermaLink="true">https://waylau.com/about-cangjie-programming-language-tutorial-book/</guid>
        
        <category>仓颉</category>
        
        
        <category>仓颉</category>
        
      </item>
    
      <item>
        <title>HarmonyOS通过wifiManager来连接Wi-Fi</title>
        <description>&lt;p&gt;本文介绍了在HarmonyOS应用开发过程中，如何通过wifiManager来连接Wi-Fi。
&lt;!-- more --&gt;&lt;/p&gt;

&lt;h2 id=&quot;wi-fi及sta模式简介&quot;&gt;Wi-Fi及STA模式简介&lt;/h2&gt;

&lt;p&gt;无线局域网（Wireless Local Area Networks，WLAN），是通过无线电、红外光信号或者其他技术发送和接收数据的局域网，用户可以通过WLAN实现节点之间无物理连接的网络通讯。常用于用户携带可移动终端的办公、公众环境中。&lt;/p&gt;

&lt;p&gt;Wi-Fi（Wireless Fidelity），是一种基于无线电波的通信技术，用于设备之间传输数据，使得用户可以无需使用有线连接即可访问互联网和共享数据。&lt;/p&gt;

&lt;p&gt;WLAN系统为用户提供接入WLAN网络功能（STA模式）、点对点的数据传输功能（P2P模式）和热点分享功能（AP模式），让应用可以通过WLAN和其他设备互联互通。&lt;/p&gt;

&lt;p&gt;Wi-Fi STA模式（Station Mode，站点模式）是无线设备作为客户端接入无线局域网（WLAN）的工作模式。在该模式下，设备（如手机、电脑、平板等）通过连接到接入点（AP，Access Point）或无线路由器，实现对网络的访问。&lt;/p&gt;

&lt;h2 id=&quot;应用实现&quot;&gt;应用实现&lt;/h2&gt;

&lt;p&gt;应用实现步如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;建立Wi-Fi连接&lt;/li&gt;
  &lt;li&gt;导入需要的Wi-Fi模块。&lt;/li&gt;
  &lt;li&gt;开启设备的Wi-Fi。&lt;/li&gt;
  &lt;li&gt;需要SystemCapability.Communication.WiFi.STA系统能力。&lt;/li&gt;
  &lt;li&gt;需要申请权限&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ohos.permission.GET_WIFI_INFO&lt;/code&gt;，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ohos.permission.SET_WIFI_INFO&lt;/code&gt;。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;示例代码：&lt;/p&gt;

&lt;div class=&quot;language-ts highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;wifiManager&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;@kit.ConnectivityKit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Entry&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Component&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Index&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;State&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ssid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;State&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;securityType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;State&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;


  &lt;span class=&quot;nx&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;Column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

      &lt;span class=&quot;nx&quot;&gt;Row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;WiFi名称：&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;TextInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ssid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;80%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ssid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

      &lt;span class=&quot;nx&quot;&gt;Row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;密码：&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;TextInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;InputType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;80%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

      &lt;span class=&quot;c1&quot;&gt;// 操作按钮&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;Row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;连接该网络&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ButtonType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Capsule&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fontColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;White&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// 连接到WiFi&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;connectToWifi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;10%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;justifyContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;FlexAlign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;justifyContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;FlexAlign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// 连接到WiFi&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;connectToWifi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wifiManager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;WifiDeviceConfig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;ssid&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ssid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;preSharedKey&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;securityType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;config:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// 添加候选网络配置&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;wifiManager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addCandidateConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// 连接至网络&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;addCandidateConfig result:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

      &lt;span class=&quot;nx&quot;&gt;wifiManager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;connectToCandidateConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}).&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;failed:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;权限设置如下：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nl&quot;&gt;&quot;requestPermissions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ohos.permission.SET_WIFI_INFO&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;usedScene&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;abilities&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;EntryAbility&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;when&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;inuse&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ohos.permission.GET_WIFI_INFO&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;usedScene&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;abilities&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;EntryAbility&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;when&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;inuse&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行应用，界面效果如下。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251110-harmonyos6-001.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;输入Wi-Fi账号、密码，点击应用“连接该网络”，界面效果如下。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251110-harmonyos6-002.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251110-harmonyos6-003.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在浏览器里面访问被访问的应用，界面效果如下。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251110-harmonyos6-004.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;完整示例详见文末链接《跟老卫学HarmonyOS开发》中“ArkTSWifiManagerConnectToWifi”。&lt;/p&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;p&gt;加入鸿蒙生态，共建万物互联。以下是鸿蒙应用开发常用教程。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;本文同步至：&lt;a href=&quot;https://waylau.com/harmonyos-wifi-manager-connect-to-wifi/&quot;&gt;https://waylau.com/harmonyos-wifi-manager-connect-to-wifi/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学HarmonyOS开发》开源免费教程， &lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial&quot;&gt;https://github.com/waylau/harmonyos-tutorial&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学AI大模型开发》开源免费教程， https://github.com/waylau/ai-large-model-tutorial/&lt;/li&gt;
  &lt;li&gt;《跟老卫学仓颉编程语言开发》开源免费教程， https://github.com/waylau/cangjie-programming-language-tutorial&lt;/li&gt;
  &lt;li&gt;《鸿蒙HarmonyOS手机应用开发实战》（清华大学出版社）&lt;/li&gt;
  &lt;li&gt;《鸿蒙HarmonyOS应用开发入门》（清华大学出版社）&lt;/li&gt;
  &lt;li&gt;“鸿蒙零基础快速实战-仿抖音App开发（ArkTS版）”（https://coding.imooc.com/class/843.html）&lt;/li&gt;
  &lt;li&gt;《鸿蒙HarmonyOS应用开发从入门到精通（第2版）》（北京大学出版社)&lt;/li&gt;
  &lt;li&gt;《鸿蒙之光HarmonyOS NEXT原生应用开发入门》（清华大学出版社)&lt;/li&gt;
  &lt;li&gt;“HarmonyOS NEXT+AI大模型打造智能助手APP(仓颉版)”（https://coding.imooc.com/class/927.html）&lt;/li&gt;
  &lt;li&gt;“HarmonyOS 6 AI应用开发”(https://edu.51cto.com/course/39601.html)&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 05 Nov 2025 00:22:00 +0000</pubDate>
        <link>https://waylau.com/harmonyos-wifi-manager-connect-to-wifi/</link>
        <guid isPermaLink="true">https://waylau.com/harmonyos-wifi-manager-connect-to-wifi/</guid>
        
        <category>HarmonyOS</category>
        
        
        <category>HarmonyOS</category>
        
      </item>
    
      <item>
        <title>HarmonyOS通过openLink拉起浏览器打开链接</title>
        <description>&lt;p&gt;本文介绍了在HarmonyOS应用开发过程中，如何使用openLink拉起浏览器来打开链接。
&lt;!-- more --&gt;&lt;/p&gt;

&lt;h2 id=&quot;app-linking-kit简介&quot;&gt;App Linking Kit简介&lt;/h2&gt;

&lt;p&gt;HarmonyOS的App Linking Kit（应用链接服务）提供了一系列增强的链接特性。App Linking Kit支持通过基础链接拉起指定应用，实现应用间跳转。当应用已安装时，优先通过应用展示内容；若应用未安装，则通过系统浏览器展示网页版内容。&lt;/p&gt;

&lt;p&gt;使用App Linking进行跳转时，系统会根据接口传入的uri信息（HTTPS链接）将用户引导至目标应用中的特定内容，无论应用是否已安装，用户都可以访问到链接对应的内容，跳转体验相比Deep Linking方式更加顺畅。&lt;/p&gt;

&lt;h2 id=&quot;拉起方应用跳转实现&quot;&gt;拉起方应用跳转实现&lt;/h2&gt;

&lt;p&gt;拉起方应用通过UIAbilityContext.openLink()接口，传入目标应用的链接，拉起目标应用。&lt;/p&gt;

&lt;p&gt;openLink接口提供了两种拉起目标应用的方式，开发者可根据业务需求进行选择。&lt;/p&gt;

&lt;h3 id=&quot;方式一-仅以app-linking的方式打开应用&quot;&gt;方式一： 仅以App Linking的方式打开应用。&lt;/h3&gt;

&lt;p&gt;将appLinkingOnly参数设为true，若有App Linking匹配的应用，则直接打开目标应用。若无App Linking匹配的应用，则抛异常给开发者进行处理。&lt;/p&gt;

&lt;p&gt;适用于无法打开目标应用时，开发者做了相应的异常处理。例如：拉起方应用集成了ArkWeb，当目标应用不存在时，可通过ArkWeb打开链接。&lt;/p&gt;

&lt;h3 id=&quot;方式二-以app-linking优先的方式打开应用&quot;&gt;方式二： 以App Linking优先的方式打开应用。&lt;/h3&gt;

&lt;p&gt;将appLinkingOnly参数设为false或者不传，若有App Linking匹配的应用，则直接打开目标应用。若无App Linking匹配的应用，则尝试以浏览器打开链接的方式打开应用。&lt;/p&gt;

&lt;p&gt;适用于无法打开目标应用时，开发者未做任何处理。此时目标应用不存在时，会通过系统浏览器打开链接。&lt;/p&gt;

&lt;h3 id=&quot;代码示例&quot;&gt;代码示例&lt;/h3&gt;

&lt;p&gt;本文主要验证上述方式二，核心代码逻辑如下。&lt;/p&gt;

&lt;div class=&quot;language-ts highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 获取上下文&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getUIContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getHostContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;common&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;UIAbilityContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;openLinkOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OpenLinkOptions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// 将appLinkingOnly参数设为false或者不传，&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// 若有App Linking匹配的应用，则直接打开目标应用。&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// 若无App Linking匹配的应用，则尝试以浏览器打开链接的方式打开应用&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;appLinkingOnly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;parameters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;openLink&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;openLinkOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;hilog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DOMAIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`openLink callback error.code: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;hilog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DOMAIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`openLink callback result: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resultCode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;hilog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DOMAIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`openLink callback result data: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;want&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;hilog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DOMAIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`open link success.`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}).&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BusinessError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;hilog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DOMAIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`open link failed, errCode &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;hilog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DOMAIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`exception occured, errCode &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行应用，界面效果如下。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251105-harmonyos6-001.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;点击应用“访问链接”，可以看到拉起了浏览器，界面效果如下。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251105-harmonyos6-002.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;在浏览器里面访问被访问的应用，界面效果如下。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/post/20251105-harmonyos6-003.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;完整示例详见文末链接《跟老卫学HarmonyOS开发》中“ArkTSOpenLink”。&lt;/p&gt;

&lt;h2 id=&quot;参考引用&quot;&gt;参考引用&lt;/h2&gt;

&lt;p&gt;加入鸿蒙生态，共建万物互联。以下是鸿蒙应用开发常用教程。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;本文同步至：&lt;a href=&quot;https://waylau.com/harmonyos-launches-a-browser-to-open-a-link-through-openlink/&quot;&gt;https://waylau.com/harmonyos-launches-a-browser-to-open-a-link-through-openlink/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学HarmonyOS开发》开源免费教程， &lt;a href=&quot;https://github.com/waylau/harmonyos-tutorial&quot;&gt;https://github.com/waylau/harmonyos-tutorial&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;《跟老卫学AI大模型开发》开源免费教程， https://github.com/waylau/ai-large-model-tutorial/&lt;/li&gt;
  &lt;li&gt;《跟老卫学仓颉编程语言开发》开源免费教程， https://github.com/waylau/cangjie-programming-language-tutorial&lt;/li&gt;
  &lt;li&gt;《鸿蒙HarmonyOS手机应用开发实战》（清华大学出版社）&lt;/li&gt;
  &lt;li&gt;《鸿蒙HarmonyOS应用开发入门》（清华大学出版社）&lt;/li&gt;
  &lt;li&gt;“鸿蒙零基础快速实战-仿抖音App开发（ArkTS版）”（https://coding.imooc.com/class/843.html）&lt;/li&gt;
  &lt;li&gt;《鸿蒙HarmonyOS应用开发从入门到精通（第2版）》（北京大学出版社)&lt;/li&gt;
  &lt;li&gt;《鸿蒙之光HarmonyOS NEXT原生应用开发入门》（清华大学出版社)&lt;/li&gt;
  &lt;li&gt;“HarmonyOS NEXT+AI大模型打造智能助手APP(仓颉版)”（https://coding.imooc.com/class/927.html）&lt;/li&gt;
  &lt;li&gt;“HarmonyOS 6 AI应用开发”(https://edu.51cto.com/course/39601.html)&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Wed, 05 Nov 2025 00:22:00 +0000</pubDate>
        <link>https://waylau.com/harmonyos-launches-a-browser-to-open-a-link-through-openlink/</link>
        <guid isPermaLink="true">https://waylau.com/harmonyos-launches-a-browser-to-open-a-link-through-openlink/</guid>
        
        <category>HarmonyOS</category>
        
        
        <category>HarmonyOS</category>
        
      </item>
    
  </channel>
</rss>
