Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:22:35+00:00 2026-06-13T15:22:35+00:00

Apple’s Java update this week removes the Java Preferences.app from Utilities. When working between

  • 0

Apple’s Java update this week removes the Java Preferences.app from Utilities. When working between different versions of Java in varied development environments it no longer seems easily achievable to change from Java 6 to Sun’s 1.7 as before.

I believe that there still should be a shell mechanism in place to accomplish this, however I’m not readily finding it. How do you PROPERLY change the current active version of Java whilst in a shell session?

(I say PROPERLY because I want to be sure that all env vars are set appropriately such as JAVA_HOME, it’s path, etc.)

Additionally, I thought, a couple of years ago, I had stumbled across a script that would change Java env’s for you by simply listing the options and then defining which one to switch to. It may be that I’m getting confused with the tool in Ubuntu, but I am nearly certain it was for OS X… It would be helpful to either know what this was or perhaps we should write a quick script, if one doesn’t exist, that will meet this need; perhaps inserting it into Homebrew?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:22:36+00:00Added an answer on June 13, 2026 at 3:22 pm

    Thanks to @MadProgrammer who initially replied to this question. I got to exploring things a little more and found some examples that helped me with the following script that I’m now using to execute Java applications that will not function with Java 1.7 currently:

    #!/usr/bin/env bash
    # Or plug in `zsh` instead of `bash` above if that is your preferred shell
    
    DIR=$(pwd)
    cd "$DIR"
    APPLICATION_NAME="App Name"
    
    echo -n "Locating Java ... "
    
    PLATFORM=$(uname)
    JAVA_PATH="java"
    JAVA_VER=$($JAVA_PATH -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
    
    if [[ "$JAVA_VER" == *"command not found"* ]]; then
        echo "Java not found."
    else
        JAVA_VER_FULL=$($JAVA_PATH -version 2>&1 | awk -F '"' '/version/ {print $2}')
    
        if [[ $JAVA_VER -eq 17 ]]; then
            echo "v1.7 found."
    
            if [[ $PLATFORM -eq "Darwin" ]]; then
                echo "[!!!] WARNING: Java v1.7 on OS X is known to have problems with ${APPLICATION_NAME}."
                echo -n "Looking for compatible version of Java ... "
    
                JAVA_PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java"
                if [[ -f "$JAVA_PATH" ]]; then
                    JAVA_VER=$($JAVA_PATH -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
                    JAVA_VER_FULL=$($JAVA_PATH -version 2>&1 | awk -F '"' '/version/ {print $2}')
                    if [[ $JAVA_VER -eq 16 ]]; then
                        echo "$JAVA_VER_FULL found. Using this version."
                    else
                        echo "No known compatible versions of Java could be found. ${APPLICATION_NAME} may not run properly, or at all."
                    fi
                fi
            else
                echo "$JAVA_VER_FULL found."
            fi
        else
            echo "$JAVA_VER_FULL found."
        fi
    fi
    
    echo ""
    
    
    echo "Starting ${APPLICATION_NAME}..."
    
    
    # Insert the java application or jar that you wish to execute here prepended by `$JAVA_PATH` instead of simply `java`
    # For example:
    #
    # $JAVA_PATH -jar /path/to/the/application.jar
    

    One potentially useful situation for this is to create a script to run Minecraft that is having problems with with the 1.7 release scenario. Obviously there are other similar apps that are having some varying degrees of problems and this will likewise be useful to control the Java version you wish to use rather than just using the default method or trying to hack around the symlinks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apple has seen fit to remove the Java Preferences app from the Utilities folder
Apple says: removeFromSuperview Unlinks the receiver from its superview and its window, and removes
Apple says: removeFromSuperview Unlinks the receiver from its superview and its window, and removes
Apple has explained in Launching the App Store from an iPhone application how one
Apple recommends cropping out the status bar from screenshots submitted to the app store.
Apple have sent me a crash log from an app sent for approval. Despite
Apple rejected this app, and even provided a long explanation in the Resolution Center,
Apple have long blocked mobile Safari from playing sounds – the usual JavaScript commands
Apple does this for most of UIKit. You just pass in a tintColor to
Apple clearly has this automated in some way, I would like to have access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.