Skip to content

Commit 7646be4

Browse files
committed
[GR-59211] [GR-60094] [WIP] Documentation maintenance.
PullRequest: graal/19428
2 parents fbecd9d + e9b5d69 commit 7646be4

11 files changed

+129
-114
lines changed

docs/getting-started/macos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Install GraalVM from an archive (_.tar.gz_) for the current user into any locati
4646

4747
3. Move the downloaded package to its proper location, the _/Library/Java/JavaVirtualMachines/_ directory. Since this is a system directory, `sudo` is required:
4848
```bash
49-
sudo mv graalvm-jdk-<version>_macos-<architecture> /Library/Java/JavaVirtualMachines
49+
sudo mv graalvm-jdk-<version> /Library/Java/JavaVirtualMachines
5050
```
5151
To verify if the move is successful and to get a list of all installed JDKs, run `/usr/libexec/java_home -V`.
5252

docs/reference-manual/native-image/JFR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ GraalVM Native Image supports building a native executable with JFR events, and
1515

1616
JFR support is disabled by default and must be explicitly enabled at build time.
1717

18-
> Note: JFR event recording is not yet available in GraalVM JDK on Windows.
18+
> Note: JFR event recording is not yet available with Native Image on Windows.
1919
2020
To build a native executable with JFR, use the `--enable-monitoring=jfr` option:
2121
```shell

docs/reference-manual/native-image/guides/add-logging-to-native-executable.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ By default, a native executable produced by Native Image supports logging via th
1212

1313
## Default Logging Configuration
1414

15-
The default logging configuration in a native executable is based on the `logging.properties` file found in the JDK.
15+
The default logging configuration in a native executable is based on the _logging.properties_ file found in the JDK.
1616
This file configures a `java.util.logging.ConsoleHandler` which will only show messages at the `INFO` level and above.
17-
Custom logging configuration can be loaded either at build time or at runtime as described below.
17+
Custom logging configuration can be loaded either at build time or at run time as described below.
1818

1919
If you require additional logging handlers, you must register the corresponding classes for reflection.
20-
For example, if you use `java.util.logging.FileHandler` then provide the following reflection configuration:
20+
For example, if you use `java.util.logging.FileHandler`, then provide the following reflection configuration in the _META-INF/native-image/reachability-metadata.json_ file:
2121
```json
2222
{
2323
"name" : "java.util.logging.FileHandler",
@@ -26,6 +26,7 @@ For example, if you use `java.util.logging.FileHandler` then provide the followi
2626
]
2727
}
2828
```
29+
2930
For more details, see [Reflection Support](../ReachabilityMetadata.md#reflection).
3031

3132
The usage of the logger is shown in the following example:
@@ -64,10 +65,10 @@ The usage of the logger is shown in the following example:
6465
WARNING: Danger, Will Robinson! [Wed May 18 17:22:40 BST 2022]
6566
```
6667

