Skip to content

Commit 76bdc33

Browse files
committed
Java Native关键字备份
1 parent 21ed2d5 commit 76bdc33

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

src/.vuepress/config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ export default defineUserConfig({
77
base: "/DailyNotes/",
88

99
lang: "zh-CN",
10-
title: "echo0d'notes",
11-
description: "echo0d'notes-vuepress",
10+
title: "echo0d-notes",
11+
description: "echo0d-notes-vuepress",
1212
bundler: viteBundler(),
1313
// 主题配置
1414
theme,
15-
1615
// Enable it with pwa
1716
// shouldPrefetch: false,
1817
// plugins: [
19-
// searchProPlugin({
20-
// }),
2118
// ],
2219
});

src/.vuepress/theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default hopeTheme({
2525
navbar: Navbar,
2626
// 侧边栏
2727
sidebar: Sidebar,
28+
sidebarSorter: ["readme", "order", "filename","title"],
2829

2930
footer: "听君一席话,如听一席话",
3031

src/develop/Java/8_Native.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# 8-Native关键字
2+
3+
在Java中,native关键字用于声明一个方法是由本地代码(通常是C或C++)实现的。这意味着该方法的具体实现不是用Java编写的,而是由底层的本地代码提供。
4+
5+
## native关键字的作用
6+
7+
- 与本地代码进行交互:通过native方法,Java程序可以与本地代码进行交互,调用本地库中的函数,实现更高效的操作,或者访问底层系统资源。
8+
- 提高性能:使用本地代码实现某些功能通常比纯Java代码更高效。通过native方法,可以利用底层系统资源和优化的算法,提高程序的性能。
9+
10+
## native关键字的使用方法
11+
12+
要声明一个native方法,只需在Java方法的声明中加上native关键字,并且不需要提供方法的实现。例如:
13+
```java
14+
public native void nativeMethod();
15+
```
16+
17+
在这个例子中,`nativeMethod()`是一个native方法,它的具体实现将在本地代码中提供。
18+
19+
为了使用native方法,必须在Java程序中加载本地库,并确保本地库中包含了所需的函数。本地库可以使用Java的JNI(Java Native Interface)来编写,并在程序运行时通过`System.loadLibrary()` 方法加载。下面是一个简单的示例:
20+
21+
```java
22+
public class NativeExample {
23+
static { System.loadLibrary("nativeLibrary"); }
24+
public native void nativeMethod();
25+
public static void main(String[] args) { new NativeExample().nativeMethod(); }
26+
}
27+
```
28+
29+
30+

src/develop/other/anti-debug.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 反调试
22
反调试技术用于检测和防止调试器附加到程序上,以保护程序免受逆向工程和调试。以下是几种编程语言中的常见反调试方法:
33

4-
### Java
4+
## Java
55
### 检查JVM启动参数
66

77
检查启动参数中是否包含调试相关选项。
@@ -173,6 +173,7 @@ bool isDebuggerAttached() {
173173
```
174174

175175

176+
176177
## Python
177178

178179
1. **检查调试器模块**:检查是否加载了调试器模块。

0 commit comments

Comments
 (0)