I have a hello-world application that I have compiled into a .jar
.
public class Main {
public static void main(final String[] args) {
System.out.println("Hello, world. ");
}
}
Now I would like to use JLink to create a self-contained executable:
$ jlink --output testout --module-path ./out
Error: Unable to derive module descriptor for ./out/hello-app.jar
- What does this error mean?
- How can I fix this?
$ javac -version
javac 10.0.1
$ jlink --version
10.0.1
I am on Ubuntu 18.04.
Update:
I have added a --add-modules
flag. Now my command is:
jlink --module-path $(location :hello-app) --add-modules hello --output $OUT
I have added a module-info.java
file. My source tree:
$ tree src/
src/
├── hello
│ └── Main.java
└── module-info.java
And module-info.java
:
module hello {
}
However, now the error message is:
Error: Module hello not found