Java 7 Preferences

andrew_stenehje
Contributor

I'm looking at trying to manage some of the settings for the new Oracle Java environment; like turning off the pref that looks for updates. Anybody already doing this and have any good information? Haven't had a chance to see if this doc applies yet or not:

http://docs.oracle.com/javase/7/docs/technotes/guides/deployment/deployment-guide/properties.html

57 REPLIES 57

johnnasset
Contributor

The above command still works in update 55:

sudo defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false

dderusha
Contributor

@bajankinch did you get this working?

sudo defaults write /Library/Application Support/Oracle/Java/Deployment/deployment.properties deployment.security.level -bool MEDIUM or WEB_JAVA_SECURITY_LEVEL=M or something like that?

trying to accomplish the same, but it seems as if this setting is set on the ~/Library/Preferences/com.oracle.javadeployment.plist

I'm having troubles getting the Key deployment.security.level with the string MEDIUM placed in the /com/oracle/javadeployment/ dictionary

TheStick
New Contributor

There, may be an easier way, but we are deploying a Java preferences package that contains

/Library/Application Support/Oracle/Java/Deployment/deployment.properties

deployment.properties has a line that reads deployment.security.level=MEDIUM

You could also create that file via a script.

jrserapio
Contributor

@maktime
I tried a combo of the suggestions on this thread. I have only tested on a couple machines, but this seems to work. create MCX based off of the defaults command here
/Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false

Computer level enforced
Value com.oracle.java.Java-Updater Key JavaAutoUpdateEnabled
bool false

To get this to work, i had to run the defaults command once to create the plist file. After that, the MCX would revert the setting of the check box, if checked again. I have not tested long enough to see if i get a pop up prompt though, but it looks like a step in the right direction.

gpalau
New Contributor II

@bmwarren

Just to throw my hat in the ring, here's the template I use to install a particular version of Java 7

how can I add my own deployment.properties file? I saw you included the source file for Oracle_Java_Preferences, but how I convert that into a pkg?

haircut
Contributor

@gpalau

You'll need to build it as a pkg yourself using your favorite packaging tool; since we're already using Packages it makes since to use that here too. Composer will also work.

You can see my deployment.properties at https://github.com/haircut/oracle-java-deployment/blob/master/deployment_preferences/Oracle_Java_Preferences/ROOT/Library/Application%20Support/Oracle/Java/Deployment/deployment.properties

Build your package to install your deployment.properties to the correct path (/Library/Application Support/Oracle/Java/Deployment) with your customized file. If you're using Composer, create a snapshot, move the file to the correct path, then build your package making sure it only includes deployment.properties and deployment.config.

dderusha
Contributor

@gpalau we did almost the same as @bmwarren. We ended up packaging the deployment.properties and deployment.config in a DMG. We have the package offered in self service as well.
Path was /Library/Application Support/Oracle/Java/Deployment/

#deployment.config
#Tue May 13 20:51:30 CDT 2014
deployment.system.config=file:///Library/Application Support/Oracle/Java/Deployment/deployment.properties
deployment.system.config.mandatory=true

#deployment.properties
#Tue May 13 20:51:30 CDT 2014
deployment.macosx.check.update=false
deployment.macosx.check.update.locked
deployment.expiration.check.enabled=false
deployment.expiration.check.enabled.locked
deployment.security.level=MEDIUM
deployment.security.level.locked
deployment.console.startup.mode=HIDE

It's worked in the past few releases and the latest 7r 67

Dan

gpalau
New Contributor II
You'll need to build it as a pkg yourself using your favorite packaging tool; since we're already using Packages it makes since to use that here too. Composer will also work. You can see my deployment.properties at https://github.com/haircut/oracle-java-deployment/blob/master/deployment_preferences/Oracle_Java_Preferences/ROOT/Library/Application%20Support/Oracle/Java/Deployment/deployment.properties Build your package to install your deployment.properties to the correct path (/Library/Application Support/Oracle/Java/Deployment) with your customized file. If you're using Composer, create a snapshot, move the file to the correct path, then build your package making sure it only includes deployment.properties and deployment.config.

@bmwarren one last question, how can I create a pkg (I have never done this before) of deployment.config and deployment.properties with Packages?

cashxx
New Contributor

@gpalau][/url I still think the easiest and most flexible way is Apple Package Maker. You have to search and install the auxiliary tools for xcode off developer.apple.com. But watch this video for a quick overview, you basically make a folder called root and then under that lay out a dummy file system like on OS X. Under Root you would have Library or System and so on. Create the whole directory structure and then put the files in place and drag the folder named root or Package in the video and set the prefs and change the names and add any Read Me info or background and create the package. Not really sure why Apple gave up on Package Maker, its still my favorite to create packages with. http://youtu.be/jpP3UbKsKT0

bmccune
Release Candidate Programs Tester

I've got the deployment.config and deployment.properties files working, except Auto Update does not actually turn off. The other settings in the deployment.properties file are applied. This is on 10.9.5 using both Java 7 and Java 8 (latest releases). After some research I found this bug which is still open and unresolved. So in case anyone else is struggling to figure out what the problem is, here you go: https://bugs.openjdk.java.net/browse/JDK-8029309

cwaldrip
Valued Contributor

All of this looks like it's for managing the auto-update and alerts (which is good, and I'm adopting). But, has someone written a script to check for and install updated Java version that I can run through Self-Service? Something like the Flash update script.

RobertHammen
Valued Contributor II

I think @rtrouton has one on his blog (http://derflounder.wordpress.com) or his github (yep, in Java 7 and Java 8 flavors):

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts

cwaldrip
Valued Contributor

Perfect. Thanks @rtrouton and @RobertHammen!

etippett
Contributor II

Does anyone know if the script above is working for v8 update 45? It seems to turn off the checkbox, but I notice that whenever I launch the Java Control Panel, it updates the last checked for updates time, which gives me pause...

@bmccune I checked on that bug and it's listed as fixed in update 60, whenever that will be released. I didn't have issues with the checkbox staying checked on 10.10.3 with java 8u45, though.

Eric

May
Contributor III

Hi @timsutton

I'd like to use the approach you mentioned and delete the symlink and also turn off updates using
defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false

How do you unload the LaunchAgent as the logged in user before you delete it ? i'd like to run it all as a script in a policy.

I've been looking into using launchctl bsexec but cannot get it to work so far.

Cheers,
Andy

timsutton
Contributor

Andy, I haven't resorted to deleting symlinks since that JavaAutoUpdateEnabled preference has been introduced.

Because Oracle does so much monkeying with those LaunchAgents/Daemons, I prefer to just leave them alone.

May
Contributor III

Thanks @timsutton

Sounds like the safest way to go!

Cheers,
Andy