lu.se

Datavetenskap

Lunds Tekniska Högskola

Denna sida på svenska This page in English

java_info.sh

Name change

NOTE! On December 12, 2014, the name of the script was changed from java_check.sh to java_info.sh!
The old version isavailable, but will NOT be maintained! Get the new one instead. Thank you!

java_info.sh resides on GitHub: https://github.com/Peter-Moller/java-info

java_info.sh is a script that informs you about your java environment. I wrote it bacause of the many security problems with Java the latest years.

It is nessecary to understand that the Java Control Panel in Apple → System Preferences → Java only manages (incl. updates) the web browser Java plugin!! This Java (really a JRE) is located in /Library/Internet Plug-Ins/ and may be used for Java development, but you should not use it for that!

If you are going to develop Java yourself, with for instance Eclipse or Kojo, download a proper JDK (link below).

You store the script wherever you like and run it in the Terminal.app. A typical output looks like this:

Java report for: comp.cs.lth.se   Running: Mac OS X 10.10.5   Date & time: 2015-09-25, 12:39

Java version(s) to use for delevopment in Java:
Java Ver  Java Name File System Loccation                             
1.6.0_65-b14-466.1Java SE 6 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.8.0_25 Java SE 8 /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
1.8.0_51 Java SE 8 /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home


Current value of $JAVA_HOME: "/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home"
Suggested value of $JAVA_HOME: "/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home"

Change Java-version:
Type: "export JAVA_HOME=$(/usr/libexec/java_home -v 1.N)"
where N is the version you want to run.


Java Web Browser Plugin (in "/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin"):
• Java Applet version: 1.8.0_60)
• Java Applet plugin is NOT allowed for user "pemol"!
(do not use this JRE for Java development!!)


There are 5 java processes currently running:
• User: "pemol" (PID: 71730)
• Command: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
• Java version: "1.8.0_60"
• Launched by: "/Applications/Firefox.app/" (PID=71728, run by "pemol")

• User: "pemol" (PID: 67787)
• Command: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
• Java version: "1.8.0_60"
• Launched by: "Safari" (PID=67785, run by "pemol")

• User: "pemol" (PID: 42377)
• Command: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java
• Java version: "1.8.0_25"
• Launched by: "/Users/cs-pmo/Downloads/eclipse 2/Eclipse.app" (PID=40367, run by "pemol")

• User: "pemol" (PID: 86897)
• Command: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
• Java version: "1.8.0_25"
• Launched by: "/System/Library/CoreServices/Jar Launcher.app" (PID=86896, run by "pemol")

• User: "ludvig" (PID: 67802)
• Command: /Applications/Minecraft 2.app/Contents/runtime/jre-x64/1.8.0_60/bin/java
• Java version: "1.8.0_60"
• Launched by: "/Applications/Minecraft 2.app/" (PID=67799, run by "ludvig")


Obtaining Java:
1. Java 6 kan be fetched from Apple at this address:
   http://support.apple.com/kb/DL1572
2. Newer Java can be fethes from Oracle at this address:
   http://www.oracle.com/technetwork/java/javase/downloads/index.html
3. Functionality of web browser plugin can be tested at this address:
   http://www.java.com/en/download/testjava.jsp

 

You get the script here:
http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/java_info.sh
(
See sha1-checksum below)

Then you need to set correct access right on it so you can run it:
chmod 755 java_info.sh

The only option to the script is -u that updates it to the latest version.

You can check to see if the Java plugin is enabled with the following command:
defaults read ~/Library/Preferences/.GlobalPreferences com.apple.WebKit.JavaPlugInLastUsedTimestamp
It it is not enabled, you can enable it by going to this page:
http://www.java.com/en/download/testjava.jsp

“rtrouton” on the website DerFlounder has written a script that automatically updates this time stamp:
https://derflounder.wordpress.com/2013/03/16/automatically-enable-the-java-web-plug-ins-setting-in-safari-6-0-3-and-later/

 

You can get the lastest Java from Oracle at this address:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Java 6 can be fetched from Apple here:
http://support.apple.com/kb/DL1572

You can test Java in your web browser here:
http://www.java.com/en/download/testjava.jsp

sha1-checksum for java_info.sh: