# Distributing OPENRNDR programs

**URL:** <https://openrndr.discourse.group/t/distributing-openrndr-programs/210>\
**Category:** How to?\
**Created:** [February 27, 2021, 8:11pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210 "2021-02-27T20:11:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolodophone](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rolodophone](https://openrndr.discourse.group/u/rolodophone)\
**Post date:** [February 27, 2021, 8:11pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/1 "2021-02-27T20:11:31Z")

</div>

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:

```auto
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:

```auto
[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.

---

<div class="post-metadata">

**Author:** ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://openrndr.discourse.group/u/edwin)\
**Post date:** [February 27, 2021, 9:53pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/2 "2021-02-27T21:53:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rolodophone](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rolodophone](https://openrndr.discourse.group/u/rolodophone)\
**Post date:** [March 1, 2021, 7:00pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/3 "2021-03-01T19:00:45Z")

</div>

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.`

---

<div class="post-metadata">

**Author:** ![edwin](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@edwin](https://openrndr.discourse.group/u/edwin)\
**Post date:** [March 12, 2021, 8:08am UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/4 "2021-03-12T08:08:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [May 27, 2021, 8:58am UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/5 "2021-05-27T08:58:05Z")

</div>

Hi! 🙂 Did you figure out a solution @rolodophone ?

---

<div class="post-metadata">

**Author:** ![rolodophone](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rolodophone](https://openrndr.discourse.group/u/rolodophone)\
**Post date:** [May 27, 2021, 12:47pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/6 "2021-05-27T12:47:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [May 28, 2021, 5:27am UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/7 "2021-05-28T05:27:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TSAO](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/tsao/32/413_2.png) [@TSAO](https://openrndr.discourse.group/u/TSAO)\
**Post date:** [October 10, 2022, 10:56pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/8 "2022-10-10T22:56:18Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![TSAO](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/tsao/32/413_2.png) [@TSAO](https://openrndr.discourse.group/u/TSAO)\
**Post date:** [October 10, 2022, 11:38pm UTC](https://openrndr.discourse.group/t/distributing-openrndr-programs/210/9 "2022-10-10T23:38:25Z")

</div>

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](https://docs.gradle.org/current/samples/sample_building_kotlin_applications.html#what_youll_build) might be useful reading for others in the future.
