Reputation: 185
My application that is built with gradle is not able to be packaged with graal's native image command.
I build the combined jar using:
gradlew --no-daemon assemble
Then, I test my cli application using:
java -jar build/libs/stackoverflow-cli-0.1-all.jar search -q "merge maps" -t java
The output is what I expected, so that's good. However, I then want to create the native binary using graalvm. So I run this command:
native-image --no-server -cp build/libs/stackoverflow-cli-0.1-all.jar
It immediately fails with the following error:
Warning: Ignoring server-mode native-image argument --no-server.
Error: Please specify class containing the main entry point method. (see --help)
I thought this was weird. The next thing I tried was to specify the main class as the error suggested:
native-image --no-server -cp build/libs/stackoverflow-cli-0.1-all.jar com.eddie.StackoverflowCliCommand
That gives me a different error:
Warning: Ignoring server-mode native-image argument --no-server.
[com.ivansinsurance.stackoverflowclicommand:1544] classlist: 3,060.25 ms, 0.96 GB
[com.ivansinsurance.stackoverflowclicommand:1544] setup: 809.46 ms, 0.96 GB
Error: Default native-compiler executable 'cl.exe' not found via environment variable PATH
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
I don't know what this error means. Here is the version of java I'm using:
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
Any help is greatly appreciated!
Upvotes: 5
Views: 7428
Reputation: 185
I installed Visual Studio 2019.
Then I launched x64 Native Tools Command Prompt for VS 2019
Then I ran:
'native-image --no-server -cp build/libs/stackoverflow-cli-0.1-all.jar com.eddie.StackoverflowCliCommand'
and that worked!
Upvotes: 4