损坏的 usr/bin/java

损坏的 usr/bin/java

我刚刚做了一件非常愚蠢的事情,当我尝试通过输入以下命令将 JSTestDriver.jar 复制到 usr/bin/java 中时:cp jsTestDriver.jar usr/bin/java。

现在终端中的每个“java”命令都会打印出以下内容:

/usr/bin/java: line 1: PK: command not found
/usr/bin/java: line 2:Q?EA: command not found
/usr/bin/java: line 3P?EAan???META-INF/MANIFEST.MFM???: No such file or directory
~?n?/bin?m8?|<(.???l?s?.???c}?s??N̥7?)??U[?/????PB?PK
Tg.Acom/PK
Tg.A
    com/google/PK
Vg.Acom/google/jstestdriver/PK
Tg.Acom/google/jstestdriver/action/PK
Tg.A$com/google/jstestdriver/annotations/PK
Tg.A com/google/jstestdriver/browser/PK
Tg.A!com/google/jstestdriver/commands/PK
Tg.Acom/google/jstestdriver/config/PK
Ug.A!com/google/jstestdriver/debugger/PK
Ug.A!com/google/jstestdriver/embedded/PK
Ug.Acom/google/jstestdriver/guice/PK
Ug.Acom/google/jstestdriver/hooks/PK
Vg.Acom/google/jstestdriver/html/PK
P?EA#com/google/jstestdriver/javascript/PK
Vg.A*com/google/jstestdriver/javascript/compat/PK
P?EAcom/google/jstestdriver/javascript/lib/PK: No such file or directory
/usr/bin/java: line 20:Vg.A+com/google/jstestdriver/javascript/plugins/PK: No such file or directory
/usr/bin/java: line 21:Vg.A1com/google/jstestdriver/javascript/plugins/async/PK: No such file or directory
/usr/bin/java: line 22:Ug.Acom/google/jstestdriver/model/PK: No such file or directory
/usr/bin/java: line 23:Ug.Acom/google/jstestdriver/output/PK: No such file or directory
/usr/bin/java: line 24:Ug.A: command not found
/usr/bin/java: line 25:Ug.A!com/google/jstestdriver/protocol/PK: No such file or directory
/usr/bin/java: line 26: syntax error near unexpected token `com/google/jstestdriver/requesthandlers/PK'
/usr/bin/java: line 26: Ug.A(com/google/jstestdriver/requesthandlers/PK'

我已经在 Google 上搜索过我的问题,但找不到解决方案。

我正在运行 Mac OS 10.6.8,它不支持 Java SE 7.0。我原本希望它能解决我的问题。

有人知道我如何恢复 /usr/bin/java 吗?

答案1

/usr/bin/java通常只是一个符号链接,有时指向你实际的 java 安装,有时指向类似的东西/etc/alternatives/java

你使用什么 Java?Sun/Oracle?OpenJDK?你的发行版是什么?

运行命令:

find / -type f -name java

应该帮助您开始寻找真正的 Java 二进制文件。

答案2

只是为了确定:您能执行以下操作并发布结果吗?

readlink -f /usr/bin/java
file /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java -version

相关内容