Making a lwjgl application executable by "Double clicking"

Hi there!

I’ve always seemed to struggle with this problem, over the past few months of my learning lwjgl. When I export my application as a jar file, I am never able to make it executable by double clicking on it. I have tried Jar Splice, but even with that I find that I still need to use a batch/sh file to make the jar still run.

When I run my current jar through jar splice, and double click it, the application turns on, the window appears, but right after it loads all it’s resources (models/textures), it seems that it turns off.

The batch/sh script I use:

java -jar "test.jar"

I tried enabling the console in my Java’s preferences, but it doesn’t seem to turn on.

Any ideas?

Sounds like there’s an error. Run that java -jar test.jar in the terminal/prompt and see what happens.

If the window wasn’t appearing at all, you don’t have jar files set to open with javaw

When running from terminal, the game turns on just fine :confused:

If you’re on windows, use this as your batch script for debugging:


@echo off
java -jar test.jar > log.txt 2>&1

(I have to go to bed, so I’m not going to figure it out for linux, but it redirects stdout and stderr to log.txt)

If you don’t get anything in log.txt (will be created), then something’s failing silently, and that’s never good.

I’m on a mac for a few weeks. I removed the “@echo off” part, as it wouldn’t work in a shell script. The java line still worked, and it created a log file. However, the contents of the log file seemed perfectly fine; the game turned on as it should, and ran normally.

The problem only seems to occur when I double click the jar :confused:

Does this happen with all jar files, or only your game?

Hi

Please remind me which version of OS X you use. Look at the security settings of Gatekeeper.

Only the games I’ve made. I’ve rewritten my game like 4 times since I started it; each rewrite has the same bug. Other jars open up just fine.

[quote=""]
OS X 10.9.2 (13C64)

I have also tried it on my dads macbook which yields the same effect.