1

I'm working on a Java 11 project from a windows 7 machine. I have compiled my project, which functions. I have built that functioning code into a jar, which opens on double click and from commandline from my windows 7 machine. It opens similarly well on a windows 10 box I have access to, as well as a mac I was able to procure for testing.

This means the issue does not reside in manifest being malformed, because it would not execute at all if such was the case.

The software has reached the point where I'm ready for integration testing and review by the client of a release candidate, but when I deployed via the constructed jar - which again functions on some machines (including macs) without issue, theirs declares that the jar could not be opened, and to check the console for possible errors. This is a GUI app, coded in Swing. Executing the same jar from a terminal setting on the same machine functions as expected.

The issue is that the client is so technologically illiterate that I had to physically go to their location and show them how to install the latest Java, and terminal use seemed to frighten them. I was unable to coerce the jar into launching via a bash script either, but that may just be my inexperience in writing them from scratch.

So my question is this:

What needs to be changed on their machine to allow this to open on a simple double-click, or what needs to change with the .jar to allow such?

Complications:

javapackager is no longer included in the JDK, as it appears to have been deprecated. Mac's app builder appears to require you already have a mac to build it on. I would likely be required to go to the client's physical location again to implement any fixes if I can't make them very easy to perform. I do not know what version of mac they are using, as I did not think to look while I was there, and they were unable to answer when I asked.

Chris
  • 11
  • 1
  • 1
    You may find this useful, as it would remove the need for the client to install Java at all: https://stackoverflow.com/questions/53453212/how-to-deploy-a-javafx-11-desktop-application-with-a-jre If you don’t want to do that, the next best choice is to run the application in the terminal yourself on that computer exactly once, using `java -jar /path/to/app.jar`, so you can see what’s going wrong. – VGR Jan 11 '20 at 02:11
  • @VGR as I said, I **did** run it on their computer from the terminal. There were no errors, there was no problems. It ran correctly. It ran correctly **only** from the terminal. Double-clicking still didn't work. – Chris Jan 11 '20 at 03:49
  • Ah, you did say that, sorry. This is a long shot, but have you tried running it in a terminal with different current directories? Perhaps even from the root directory? – VGR Jan 11 '20 at 18:03
  • @VGR Admittedly I haven't. I've always executed it from the present working directory (PWD). If it did not run from a different pwd, what would that indicate? – Chris Jan 13 '20 at 12:23
  • It would suggest that the program expects one or more files to exist in a particular relative location. You might also want to verify that there is a file association for the .jar extension on that Windows machine. – VGR Jan 13 '20 at 12:32
  • @VGR The problem is a mac machine, not windows. Still while it does expect certain files to exist within a relative path of the .JAR itself, it'll just create them if it doesn't find them. Everything else is completely self contianed within the .jar so it shouldn't matter where you put it. – Chris Jan 13 '20 at 20:42
  • I think I would try use passing something to [Thread.setDefaultUncaughtExceptionHandler](https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/Thread.html#setDefaultUncaughtExceptionHandler%28java.lang.Thread.UncaughtExceptionHandler%29) which prints the uncaught Throwable’s stack trace to a file in the user’s home directory, as a temporary measure. I would make this call the very first line of code in the `main` method. Then try running that on the user’s machine via double-clicking. – VGR Jan 13 '20 at 20:51

0 Answers0