1

I need to install Java 8 on my raspberry pi. I used SDKMan to do so, following this tutorial.

All works well only if I use java from my admin account (the one I used to install it). Trying to run java applications on any other, non-superuser accounts results in this error:launch.sh: 2: java: not found.

This would suggest as if Java isn't installed at all for this user! So I did some digging and apparently SDKMan holds Java hostage for whoever installed it, keeping all it's files in the accounts /home folder. And I really don't want to open up the /home folder of a root account to other users.

Is there some other way I could install Java 8 (It has to be Java 8) for all users?

Thank You for the help.

1
  • 1
    Are you running Raspberry Pi OS (Raspbian) on your Raspberry Pi? If so, which version? Jul 16, 2023 at 15:16

1 Answer 1

1

If you are using Raspberry Pi OS 11 (bullseye) on your Raspberry Pi, Java 8 should still be available in the default apt repositories. Therefore you could install Java 8 for all users like this:

sudo apt-get update
sudo apt-get install openjdk-8-jdk

In case you only need the runtime environment, not the entire development kit, you can install openjdk-8-jre instead of openjdk-8-jdk.

In case you must use SDKMan and direct apt is not an option, you could consider installing Java 8 as the user that requires it, not as root. Although this will not make Java 8 available to all the users on the system, it will be available to the one that requires it. This way you will not be opening up the root's home directory to any other user.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .