From 45826ec8be26b9d4976b38bb122f49dd4539d04a Mon Sep 17 00:00:00 2001 From: Changhua Date: Wed, 6 Dec 2023 22:12:26 +0800 Subject: [PATCH] Update instructions --- clients/java/README.MD | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/clients/java/README.MD b/clients/java/README.MD index 91eab47..fad662d 100644 --- a/clients/java/README.MD +++ b/clients/java/README.MD @@ -1,26 +1,33 @@ # WeChatFerry Java 客户端 + ⚠️ **只支持 Windows** ⚠️ ## 快速开始 -* 下载 [最新发布的版本](https://github.com/lich0821/WeChatFerry/releases/latest),解压,找到 java 客户端。 + +* 下载 [最新发布的文件](https://github.com/lich0821/WeChatFerry/releases/latest),解压到 `WeChatFerry\clients\java\wcferry\src\main\resources\win32-x86-64`。 * 使用惯用 IDE,打开工程,编译,运行。 ## 从头开始 + 【添加 `wcferry` 依赖】是必须要执行的,工程里不带这几个文件;如果开发新功能,一般需要修改 `wcf.proto`,从而需要重新生成 PB 文件;其他的,一般不需要关注。 ### 添加 `nng` 依赖 + * 新建一个 `libs` 目录 * 参考 [nng-java](https://github.com/voutilad/nng-java),编译 jar 包(`nng-java-1.4.0-SNAPSHOT.jar`) * 添加依赖 `nng-java-1.4.0-SNAPSHOT.jar` + ```groovy implementation 'net.java.dev.jna:jna:5.6.0' implementation fileTree(dir: 'libs', include: ['*.jar']) ``` #### 编译 / 安装 `mbedtls` + * 下载 [Mbed TLS](https://github.com/Mbed-TLS/mbedtls) 代码并解压 * 新建 `build` 目录,生成 VS 工程 + ```sh cd build cmake .. @@ -30,8 +37,10 @@ cmake .. * [参考](https://github.com/Mbed-TLS/mbedtls) #### 编译 / 安装 `nng` + * 下载 [nng](https://github.com/nanomsg/nng) 代码并解压 * 新建 `build` 目录,生成 VS 工程 + ```sh cmake -DBUILD_SHARED_LIBS=ON -DNNG_ENABLE_TLS=ON -DMBEDTLS_ROOT_DIR="C:\Program Files (x86)\mbed TLS" .. ``` @@ -40,24 +49,31 @@ cmake -DBUILD_SHARED_LIBS=ON -DNNG_ENABLE_TLS=ON -DMBEDTLS_ROOT_DIR="C:\Program * [参考](https://github.com/nanomsg/nng/issues/953) ### 添加 PB 依赖 + ```groovy implementation 'com.google.protobuf:protobuf-java:3.22.2' // 版本需要和 protoc 一致 ``` #### 重新生成 PB 文件 + 参考 [Protocol Buffer Basics: Java](https://protobuf.dev/getting-started/javatutorial/#problem-domain)。 * 下载 `protoc` 工具(注意,需要与 `com.google.protobuf:protobuf-java` 一致): 这里下载 [protoc-22.2](https://github.com/protocolbuffers/protobuf/releases/download/v22.2/protoc-22.2-win64.zip),解压,并将所在路径加入环境变量(以便随处可用)。 * 编译 PB 文件 + ```sh +# 调整项目路径 cd C:/Projs/WeChatFerry/java/wcferry/src/main/java -protoc.exe --java_out=. --proto_path=C:\Projs\WeChatFerry\rpc\proto wcf.proto +protoc.exe --java_out=. --proto_path=C:\Projs\WeChatFerry\WeChatFerry\rpc\proto wcf.proto ``` ### 添加 `wcferry` 依赖 -将 `wcf.exe` 、 `spy.dll` 、 `spy_debug.dll` 添加到 `C:\Projs\WeChatFerry\java\wcferry\src\main\resources\win32-x86-64`。 + +将 `wcf.exe` 、 `spy.dll` 、 `spy_debug.dll` 添加到 `WeChatFerry\clients\java\wcferry\src\main\resources\win32-x86-64`。 ### 其他问题 + ### 乱码 + 参考 [这篇文章](https://www.quanxiaoha.com/idea/idea-chinese-garbled-code.html)。