I need a tool for distributing LWJGL3 applications

Hello,

I need a tool that will create executable files (.exe for Windows, .app for macOS, and executable file for Linux, for example: “.sh”). I want to make builds from Window for three OS.

I tried JarSplice. But this tool has problems with LWJGL3.

First problem. For example, if you want to create .exe you need to add these two JARs:

  • lwjgl-glfw.jar
  • lwjgl-glfw-natives-windows.jar

But these JARs contains the same files:

  • glfw.dll.sha1
  • glfw32.dll.sha1

JarSplice shows the error message:

[quote]duplicate entry: glfw.dll.sha1
[/quote]
I solved this problem. I deleted duplicate files (for example, glfw.dll.sha1) from lwjgl-glfw.jar and another JARs. Windows build works correctly. Please, try on your computer with Windows: TheQuad_Windows.zip

Second problem (Linux). JarSplice creates the .sh file with CRLF but Linux requires LF. You can run the build on Linux: TheQuad_Linux.zip But you need manually to delete CR on Linux at the beginning of the .sh file. I tried to replace CRLF with LF, please, try it on your computer with Linux: TheQuad_Linux.zip

Third problem (macOS). JarSplice creates an executable file that does not work on macOS. Please, try to run: TheQuad_macOS.zip

I am not working with LWJGL3, but I have gotten the following tools to work with both Windows 64-bit systems and with MacOS, for both Swing-based and OpenJDK11/OpenJFX11 projects.

In both cases I use jlink to create a self-contained, customized runtime. The jlink utility places the executable in a /bin subfolder. If compiled on Windows, a .bat is built there. But I don’t recommend using it. Instead, for the last stage of packaging I use Inno Setup. (I used version 5, but I think they are now at version 6). This is the same third-party software referenced by Oracle in the documentation they have for distributing Windows programs. I use it to install the program in the “Program Files” folder, and to call an executable from either the Windows Start menu or from a desktop icon. I’ve also used this tool successfully for file association. Also, the tool does work with 32-bit Windows, in fact that is the default. I just don’t use this mode because I am jlinking.

For MacOS, you might consider using the tool Packages. I like this a LOT, but there is one limitation that has stumped me. I’d prefer to install at a sub folder of the user’s Home directory, but there does not appear to be a way to do this. (There is a tutorial that attempts to show how, but it doesn’t work and the author of the program wrote back to me just a couple days ago to say that this is due to a known bug from the Apple side.)

However, there are provisions for adding pre- and post-install scripts (which I haven’t tried yet) and the software does appear to be being kept up to date (despite having been originally written before 2010). As I said, it works great if you are installing directly to the top Applications folder. Also kind of neat, they provide source code for the tool, if you are into tinkering.

I opted to go with a simpler hack for my program. This hack is a way to create a Mac “Bundle” manually, without all the specs and Info.plist configurations. The file folder containing the program is viewed by the Mac as if it were a single .app file. Give me an hour or so, and I’ll post a tutorial on this and link it here. The result can be zipped and shipped and the user can move/copy/paste it to where-ever from their /Downloads directory.

Thank you for your reply.

[quote]For MacOS, you might consider using the tool Packages.
[/quote]
I think I should have a computer with macOS or I should install macOS on VirtualBox but I do not want to do it because I work on laptop and I do not have so many space that masOS requires. I need analog of JarSplice that can create standalone executables from Windows for Linux and macOS. JarSplice was released in 2012. I this it is too old. I think this is reason why JarSplice creates standalone executables for Lwjgl incorrectly. Is exits so simple tool like JarSplice?

Current documents on deployment that I’ve seen all say that you have to compile on the system that you want the program to run on. Could JarSplice running on a Windows PC really make programs that could run on a MacOS? Or did the jars for the Mac version first need to be compiled on a Mac?

I am using Oracle’s VM on a laptop. I didn’t think this laptop would support it, but it does! Maybe your laptop has similar specs and could also work?