67-
In this case, the _logging.properties_ file needs to be available for runtime processing so it must be included into the _reachability-metadata.json_ file under the _META-INF/native-image/<group-id>_ folder.
68+
In this case, the _logging.properties_ file must be available for runtime processing and therefore needs to be registered in the _META-INF/native-image/reachability-metadata.json_ file.
6869
For more details on how to do this, see [Use of Resources in a Native Executable](../ReachabilityMetadata.md#resources).
6970

7071
### Related Documentation
7172

7273
* [Reachability Metadata: Reflection](../ReachabilityMetadata.md#reflection)
73-
* [Native Image Build Configuration](../BuildConfiguration.md)
74+
* [Native Image Build Configuration](../BuildConfiguration.md)

docs/reference-manual/native-image/guides/build-and-run-native-executable-with-jfr.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ permalink: /reference-manual/native-image/guides/build-and-run-native-executable
77

88
# Build and Run Native Executables with JFR
99

10-
[JDK Flight Recorder (JFR](https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm) is a tool for collecting diagnostic and profiling data about a running Java application, built into the JVM.
10+
[JDK Flight Recorder (JFR)](https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm) is a tool for collecting diagnostic and profiling data about a running Java application, built into the JVM.
1111
GraalVM Native Image supports JFR events and users can use the [`jdk.jfr.Event` API](https://docs.oracle.com/en/java/javase/22/docs/api/jdk.jfr/jdk/jfr/Event.html) with a similar experience to using JFR in the Java HotSpot VM.
1212

1313
To collect JFR events when running a native executable, enable JFR support and JFR event recording as described in this guide.
1414

15-
> Note: JFR event recording is not yet available in GraalVM JDK on Windows.
15+
> Note: JFR event recording is not yet available with Native Image on Windows.
1616
1717
## Enable JFR Support and Record Events at Runtime
1818

@@ -52,13 +52,13 @@ For other installation options, visit the [Downloads section](https://www.graalv
5252
It creates an event, annotated with `@Label` from the `jdk.jfr.*` package.
5353
If you run this application, it will not print anything and just run that event.
5454

55-
2. Compile the Java file using the GraalVM JDK:
55+
2. Ccompile the application using the GraalVM JDK:
5656
```shell
5757
javac JFRDemo.java
5858
```
5959
It creates two class files: _JFRDemo$HelloWorldEvent.class_ and _JFRDemo.class_.
6060

61-
3. Build a native executable with VM inspection enabled:
61+
3. Build a native executable with the VM inspection enabled:
6262
```shell
6363
native-image --enable-monitoring=jfr JFRDemo
6464
```
@@ -89,5 +89,4 @@ It will look something like this:
8989

9090
### Related Documentation
9191

92-
- Learn more about [Native Image support for JFR events](../JFR.md) and how to further configure JFR recording and system logging.
93-
- [Create and record your first event with Java](https://docs.oracle.com/en/java/javase/22/jfapi/creating-and-recording-your-first-event.html).
92+
- Learn more about [Native Image support for JFR events](../JFR.md) and how to further configure JFR recording and system logging.

docs/reference-manual/native-image/guides/build-and-run-native-executable-with-remote-jmx.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ It also shows you how to register a custom managed bean (MBean) with the JMX ser
1919
A JMX connection from a client to a remote MBean server is supported.
2020
The client, the server, or both may be a native executable.
2121
Only MXBeans, and standard user-defined MBeans, are supported.
22-
Dynamic and model MBeans are not supported because their management interfaces are defined at runtime.
23-
Although remote management of MXBeans is supported, not all platform MXBean functionality is implemented or is applicable in a native executable produced by Native Image.
22+
Dynamic and model MBeans are not supported because their management interfaces are defined at run time.
23+
Although remote management of MXBeans is supported, not all platform MXBean functionality is implemented or is applicable in a native executable.
2424
Additionally, to define and use standard MBeans, you must specify metadata configuration.
2525
This is further explained in this guide.
2626

@@ -79,13 +79,13 @@ For other installation options, visit the [Downloads section](https://www.graalv
7979
}
8080
```
8181

82-
2. Change your working directory to where you saved the file. Then compile the application using the GraalVM JDK:
82+
2. Ccompile the application using the GraalVM JDK:
8383
```shell
8484
javac SimpleJmx.java
8585
```
8686
This creates _SimpleJmx.class_, _SimpleJmx$Simple.class_, and _SimpleJmx$SimpleMBean.class_ files.
8787

88-
3. Add dynamic proxy configuration. JMX uses dynamic proxies, a [dynamic feature](../DynamicFeatures.md) of Java, to access MBeans. To be able to interact with the custom `SimpleMBean` at runtime, you need to provide Native Image with additional [dynamic-proxy metadata](../ReachabilityMetadata.md#reflection) for the MBean interface. For this, create or modify a JSON file named _reachability-metadata.json_ with the following contents:
88+
3. Add dynamic proxy configuration. JMX uses dynamic proxies, a [dynamic feature](../DynamicFeatures.md) of Java, to access MBeans. To be able to interact with the custom `SimpleMBean` at run time, you need to provide Native Image with additional [dynamic-proxy metadata](../ReachabilityMetadata.md#reflection) for the MBean interface. For this, create or modify a JSON file named _reachability-metadata.json_ with the following contents:
8989
```json
9090
{
9191
"reflection": [
@@ -98,7 +98,7 @@ For other installation options, visit the [Downloads section](https://www.graalv
9898
}
9999
```
100100

101-
4. Build a native executable with VM monitoring enabled and pass the JSON configuration file to `native-image`:
101+
4. Build a native executable with the VM inspection enabled and pass the JSON configuration file to `native-image`:
102102
```shell
103103
native-image --enable-monitoring=jmxserver,jmxclient,jvmstat -H:DynamicProxyConfigurationFiles=proxy-config.json SimpleJmx
104104
```
@@ -141,5 +141,4 @@ Users can enable the JMX agent in a native executable to monitor a client applic
141141
### Related Documentation
142142

143143
- [Enabling and disabling JMX](https://docs.oracle.com/javadb/10.10.1.2/adminguide/radminjmxenabledisable.html)
144-
- [Create Heap Dumps with VisualVM](create-heap-dump-from-native-executable.md)
145-
- [Dynamic Proxy](../ReachabilityMetadata.md#reflection)
144+
- [Create Heap Dumps with VisualVM](create-heap-dump-from-native-executable.md)

docs/reference-manual/native-image/guides/build-java-module-app-aot.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ permalink: /reference-manual/native-image/guides/build-java-modules-into-native-
99

1010
GraalVM Native Image supports the [Java Platform Module System](https://www.oracle.com/uk/corporate/features/understanding-java-9-modules.html), introduced in Java 9, which means you can convert a modularized Java application into a native executable.
1111

12-
The `native-image` tool accepts the module-related arguments such as `--module` (`-m`), `--module-path` (`-p`), `--add-opens`, `--add-exports` (same as for the `java` launcher).
13-
When such a module-related argument is used, the `native-image` tool itself is used as a module too.
12+
The `native-image` tool accepts the module-related options such as `--module` (`-m`), `--module-path` (`-p`), `--add-opens`, `--add-exports` (same as for the `java` launcher).
13+
When such a module-related option is used, the `native-image` tool itself is used as a module too.
1414

1515
In addition to supporting `--add-reads` and `--add-modules`, all module related options are considered prior to scanning the module path.
1616
This helps prevent class loading errors and allow for better module introspection at runtime.
@@ -48,17 +48,17 @@ Make sure you have installed a GraalVM JDK.
4848
The easiest way to get started is with [SDKMAN!](https://sdkman.io/jdks#graal).
4949
For other installation options, visit the [Downloads section](https://www.graalvm.org/downloads/).
5050

51-
1. Download or clone the demos repository and navigate to the directory _native-hello-module/_:
51+
1. Download or clone the demos repository and navigate to the directory _native-image/build-java-modules/_:
5252
```bash
5353
git clone https://github.com/graalvm/graalvm-demos
5454
```
5555
```bash
56-
cd graalvm-demos/native-hello-module
56+
cd graalvm-demos/native-image/build-java-modules
5757
```
5858

5959
2. Compile and package the project with Maven:
6060
```bash
61-
mvn package
61+
mvn clean package
6262
```
6363

6464
3. Test running it on the GraalVM JDK:

docs/reference-manual/native-image/guides/build-native-executable-from-jar.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ For other installation options, visit the [Downloads section](https://www.graalv
6363
```shell
6464
jar --create --file App.jar --main-class com.example.App -C build .
6565
```
66-
It will generate a runnable JAR file, named _App.jar_, in the project root directory:
67-
To view its contents, run the command `jar tf App.jar`.
66+
It will generate a runnable JAR file, named _App.jar_, in the project root directory.
67+
To view its contents, run the command:
68+
```shell
69+
jar tf App.jar
70+
```
6871
6972
4. Create a native executable:
7073
```shell
@@ -79,9 +82,10 @@ For other installation options, visit the [Downloads section](https://www.graalv
7982
./App
8083
```
8184
82-
The default behavior of `native-image` is aligned with the `java` command which means you can pass the `-jar`, `-cp`, `-m` options to build with Native Image as you would normally do with `java`. For example, `java -jar App.jar someArgument` becomes `native-image -jar App.jar` and `./App someArgument`.
85+
The default behavior of `native-image` is aligned with the `java` command which means you can pass the `-jar`, `-cp`, `-m` options to build with Native Image as you would normally do with `java`.
86+
For example, `java -jar App.jar someArgument` becomes `native-image -jar App.jar` and `./App someArgument`.
8387
8488
### Related Documentation
8589
86-
* [GraalVM Native Image Quick Start](https://luna.oracle.com/lab/47dafec8-4095-4fba-8313-dad43a64dee4)
87-
* [Build Java Modules into a Native Executable](build-java-module-app-aot.md)
90+
* [Hands-on Labs: GraalVM Native Image Quick Start](https://luna.oracle.com/lab/47dafec8-4095-4fba-8313-dad43a64dee4)
91+
* [Build Java Modules into a Native Executable](build-java-module-app-aot.md)

docs/reference-manual/native-image/guides/build-native-shared-library.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permalink: /reference-manual/native-image/guides/build-native-shared-library/
77

88
# Build a Native Shared Library
99

10-
To build a native shared library, pass the command-line argument `--shared` to the `native-image` tool, as follows:
10+
To build a native shared library, pass the command-line option `--shared` to the `native-image` tool, as follows:
1111
```shell
1212
native-image <class name> --shared
1313
```
@@ -26,9 +26,10 @@ native-image --shared -jar <jarfile> -o <libraryname>
2626
```
2727

2828
GraalVM makes it easy to use C to call into a native shared library.
29-
There are two primary mechanisms for calling a method (function) embedded in a native shared library: the [Native Image C API](../C-API.md) and the [JNI Invocation API](https://docs.oracle.com/en/java/javase/22/docs/specs/jni/invocation.html).
29+
There are two primary mechanisms for calling a method (function) embedded in a native shared library: the [Native Image C API](../C-API.md) and the [JNI Invocation API](https://docs.oracle.com/en/java/javase/23/docs/specs/jni/invocation.html).
3030

31-
This guide describes how to use the **Native Image C API**. It consists of the following steps:
31+
This guide describes how to use the **Native Image C API**.
32+
It consists of the following steps:
3233
1. Create and compile a Java class library containing at least one entrypoint method.
3334
2. Use the `native-image` tool to create a shared library from the Java class library.
3435
3. Create and compile a C application that calls that entrypoint method in the shared library.
@@ -66,15 +67,14 @@ A native shared library can have an unlimited number of entrypoints, for example
6667
### Run a Demo
6768
6869
In the following example, you create a small Java class library (containing one class), use `native-image` to create a shared library from the class library, and then create a small C application that uses that shared library.
69-
The C application takes a String as its argument, passes it to the shared library, and prints environment variables that contain the argument.
70+
The C application takes a String as an argument, passes it to the shared library, and prints environment variables that contain the argument.
7071
7172
### Prerequisite
7273
Make sure you have installed a GraalVM JDK.
7374
The easiest way to get started is with [SDKMAN!](https://sdkman.io/jdks#graal).
7475
For other installation options, visit the [Downloads section](https://www.graalvm.org/downloads/).
7576
7677
1. Save the following Java code to a file named _LibEnvMap.java_:
77-
7878
```java
7979
import java.util.Map;
8080
import org.graalvm.nativeimage.IsolateThread;
@@ -113,14 +113,12 @@ For other installation options, visit the [Downloads section](https://www.graalv
113113
114114
It produces the following artifacts:
115115
```
116-
--------------------------------------------------
117116
Produced artifacts:
118117
/demo/graal_isolate.h (header)
119118
/demo/graal_isolate_dynamic.h (header)
120119
/demo/libenvmap.dylib (shared_lib)
121120
/demo/libenvmap.h (header)
122121
/demo/libenvmap_dynamic.h (header)
123-
==================================================
124122
```
125123
126124
If you work with C or C++, use these header files directly. For other languages, such as Java, use the function declarations in the headers to set up your foreign call bindings.
@@ -156,9 +154,9 @@ For other installation options, visit the [Downloads section](https://www.graalv
156154
157155
4. Compile _main.c_ using the `clang` compiler available on your system:
158156
```shell
159-
clang -I ./ -L ./ -l envmap -Wl,-rpath ./ -o main main.c
157+
clang -I ./ -L ./ -l envmap -Wl,-rpath ./ -o main main.c
160158
```
161-
It creates an executable file _main_.
159+
It creates an executable file `main`.
162160
163161
5. Run the C application by passing a string as an argument. For example:
164162
```shell

0 commit comments

Comments
 (0)