diff --git a/.github/workflows/native-netty-plot.yml b/.github/workflows/archive-native-netty-plot.yml
similarity index 72%
rename from .github/workflows/native-netty-plot.yml
rename to .github/workflows/archive-native-netty-plot.yml
index 423287ea7..33883aa82 100644
--- a/.github/workflows/native-netty-plot.yml
+++ b/.github/workflows/archive-native-netty-plot.yml
@@ -1,38 +1,33 @@
-name: native-netty-plot
+name: archive/native-netty-plot
on:
push:
paths:
- - 'native-netty-plot/**'
- - '.github/workflows/native-netty-plot.yml'
+ - 'archive/native-netty-plot/**'
+ - '.github/workflows/archive-native-netty-plot.yml'
pull_request:
paths:
- - 'native-netty-plot/**'
- - '.github/workflows/native-netty-plot.yml'
- schedule:
- - cron: "0 0 1 * *" # run every month
+ - 'archive/native-netty-plot/**'
+ - '.github/workflows/archive-native-netty-plot.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
run:
- name: Run 'native-netty-plot'
+ name: Run 'archive/native-netty-plot'
runs-on: ubuntu-latest
timeout-minutes: 20
- strategy:
- matrix:
- java-version: ['21', 'dev']
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
- java-version: ${{ matrix.java-version }}
+ java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
native-image-job-reports: 'true'
- - name: Run 'native-netty-plot'
+ - name: Run 'archive/native-netty-plot'
run: |
- cd native-netty-plot
+ cd archive/native-netty-plot
mvn --no-transfer-progress package
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot -jar target/netty-plot-0.1-jar-with-dependencies.jar &
pid=$!
diff --git a/README.md b/README.md
index 21e7f3be9..bcec61805 100644
--- a/README.md
+++ b/README.md
@@ -52,8 +52,8 @@ cd graalvm-demos
Demonstrates how you can influence the classes initialization at the image build time Technologies: Native Image, Maven Reference: Understanding Class Initialization in GraalVM Native Image Generation |
- native-netty-plot
|
- A web server application, using the Netty framework, to demonstrate the use of isolates with Native Image Technologies: Native Image, Maven, Netty Reference: Instant Netty Startup using GraalVM Native Image Generation |
+ javagdbnative
|
+ Demonstrates how to debug a Java application, built into a native executable in VS Code Technologies: Native Image, Maven, GraalVM Tools for Java Reference: Native Image Debugging in VS Code |
native-image/add-logging
|
diff --git a/archive/native-netty-plot/.gitignore b/archive/native-netty-plot/.gitignore
new file mode 100644
index 000000000..fd94e1973
--- /dev/null
+++ b/archive/native-netty-plot/.gitignore
@@ -0,0 +1,2 @@
+target/
+netty-plot
\ No newline at end of file
diff --git a/native-netty-plot/README.md b/archive/native-netty-plot/README.md
similarity index 68%
rename from native-netty-plot/README.md
rename to archive/native-netty-plot/README.md
index 6e8cfd676..b1196635c 100644
--- a/native-netty-plot/README.md
+++ b/archive/native-netty-plot/README.md
@@ -1,4 +1,4 @@
-# Isolates for GraalVM Native Images
+# Use of Isolates with Native Image
This application demonstrates the use of _isolates_ with [GraalVM Native Image](https://www.graalvm.org/latest/reference-manual/native-image/).
The code implements a web service that renders plots of mathematical functions, such as _sin(x)_.
@@ -22,33 +22,34 @@ There is also the [Maven plugin for GraalVM Native Image building](https://graal
git clone https://github.com/graalvm/graalvm-demos
```
```bash
- cd graalvm-demos/native-netty-plot
+ cd graalvm-demos/archive/native-netty-plot
```
+
For compilation, the `native-image` depends on the local toolchain.
-Please make sure that `glibc-devel`, `zlib-devel` (header files for the C library and zlib), and `gcc` are available on your system. Some Linux distributions may additionally require `libstdc++-static`.
+Make sure that `glibc-devel`, `zlib-devel` (header files for the C library and zlib), and `gcc` are available on your system. Some Linux distributions may additionally require `libstdc++-static`.
See [Prerequisites for Native Image](https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites).
-## Build the Project
+## Build the Application
The example is built with Maven:
```bash
mvn package
```
-This creates a JAR file with all dependencies embedded: `target/netty-plot-0.1-jar-with-dependencies.jar`.
+This creates a JAR file with all dependencies embedded in the _target/_ directory.
## Generate a Native Executable
If the application is expected to use some dynamic features at run time (e.g., Reflection, Java Native Interface, class path resources), they have to be provided to the `native-image` tool in the form of configuration files.
To avoid writing the configuration file yourself, apply the [tracing agent](https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/) when running on the Java HotSpot VM.
It will observe the application behavior and create configuration files (_jni-config.json_, _reflect-config.json_, _proxy-config.json_ and _resource-config.json_) in the _META-INF/native-image_ directory on the class path.
-The _reflect-config.json_ file specifies classes which must be available via Java reflection at runtime.
+The _reflect-config.json_ file specifies classes which must be available via Java reflection at run time.
-1. Run the application on GraalVM JDK applying the tracing agent:
+1. Run the application on the GraalVM JDK applying the tracing agent:
```bash
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar target/netty-plot-0.1-jar-with-dependencies.jar
```
- The server is started. Open _http://127.0.0.1:8080/?useIsolate=false_ in the browser to see the output.
+ The server is started. Open [http://127.0.0.1:8080/?useIsolate=false](http://127.0.0.1:8080/?useIsolate=false) in the browser to see the output.
2. Terminate the application, `CTRL+C`.
@@ -58,33 +59,34 @@ The _reflect-config.json_ file specifies classes which must be available via Jav
```
The result is an executable file that is around 22 MByte in size:
```bash
- du -h netty-plot
- 22M netty-plot
+ du -h target/netty-plot
```
4. You can now run the executable:
```bash
./netty-plot
```
- Open your web browser and navigate to http://127.0.0.1:8080/
+ Open your web browser and navigate to [http://127.0.0.1:8080/](http://127.0.0.1:8080/)
-5. Finally, you can open your browser and request rendering of a function, for example, by browsing to `http://127.0.0.1:8080/?function=abs((x-31.4)sin(x-pi/2))&xmin=0&xmax=31.4`.
+5. Finally, you can open your browser and request rendering of a function, for example, by browsing to [http://127.0.0.1:8080/?function=abs((x-31.4)sin(x-pi/2))&xmin=0&xmax=31.4](http://127.0.0.1:8080/?function=abs((x-31.4)sin(x-pi/2))&xmin=0&xmax=31.4).
### Background Information
Instead of specifying any additional parameters on the command line, they may provided in a properties file in the input JAR file.
-The `native-image` builder automatically looks for files named `native-image.properties` and for any other configuration file under `META-INF/native-image` including subdirectories, and processes their contents.
+The `native-image` builder automatically looks for files named _native-image.properties_ and for any other configuration file under _META-INF/native-image_ including subdirectories, and processes their contents.
The tracing agent writes the _reflect-config.json_ file specifying classes which must be available via Java reflection at run time.
-With Maven projects, the path convention is `META-INF/native-image/${groupId}/${artifactId}/native-image.properties`.
-In this example, the `META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties` file contains the following:
+With Maven projects, the path convention is _META-INF/native-image/${groupId}/${artifactId}/native-image.properties_.
+In this example, the _META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties_ file contains the following:
```bash
ImageName = netty-plot
Args = --link-at-build-time
```
The `ImageName` property specifies the name of the resulting executable, while `Args` are treated like additional command-line arguments.
-### A note about the application
+#### A note about the application
-This example cannot run as a regular Java application (on the JVM) and it cannot be profiled.
+This example cannot run as a regular Java application (on HotSpot) and it cannot be profiled.
It will fail because the program tries to create an [isolate which is a Native Image specific feature](https://medium.com/graalvm/isolates-and-compressed-references-more-flexible-and-efficient-memory-management-for-graalvm-a044cc50b67e).
+
+Read more in the blog post [Instant Netty Startup using GraalVM Native Image Generation](https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-ed6f14ff7692).
\ No newline at end of file
diff --git a/native-netty-plot/pom.xml b/archive/native-netty-plot/pom.xml
similarity index 97%
rename from native-netty-plot/pom.xml
rename to archive/native-netty-plot/pom.xml
index 9663858e2..e00808064 100644
--- a/native-netty-plot/pom.xml
+++ b/archive/native-netty-plot/pom.xml
@@ -9,7 +9,7 @@
UTF-8
21
- 0.9.28
+ 0.10.4
${java.specification.version}
${java.specification.version}
@@ -60,7 +60,7 @@
${imageName}
false
- --no-fallback
+ --no-fallback
true
diff --git a/native-netty-plot/src/main/java/com/oracle/svm/nettyplot/FunctionPlotter.java b/archive/native-netty-plot/src/main/java/com/oracle/svm/nettyplot/FunctionPlotter.java
similarity index 100%
rename from native-netty-plot/src/main/java/com/oracle/svm/nettyplot/FunctionPlotter.java
rename to archive/native-netty-plot/src/main/java/com/oracle/svm/nettyplot/FunctionPlotter.java
diff --git a/native-netty-plot/src/main/java/com/oracle/svm/nettyplot/PlotServer.java b/archive/native-netty-plot/src/main/java/com/oracle/svm/nettyplot/PlotServer.java
similarity index 100%
rename from native-netty-plot/src/main/java/com/oracle/svm/nettyplot/PlotServer.java
rename to archive/native-netty-plot/src/main/java/com/oracle/svm/nettyplot/PlotServer.java
diff --git a/archive/native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties b/archive/native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties
new file mode 100644
index 000000000..0728080b7
--- /dev/null
+++ b/archive/native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties
@@ -0,0 +1,2 @@
+ImageName = netty-plot
+Args = --link-at-build-time=com.oracle.svm.nettyplot
\ No newline at end of file
diff --git a/native-netty-plot/.gitignore b/native-netty-plot/.gitignore
deleted file mode 100644
index 434368352..000000000
--- a/native-netty-plot/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-
-target/
-netty-plot
-
diff --git a/native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties b/native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties
deleted file mode 100644
index 8b93bd90b..000000000
--- a/native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-ImageName = netty-plot
-Args = --link-at-build-time=com.oracle.svm.nettyplot