Java not usable, bash: java: command not found error

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: java not usable, bash: java: command not found报错

| username: Jaimyjie

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] 6.1.1
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

When upgrading from 6.1.1 to 6.5 and checking the cluster health status: tiup cluster check --cluster
Prompt: java not usable, bash: java: command not found
But the node has JDK 1.8 configured for the tidb user, not sure what the reason is?

| username: tidb菜鸟一只 | Original post link

Take a look at the configuration file. Is it started by the tidb user? It is recommended to also configure the JDK for the root user.

| username: Jaimyjie | Original post link

Yes, when starting TiDB, both TiDB and root have the JDK environment variables configured in the .bash_profile file.

| username: Jaimyjie | Original post link

Found the reason, TiDB does not support manually configured JDK environment variables. There must be a java in /usr/bin. Created a symlink to solve it: ln -s /usr/local/jdk1.8.0_311/bin/java /usr/bin/java

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.