🔨 修改项目文件结构
This commit is contained in:
parent
f5fdb925ea
commit
785600c857
@ -1,43 +0,0 @@
|
||||
# 解决jlink error指南
|
||||
|
||||
## 现象
|
||||
|
||||
jlink时,如果出现如下错误,参考本文档
|
||||
|
||||
```
|
||||
"automatic module cannot be used with jlink"
|
||||
```
|
||||
|
||||
## 解决方法:
|
||||
|
||||
1. 为jar生成module-info.class
|
||||
|
||||
```shell
|
||||
jdeps --ignore-missing-deps --module-path <jar_dir_path> --add-modules <module_name --generate-module-info <out_dir_path> <jar_path>
|
||||
javac --patch-module <module_name>=<jar_path> <module-info.java>
|
||||
jar uf <jar_path> -C <module_name> <module-info.class>
|
||||
```
|
||||
|
||||
以本次icu4j为例,先将依赖的jar包copy到libs目录,然后执行:
|
||||
|
||||
```shell
|
||||
jdeps --ignore-missing-deps --module-path libs --add-modules com.ibm.icu --generate-module-info libs/tmpOut libs/icu4j-73.2.jar
|
||||
javac --patch-module com.ibm.icu=libs/icu4j-73.2.jar libs/tmpOut/com.ibm.icu/module-info.java
|
||||
jar uf libs/icu4j-73.2.jar -C libs/tmpOut/com.ibm.icu module-info.class
|
||||
```
|
||||
|
||||
2. pom中添加依赖
|
||||
|
||||
```xml
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ibm.icu</groupId>
|
||||
<artifactId>icu4j</artifactId>
|
||||
<version>73.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/icu4j-73.2.jar</systemPath>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## Reference
|
||||
1. [java_jlink_automatic_module_cannot_be_used_with_jlink](https://tacosteemers.com/articles/java_jlink_automatic_module_cannot_be_used_with_jlink.html)
|
||||
Binary file not shown.
1
pom.xml
1
pom.xml
@ -56,6 +56,7 @@
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.4.11</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ibm.icu</groupId>
|
||||
<artifactId>icu4j</artifactId>
|
||||
|
||||
@ -22,4 +22,5 @@ module org.jcnc.jnotepad {
|
||||
exports org.jcnc.jnotepad.view.manager;
|
||||
exports org.jcnc.jnotepad.constants;
|
||||
exports org.jcnc.jnotepad.ui;
|
||||
exports org.jcnc.jnotepad.app.init;
|
||||
}
|
||||
@ -7,10 +7,10 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
import org.jcnc.jnotepad.app.config.LoadJnotepadConfig;
|
||||
import org.jcnc.jnotepad.app.config.LoadLanguageConfig;
|
||||
import org.jcnc.jnotepad.app.config.LoadShortcutKeyConfig;
|
||||
import org.jcnc.jnotepad.app.config.LocalizationConfig;
|
||||
import org.jcnc.jnotepad.app.init.LoadJnotepadConfig;
|
||||
import org.jcnc.jnotepad.app.init.LoadLanguageConfig;
|
||||
import org.jcnc.jnotepad.app.init.LoadShortcutKeyConfig;
|
||||
import org.jcnc.jnotepad.constants.AppConstants;
|
||||
import org.jcnc.jnotepad.controller.manager.Controller;
|
||||
import org.jcnc.jnotepad.ui.LineNumberTextArea;
|
||||
@ -24,7 +24,6 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
@ -53,7 +52,6 @@ public class LunchApp extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
Pane root = new Pane();
|
||||
|
||||
double width = AppConstants.SCREEN_WIDTH;
|
||||
double length = AppConstants.SCREEN_LENGTH;
|
||||
String icon = AppConstants.APP_ICON;
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package org.jcnc.jnotepad.app.config;
|
||||
package org.jcnc.jnotepad.app.init;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.jcnc.jnotepad.app.config.LocalizationConfig;
|
||||
import org.jcnc.jnotepad.exception.AppException;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.PopUpUtil;
|
||||
@ -61,6 +62,7 @@ public abstract class LoadJnotepadConfig<T> {
|
||||
// 不存在则创建
|
||||
createConfig();
|
||||
try {
|
||||
// 创建后重新加载
|
||||
loadConfig(new FileInputStream(CONFIG_NAME));
|
||||
} catch (FileNotFoundException ex) {
|
||||
throw new AppException(ex.getMessage());
|
||||
@ -78,18 +80,6 @@ public abstract class LoadJnotepadConfig<T> {
|
||||
protected abstract T parseConfig(InputStream inputStream);
|
||||
|
||||
private void createConfig() {
|
||||
// List<ShortcutKey> shortcutKeyList = getShortcutKeys();
|
||||
// JnotepadConfig.getInstance().setShortcutKeyList(shortcutKeyList);
|
||||
// for (ShortcutKey shortcutKey : shortcutKeyList) {
|
||||
// // 保证json的key必须和变量名一致
|
||||
// MenuItem menuItem = JNotepadMenuBar.getMenuBar().getItemMap().get(shortcutKey.getButtonName());
|
||||
// String shortKeyValue = shortcutKey.getShortcutKeyValue();
|
||||
// if ("".equals(shortKeyValue) || Objects.isNull(menuItem)) {
|
||||
// continue;
|
||||
// }
|
||||
// // 动态添加快捷键
|
||||
// menuItem.setAccelerator(KeyCombination.keyCombination(shortKeyValue));
|
||||
// }
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(CONFIG_NAME))) {
|
||||
writer.write(JNOTEPAD_CONFIG);
|
||||
} catch (IOException e) {
|
||||
@ -98,36 +88,6 @@ public abstract class LoadJnotepadConfig<T> {
|
||||
LocalizationConfig.getLocalizationConfig().initLocalizationConfig();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取快捷键集合
|
||||
// *
|
||||
// * @return java.util.List<org.jcnc.jnotepad.app.entity.ShortcutKey> 快捷键集合
|
||||
// * @since 2023/8/24 14:19
|
||||
// */
|
||||
// private static List<ShortcutKey> getShortcutKeys() {
|
||||
// List<ShortcutKey> shortcutKeyList = new ArrayList<>();
|
||||
// // 打开文件
|
||||
// ShortcutKey shortcutKeyOfOpen = new ShortcutKey("openItem", "ctrl+o");
|
||||
//
|
||||
// // 新建
|
||||
// ShortcutKey shortcutKeyOfNew = new ShortcutKey("newItem", "ctrl+n");
|
||||
//
|
||||
// // 保存
|
||||
// ShortcutKey shortcutKeyOfSave = new ShortcutKey("saveItem", "ctrl+s");
|
||||
//
|
||||
// // 保存作为
|
||||
// ShortcutKey shortcutKeyOfSaveAs = new ShortcutKey("saveAsItem", "ctrl+shift+s");
|
||||
//
|
||||
// // 打开配置文件
|
||||
// ShortcutKey shortcutKeyOfOpenConfig = new ShortcutKey("openConfigItem", "alt+s");
|
||||
//
|
||||
// shortcutKeyList.add(shortcutKeyOfOpen);
|
||||
// shortcutKeyList.add(shortcutKeyOfNew);
|
||||
// shortcutKeyList.add(shortcutKeyOfSave);
|
||||
// shortcutKeyList.add(shortcutKeyOfSaveAs);
|
||||
// shortcutKeyList.add(shortcutKeyOfOpenConfig);
|
||||
// return shortcutKeyList;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 加载配置文件
|
||||
@ -1,5 +1,6 @@
|
||||
package org.jcnc.jnotepad.app.config;
|
||||
package org.jcnc.jnotepad.app.init;
|
||||
|
||||
import org.jcnc.jnotepad.app.config.LocalizationConfig;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.ui.menu.JNotepadMenuBar;
|
||||
import org.slf4j.Logger;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.jcnc.jnotepad.app.config;
|
||||
package org.jcnc.jnotepad.app.init;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import javafx.scene.control.MenuItem;
|
||||
@ -2,8 +2,8 @@ package org.jcnc.jnotepad.controller.event.handler;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import org.jcnc.jnotepad.app.config.LoadLanguageConfig;
|
||||
import org.jcnc.jnotepad.app.config.LoadShortcutKeyConfig;
|
||||
import org.jcnc.jnotepad.app.init.LoadLanguageConfig;
|
||||
import org.jcnc.jnotepad.app.init.LoadShortcutKeyConfig;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.ui.LineNumberTextArea;
|
||||
import org.jcnc.jnotepad.ui.tab.JNotepadTab;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package org.jcnc.jnotepad.view.init;
|
||||
|
||||
import org.jcnc.jnotepad.app.config.LoadJnotepadConfig;
|
||||
import org.jcnc.jnotepad.app.init.LoadJnotepadConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user