bash script for invoking java easily
Find a file
2024-12-17 19:35:19 +00:00
install.sh minor changes 2024-12-17 18:46:29 +00:00
java-default-update.sh minor changes 2024-12-17 18:46:29 +00:00
java-default.sh minor changes 2024-12-17 18:46:29 +00:00
java-launcher.sh minor changes 2024-12-17 18:46:29 +00:00
LICENSE Initial commit 2024-12-16 18:26:10 +00:00
README.md commit 2024-12-17 19:35:19 +00:00
uninstall.sh minor changes 2024-12-17 18:46:29 +00:00

java-launcher

bash script for invoking java easily

Syntax:

java-launcher # (Java command)

Example syntax:

java-launcher 8 -Xmx1024M -Xms2048M -jar minecraft-12.2.jar nogui

How to install:

git clone https://codeberg.org/firebadnofire/java-launcher.git
cd java-launcher
sudo ./install.sh

You will be prompted for a dir to look for java in.

How to install java versions:

The dir you provided is where java versions will be looked for. The directory structure should look like this:

/path/to/dir/(JAVA NUMBER)

JAVA NUMBER will be 8, 17, 21, etc. This is where .tar.gz distributions of java should be untared to.

For example, your dir is in /home/public/java/ and your tar distribution is zulu17.54.21-ca-jdk17.0.13-linux_aarch64.tar.gz then your tar command to install java would be:

tar -C /home/public/java/17 -xvf zulu17.54.21-ca-jdk17.0.13-linux_aarch64.tar.gz

Some tar packages (such as the one mentioned above) extract as a sub directory, zulu17.54.21-ca-jdk17.0.13-linux_aarch64 in this case. To fix this, we can use --strip-components=1 That command would look like this:

tar -C /home/public/java/17 --strip-components=1 -xvf zulu17.54.21-ca-jdk17.0.13-linux_aarch64.tar.gz

If everything is installed correctly, you should be able to execute java as such manually with:

/home/public/java/17/bin/java

Where /home/public/java/ is your own custom path.

Alternatively, you can directly use java-launcher to test it:

java-launcher 17 -version

Setting the default java

When installing, you will be prompted for the default version for the java command to use. This script provides java-launcher-default as an alternative in update-alternatives which assumes a java version.