0

I'm currently trying to deploy a JavaFX Application with jlink. I have added the Maven Dependency for the jdbc Driver to establish a Connection to our Oracle Database . When I'm starting the Code from IntelliJ it is working fine. After the image is created the Application cannot find any suitable driver for the Database Connection.

Can anyone tell my how i include the jdbc dependeny in jlink ?

  • Is the Oracle JDBC driver library modular? If so, then include it in `--add-modules` or use `--bind-services` when running `jlink` (the latter approach may result in the linked run-time image being much larger than needed). If the library is _not_ modular, then you can't directly add it using `jlink`. There may be tools out there that could create a "fake" module for you, and then add it to the run-time image. But note that `jpackage` can additionally place non-modular libraries on the class-path. – Slaw Aug 12 '22 at 08:08
  • Thanks for the fast answer. I dont know if its modular. Its my first time developing something in Java^^ If I add it in modules-info and start jlink, the Error message: "Error: automatic module cannot be used with jlink: ojdbc8 from..." comes up. But I can use the Driver without requiring it in modules-info when i start the programm from intellij. – Philipp Aug 12 '22 at 09:19
  • Do you know what the Java classpath is? How do you run your code outside IntelliJ? – Thorbjørn Ravn Andersen Aug 12 '22 at 09:54
  • It is a directory for Java to find referenced Classlibraries. I execute the batch file. – Philipp Aug 12 '22 at 10:07
  • 3
    If `jlink` is failing because of an "automatic module" then the library is _not_ modular. You won't be able to create a self-contained application only with `jlink`, unless you make the library modular somehow. You could still make a self-contained application with `jpackage`, or possibly some other tool or combination of tools. Check out the "Packaging" section of the FAQs on the [JavaFX tag info page](https://stackoverflow.com/tags/javafx/info) for some ideas. – Slaw Aug 12 '22 at 11:02

0 Answers0