You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -49,41 +49,42 @@ You can download a standalone based on Oracle GraalVM or GraalVM Community Editi
49
49
3. A standalone comes with a JVM in addition to its native launcher. Check the version to see the runtime is active:
50
50
```shell
51
51
# Path to Espresso installation
52
-
./path/to/bin/java -truffle -version
52
+
./path/to/bin/java -version
53
53
```
54
54
55
55
## Run a Java Application on Espresso
56
56
57
-
You can run a Java application on Espresso, by passing the `-truffle` option to the standard `java` launcher.
58
-
This is similar to how you used to switch between the `-client` and `-server` JVMs.
57
+
The `java` launcher included in the Espresso standalone works like the standard `java` launcher:
59
58
60
59
To execute a class file:
61
60
```shell
62
-
java -truffle [options] class
61
+
java [options] class
63
62
```
64
63
To execute a JAR file:
65
64
```shell
66
-
java -truffle [options] -jar jarfile
65
+
java [options] -jar jarfile
67
66
```
68
67
69
68
You can also run a Java application from the main class in a module, or run a single source-file program:
70
69
```shell
71
-
java -truffle [options] -m module[/<mainclass>]
72
-
java -truffle [options] sourcefile
70
+
java [options] -m module[/<mainclass>]
71
+
java [options] sourcefile
73
72
```
74
73
75
-
By default, Espresso runs within GraalVM by reusing all GraalVM's JAR files and native libraries, but it is possible to "cross-version" and specify a different Java installation directory (`java.home`).
76
-
It will automatically switch versions regardless of the host JVM.
74
+
By default, Espresso runs with the standard library included in the standalone, but it is possible to specify a different Java installation directory (`java.home`).
75
+
It will automatically switch versions as long as the new Java home is a supported version (8, 11, 17, or 21).
> Note: If you use `-server` option of the `java` launcher, espresso will not be used and HotSpot will be started instead.
81
+
> You can also use `-truffle` to explicitly require the use of espreso (the default).
82
+
81
83
## Performance Considerations
82
84
83
85
The startup time will not match the speed offered by the regular GraalVM just-in-time (JIT) execution yet, but having created a fully working Espresso runtime, the development team is now focusing on performance.
84
-
You can still influence the performance by passing the following options to `java -truffle`:
85
-
* `--engine.MultiTier=true` to enable multi-tier compilation;
86
-
* `--engine.Inlining=false` in combination with `--java.InlineFieldAccessors=true` to make the compilation faster, in exchange for slower performance.
86
+
You can still influence the performance by passing the following option to `java`:
87
+
*`--engine.Mode=latency` to enable Truffle's latency mode to make JIT compilation faster, in exchange for slower peak performance.
87
88
88
89
The `--vm.XX:` syntax ensures the option is passed to the underlying [Native Image VM](../native-image/BuildOptions.md).
89
90
When using the `-XX:` syntax, the VM first checks if there is such an option in the Espresso runtime.
@@ -97,7 +98,7 @@ This might be important for options such as `MaxDirectMemorySize` which can be s
97
98
To ensure you have successfully installed Espresso, verify its version:
98
99
```shell
99
100
# Path to Espresso installation
100
-
./path/to/bin/java -truffle -version
101
+
./path/to/bin/java -version
101
102
```
102
103
103
104
Taking this `HelloWorld.java` example, compile it and run from the command line:
@@ -111,7 +112,7 @@ public class HelloWorld {
111
112
112
113
```shell
113
114
$JAVA_HOME/bin/javac HelloWorld.java
114
-
$JAVA_HOME/bin/java -truffle HelloWorld
115
+
$JAVA_HOME/bin/java HelloWorld
115
116
```
116
117
117
118
Taking some real-world applications, try running [Spring PetClinic](https://github.com/spring-projects/spring-petclinic) - a sample web application that demonstrates the use of Spring Boot with Spring MVC and Spring Data JPA.
4. When the application starts, access it on [localhost:8000](http://localhost:8080/).
136
137
137
138
#### From IDE
138
139
139
-
To run a Java project on Espresso from an IDE requires setting GraalVM as a project's default JDK and enabling the Espresso execution mode.
140
+
To run a Java project on Espresso from an IDE, you need to set the Espresso standalone as the project's default JDK.
140
141
For example, to run the Spring PetClinic project using Intellij IDEA, you need to:
141
142
142
-
1. Navigate to **File**, then to **Project Structure**. Click **Project**, and then click **Project SDK**. Expand the drop down, press Add **JDK** and open the directory where you installed GraalVM. For macOS users, JDK home path will be `/Library/Java/JavaVirtualMachines/{graalvm}/Contents/Home`. Give it a name, and press Apply.
143
+
1. Navigate to **File**, then to **Project Structure**. Click **Project**, and then click **Project SDK**. Expand the drop down, press Add **JDK**, and open the directory where you installed the Espresso standalone. For macOS users, JDK home path will be `/Library/Java/JavaVirtualMachines/{espresso-standalone}/Contents/Home`. Give it a name, and press Apply.
3. Enable Espresso. From the main menu select**Run**,then**Run…**. Click **Edit Configurations** and choose **Environment**. Put the `-truffle -XX:+IgnoreUnrecognizedVMOptions`commandin**VM options** and press Apply.
It is necessary to specify `-XX:+IgnoreUnrecognizedVMOptions` because Intellij automatically adds a `-javaagent` argument which is not supported yet.
155
-
156
-
4. Press Run.
151
+
3. Press Run.
157
152
158
153
## Debugging
159
154
160
155
You do not have to configure anything special to debug Java applications running Espresso from your favorite IDE debugger.
161
156
For example, starting a debugger session from IntelliJ IDEA is based on the Run Configurations.
162
-
To ensure you attach the debugger to your Java application in the same environment, navigate in the main menu to Run -> Debug… -> Edit Configurations, expand Environment, check the JRE value and VM options values.
163
-
It should show GraalVM as project's JRE, and VM options should include `-truffle -XX:+IgnoreUnrecognizedVMOptions`, where `-truffle` enables Espresso, and `-XX:+IgnoreUnrecognizedVMOptions` is a temporary workaround since the Espresso runtime does not yet support attaching Java agents.
0 commit comments