JAVA env set - mosinn/DOCS-n-Snippets-n-Steps GitHub Wiki

JAVA_HOME

  • set JAVA_HOME variable to java installation directory

CMD run ability from any dir

  • amend carefully PATH variable with JDK bin path as first entry

Run a jar

  • java -jar jarname.jar

MAC BEST INTERACTIVE BUILD SCRIPT

#!/bin/bash
# BEFORE using this file run below to PROVIDE RECURSIVE execute permission
# chmod -R 777 /Users/meeeeee/U
# Install JDK using homebrew
# EXECUTE THIS file from terminal using dot space syntax to keep ENV VARS
# /bin/bash
# . ~/U/shellScripts/myenv.sh
export HOMEBREW_JDK_INSTALL_PATH_PREFIX=/usr/local/opt
# Download Maven to below Path
export MANUAL_APPS_PATH=/Users/meeeeee/U/manualApps
export JDK8=$HOMEBREW_JDK_INSTALL_PATH_PREFIX/openjdk@8
export JDK11=$HOMEBREW_JDK_INSTALL_PATH_PREFIX/openjdk@11
export MVN305=$MANUAL_APPS_PATH/apache-maven-3.0.5
export MVN362=$MANUAL_APPS_PATH/apache-maven-3.6.2
############################################################
PS3='Please enter your JDK choice: '
options=("JDK11" "JDK8" "Quit")
select opt in "${options[@]}"
do
    case $opt in
    	"JDK11")
            echo "JDK11 and MVN362"
            export JAVA_HOME=$JDK11
			export M2_HOME=$MVN362
			break
            ;;
        "JDK8")
            echo "JDK8"
            export JAVA_HOME=$JDK8
			export M2_HOME=$MVN305
			break
            ;;
        "Quit")
            break
            ;;
        *) echo "invalid option $REPLY";;
    esac
done
######################################################
PS3='Please enter your MVN choice: '
options=("MVN602" "MVN305" "Quit")
select opt in "${options[@]}"
do
    case $opt in
    	"MVN602")
            echo "MVN362"
			export M2_HOME=$MVN362
			break
            ;;
        "MVN305")
            echo "MVN305"
			export M2_HOME=$MVN305
			break
            ;;
        "Quit")
            break
            ;;
        *) echo "invalid option $REPLY";;
    esac
done
######################################################
echo JAVA_HOME=$JAVA_HOME
echo M2_HOME=$M2_HOME
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$MAVEN_HOME/bin:$PATH

HISTORY CONFIG MAC

#!/bin/bash

# type history and then select command using !5

# Set the location of your HISTFILE
echo "export HISTFILE=/Users/meeeeeee/.bash_history" >> ~/.bash_profile

# Number of lines to keep (1000 in this example)
echo "export HISTFILESIZE=1000" >> ~/.bash_profile

# Set how many commands to keep in the current session history list
echo "export HISTSIZE=80" >> ~/.bash_profile

# Ignore commands that start with a space
echo "export HISTIGNORE=\"&:[ ]*:exit\"" >> ~/.bash_profile