- JAVA as OpenJDK in place of the binary Oracle JRE.
pkg install openjdk8
pkg install openjdk24
- IcedTea-Web project provides a Free Software web browser plugin running applets written in the Java.
pkg install icedtea-web
- Install firefox.
pkg install firefox
- Install thunderbird
pkg install thunderbird
- Install chrome
pkg install chromium
Note that the executable is actually chrome and not chromium.
- Install surf
pkg install surf-browser
- Install lynx if all the above browsers are resource hungry.
pkg install lynx
Based on the commands
- Check for current version used
JAVAVM_DRYRUN=yes java
Alternatively,
java -version
- Check if the desired version is installed (e.g. OpenJDK24)
JAVAVM_DRYRUN=yes JAVA_VERSION=24 java
Alternatively, get the list of installed Java versions using
cat /usr/local/etc/javavms
- Compile a
MyClass.javausing a specific Java version (e.g. ≥ OpenJDK24)
JAVA_VERSION=24+ javac MyClass.java
- Set a specific Java version
For JDK or JRE the operating system environment variable is
JAVA_HOME. That is, Java application use this variable to find where the runtime (JVM) is installed. The variable value is determined from runningcat /usr/local/etc/javavms.
4.1. set the value of JAVA_HOME to desired Java version
- For C shell you set
JAVA_HOMEenvironment in/etc/csh.cshrcfor all users For example, for setting OpenJDK24 as the default Java version, dovi /etc/csh.cshrcand enter# System-wide .cshrc file for csh(1). setenv JAVA_HOME /usr/local/openjdk24 setenv PATH $JAVA_HOME/bin:$PATH - Make the path
/etc/csh.cshrcavailable to sourcesource /etc/csh.cshrc - For Boune shell you set
JAVA_HOMEenvironment in/usr/home/<username>/.profile(which is the same as~/.profileexport JAVA_HOME=/usr/local/openjdk24 export PATH="$JAVA_HOME/bin:$PATH$ - Determine what shell is used in your console/terminal
echo $SHELLandecho $ENVto know the shell path.
4.3. Switch to another Java version (e.g. OpenJDK17)
# System-wide .cshrc file for csh(1).
setenv JAVA_HOME /usr/local/openjdk17
setenv PATH $JAVA_HOME/bin:$PATH
Then, repeat 4.2. to make the new path available to source.
4.4. Check the Java version
java -version