Mac OS X and Java

Archives Forums/MacOS X Discussion/Mac OS X and Java

PhotonTom(Posted 2015) [#1]
I'm very new to Mac, I develop on Linux and Windows and only tend to use Mac to test and compile my software.
One of my open source projects that I'm using uses a little bit of Java. It loads the Java by calling the usual 'java -jar myjar.jar' command line. So in windows I ask my users to install the JRK to be able to use the program which is fine.
My problem is that after testing my program in 10.10, firstly I find Java isn't installed and then when it prompts me to install it takes me to the JRK download.
BUT in 10.10 it seems that the JRK doesn't fix the PATH to include the usual Java binary and any information online I can find says that I have to install the JDK to get that Java binary.
I was just wondering if there is a way around this for 'very non technical people' as I don't want them to have to install the heavy 500ish mb development pack just to run my java software.

Thanks for any help :)


Brucey(Posted 2015) [#2]
You could try including a JRE (binary and jars) inside your app bundle (which happens to be a folder).


PhotonTom(Posted 2015) [#3]
Ah, that is a really good idea! :)


AdamStrange(Posted 2015) [#4]
ok. not a good answer... but you should try and remove all java from your app!
Apple removed it because of safety issues. No good user would install it, and it is a bit reckless for a non-user to be prompted to do it.

installing something without user control is "A VERY BAD IDEA" - the same goes for installers - who's to say you haven't modified it? etc, etc

Therefore remove it completely if you want any credibility on OS X - had to be said ;/


Brucey(Posted 2015) [#5]
Well, that's not a very helpful answer.
There is nothing wrong with Java. I use it all the time on OS X.

Anyway, back on topic...

Here's a useful page from Oracle : https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

It discusses how you can bundle a JRE in your app bundle, and also mentions the following :
In fact, the Apple Store requires the use of an embedded JRE as a prerequisite for Mac App Store distribution.



Yasha(Posted 2015) [#6]
Apple removed it because of safety issues. No good user would install it, and it is a bit reckless for a non-user to be prompted to do it.

installing something without user control is "A VERY BAD IDEA" - the same goes for installers - who's to say you haven't modified it? etc, etc


There are at least three separate things wrong with this advice...

- Apple removed Java from the core of their OS because of safety issues with a specific version and difficulties interoperating with a third-party company over whom they had no control. A user application can choose whatever version it wants and stick to it, and doesn't affect the whole system the way an OS installation does. Most of the safety problems also didn't affect the average user (e.g. the biggest problem with Java has historically been web applets, which are totally obsolete in the 21st century and disabled anyway for 99% of users with Java installed)

- you can install whatever you want as part of your app bundle. That's the whole point of an app bundle; to separate its libraries from the system. The user won't be prompted, alerted or consulted, and there's absolutely no reason for them to be, and there's no added risk to this (except if the OS is broken, which it probably is, but that's completely beside the point)

- modifying a library or selecting a specific version is half of the entire point of bundling it! If it were standard, you wouldn't need your own copy

To the contrary, while Brucey's advice is good, it's post #4 that is highly misleading and unhelpful, and in fact contradicts the entire point of bundling.