Distributing OPENRNDR programs

I don’t know if this has been asked before, but what is the recommended way to distribute programs?

I ran the “assembleDist” gradle task, and now I have a shell script and a batch script.

When I run the shell script on Linux, I get this:

failed to load font: file '/home/sergi/Downloads/maze-solver-0.0/bin/data/fonts/default.otf' does not exist. (IllegalArgumentException)

If I manually copy and paste the data folder into the bin folder it works. This seems like an unsatisfactory solution though.

When I run the batch script in a Windows VM, I get this:

[LWJGL] Failed to load a library. Possible solutions:
        a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
        b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openrndr.Application$Companion.run(Application.kt:44)
        at org.openrndr.ApplicationKt.application(Application.kt:97)
        at org.openrndr.ApplicationBuilderKt.application(ApplicationBuilder.kt:109)
        at MainKt.main(Main.kt:97)
        at MainKt.main(Main.kt)
Caused by: java.lang.UnsatisfiedLinkError: Failed to locate library: lwjgl.dll
        at org.lwjgl.system.Library.loadSystem(Library.java:162)
        at org.lwjgl.system.Library.loadSystem(Library.java:62)
        at org.lwjgl.system.Library.<clinit>(Library.java:50)
        at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
        at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:67)
        at org.lwjgl.system.Callback.<clinit>(Callback.java:41)
        at org.openrndr.internal.gl3.ApplicationGLFWGL3.createPrimaryWindow(ApplicationGLFWGL3.kt:353)
        at org.openrndr.internal.gl3.ApplicationGLFWGL3.<init>(ApplicationGLFWGL3.kt:130)
        ... 9 more

I’m not sure how I can fix that one.

The advised way is to use the jpackage task. I am not even sure where assembleDist comes from but I’ll see to remove it from the tasks in the template project.

Note that the jpackage task can only create distributables for the host platform, i.e. there is no support for cross building distributables.

I just ran the jpackage task on the openrndr template on Windows. When I launch the exe in build/jpackage it gives me the error Failed to launch JVM.

On Linux, the jpackage task fails with Cannot query the value of extension 'runtime' property 'javaHome' because it has no value available.

I suspect there is a problem with the logger libraries. I just upgraded openrndr-template with new versions of OPENRNDR and logger libraries and verified that the jpackage task produces a runnable executable on Windows.

For the failure on Linux. This sounds like a problem with how your JDK is set up. Jpackage needs at least JDK 14 to work

Hi! :slight_smile: Did you figure out a solution @rolodophone ?

No, I didn’t find a solution @abe. But it was a while ago so maybe things have changed now.

Which version of openrndr-template are you using? It sounds like the latest one might help.

I’m trying out :jpackage too. The task was successful. However, double clicking on the .exe gives no response. No errors, nothing at all.

My setup:
JDK 15 in Intellij
Windows 10
Java SE8

I’m still fresh in the JVM world so please forgive me if this question is stupid :slightly_smiling_face:

Ok I figured out my problem. I renamed my TemplateProgram.kt to App.kt. I just needed to change val applicationMainClass to AppKt in build.gradle.kts and it worked!

This Gradle guide might be useful reading for others in the future.

3 Likes