How Do You Troubleshoot “/usr/bin/java no such file or directory”?

Problem scenario
You run java commands but you get the error "/usr/bin/java no such file or directory." What should you do?

Possible Solution #1
Reinstall Java.

Possible Solution #2
You may have deleted a linked file. To find the destination file, run this:

sudo find / -name java -type f

Based on the results, run a variation of this command draft (but substitute "/path/to/file/from/above/java" with the full path of the file found in the above command):

Then run this command (but substitute according to the results of the original "sudo find" command):

sudo ln -s /path/to/file/from/above/java /usr/bin/java

Leave a comment

Your email address will not be published. Required fields are marked *