JiaHe's Blog

读万卷书,行万里路

原文地址:https://www.baeldung.com/java-9-modularity

以下中文翻译为作者根据自己的理解+Google+YouDao作为参考翻译而得,存在偏颇之处请读者查看对应原文,自行理解。

1. Overview

Java 9 introduces a new level of abstraction above packages, formally known as the Java Platform Module System (JPMS), or “Modules” for short.

Java 9基于package引入了一个新的抽象级别,正式称为Java平台模块系统(JPMS)或“模块”。

In this tutorial, we'll go through the new system and discuss its various aspects.

在本教程中,我们将通过一个新系统来探索其各个方面。

We'll also build a simple project to demonstrate all concepts we'll be learning in this guide.

我们也将构建一个简单的工程来演示我们在本教程中的学到的所有的概念。

阅读全文 »

原文地址:https://www.baeldung.com/project-jigsaw-java-modularity

以下中文翻译为作者根据自己的理解+Google+YouDao作为参考翻译而得,存在偏颇之处请读者查看对应原文,自行理解。

1. Introduction

Project Jigsaw is an umbrella project with the new features aimed at two aspects:

Project Jigsaw 作为一个大项目包含以下两个方面的新特性:

  • the introduction of module system in the Java language
  • 在Java中引入模块系统
  • and its implementation in JDK source and Java runtime
  • 以及JDK源码和Java运行环境的具体实现

In this article, we'll introduce you to the Jigsaw project and its features and finally wrap it up with a simple modular application.

本文中,我们将介绍Jigsaw及其一些特性,并且通过一个简单的模块化应用来入门。

阅读全文 »

<dependencies>
<!-- jdk9+ requires following dependencies to use jaxb -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
module-info.java
module module.name {

requires static transitive java.naming;
requires transitive com.sun.xml.bind;
requires java.annotation;

// 使用到JAXB相关的包暴露给jaxb
opens cn.xiaojianzheng.xxx to com.sun.xml.bind, com.sun.xml.bind.core, jakarta.xml.bind;

}

Source: https://stackoverflow.com/questions/45483699/cmd-exited-with-error-code-1

按 windows+r 打开注册表编辑器,然后键入 regedit,然后在搜索栏中按 enter 键粘贴下面的行

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\

如果您可以使用链接在图片中看到带下划线的标记很重要,请不要在该特定注册表的数据中插入任何其他值。

在这里,如果您提交了许多注册表值,则删除除默认值之外的所有注册表值,因为它们是命令提示符显示错误代码 1 的主要原因。 所以在删除所有这些之后。

编辑默认注册表值并在Data中插入cmd 并保存

你的问题解决了!! 如果不是,则清除默认注册表的数据。

背景

线上某任务出现报警,报错日志如下:

java.lang.NullPointerException: null
at java.util.HashMap.merge(HashMap.java:1225)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1380)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.xxx.web.controller.TaskController.getOmsAccidCloudCCUserIdMap(TaskController.java:648)
at com.xxx.web.controller.TaskController.executePushNewRegisterLead(TaskController.java:400)
at com.xxx.web.controller.TaskController.pushNewRegister(TaskController.java:145)

对应出错的代码:

omsAccidCloudCCUserIdMap = administratorList.stream()
.collect(Collectors.toMap(Administrator::getAccid,administrator
-> cloudccAccidUserIdMap.get(administrator.getCloudccAccid())));

已知administratorList不含有null元素,administratorListcloudccAccidUserIdMap都不为nullAdministrator::getAccid也不会返回null值。

阅读全文 »