I'm trying to install lombok in the Spring Tool Suite 4 ide which is in the /opt folder on Ubuntu. The command: java -jar lombok.jar
does not work because the opt folder requires privileges.
I tried using the command suggested by the installation software: sudo java -jar lombok.jar
I get the result:
sudo: java: command not found
Note: I have the SDKMAN software development kit manager installed to manage java versions.
Because root does not have sdkman install. root can not get java.
You can do this:
UPDATE:
Add JDK Path to sudoers config:
Run Command :
sudo nano /etc/sudoers
find
Defaults secure_path="/usr/local/sb..."
append
:/usr/lib/jvm/jdk/bin
at end of this lineit will like
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/lib/jvm/jdk/bin"
save and exit nano.
Test:
sudo java -version
Then you can run
sudo java -jar lombok.jar