Specs: Intel i3, 2.4 GHz, 8 GB RAM, 917 GB hard disk.

If I recall correctly, I gave the VM 4 GB RAM and 100 GB hard disk space.

But there are definite limitations:

  1. JavaFX is not implemented, and does not work, and there does not seem to be a move to implement it at this time.
  2. I haven’t attempted to get sound to work. It could be possible to get this going but IDK and don’t want to invest the effort to investigate right now.

Maybe with LWJGL the JavaFX bug is irrelevant. Swing GUI works perfectly well on the VM, as far as I can tell. (Haven’t tested drag-and-drop yet…)

In any event, I’m able to compile jlink projects on the VM for use on MacOS, though I do rely on friends for additional testing. And I was able to download and run the “Packages” software tool I linked in the earlier email. BTW, I posted the “simple MacOS hack” tutorial. Maybe some form of that idea will work for you, but it would still require getting the emulator working.

[quote=“philfrei,post:4,topic:59901”]
It should be but it does not work in reality.

For example, this tool, called Unity, allows to create standalone executables from Windows (and from Mac OS X) for different platforms.

I created these builds from Windows 10. You can try to run this example if you want:

I already told you that Unity may drive your WebGL program a lot slower on some machines and WebGL without using Unity can be slow on some hardware for some reasons I could repeat once more.

I advise you to use a nice build tool allowing to choose which line ending character to use in your files, for example Apache Ant.

philfrei mentioned Inno Setup but Nullsoft Scriptable Install System can be used with Apache Ant:
https://sourceforge.net/p/nsis-ant/code/ci/master/tree/

But Unity allows to create native executable from Windows for Windows, Linux, MacOS, Android, iOS and so on. Unity WebGL works on Desktop. If uses do not want (or cannot) to run Unity WebGL build he (or she) can download native build for his OS, for example, for Android. I use pure WebGL (and TypeScript) too because I can solve a lot of tasks with pure WebGL. Or I can use any WebGL wrapper: Phaser/Pixi.js (for 2D) or Three.js/Babylon.js (for 3D). This frameworks works on all mobile devices. You can check what browsers support WebGL: https://caniuse.com/#feat=webgl For example, Phaser framework is special for Mobile:

[quote]Desktop and Mobile HTML5 game framework. A fast, free and fun open source framework for Canvas and WebGL powered browser games.
[/quote]
I will use Unity for creating native executables for different operation systems and WebGL/TypeScript for cross-platform web-applications. Everyone can run pure WebGL by one click. I write it one and I do not need to rebuild it. Plugins are not required. Pure WebGL is very alternative for Java Applets (that was killed).

I am a beginner. I need very simple step by step instruction. As simple as all step by step instructions about how to create executables builds from Windows for Linux and MacOS from Unity. Or not so complicated. I have only one OS - Windows. Why cannot JarSplice make builds for Linux and MacOS correctly? Why is it so complicated for beginners in Lwjgl? I can make all build from Unity by a few clicks. And it is very easy for me to create pure crass-platform WebGL application. Lwjgl is good but it does not allow me to create crass-platform builds from Windows as simple as Unity builds and pure WebGL/TypeScript.

I agree that Java client side distribution leaves a lot to be desired. While I haven’t used them, unity and other tools appear much more fully featured. Oracle have largely abandoned client side java.

I was quite excited about JLink which makes a smaller JVM just for your game. I followed Philfrei’s adventures and other guides on the web about using it to build a small distribution. One year ago I tried and failed to port my little game from old java to new modular java and make my own jlink-ed project and failed. Making old code and external JAR file dependencies modular is extremely difficult. It’s ridiculous that the Netbeans IDE’s doesn’t automate this properly. Maybe other IDE’s do a better job now? I’m not sure.

As an aside, it’s interesting that Ninite actually list two places to get the JDK from and neither are directly from Oracle: AdoptOpenJDK and Amazon Corretto JDK:
https://ninite.com/