Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just did a pretty stupid thing, when I tried to copy JSTestDriver.jar into usr/bin/java by typing this command: cp jsTestDriver.jar usr/bin/java.

Now every 'java' command in terminal just prints out this:

/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
Tg.A com/google/jstestdriver/browser/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'

I've googled my problem, but cannot find a solution to my problem.

I am running Mac OS 10.6.8, which doesn't support Java SE 7.0. Which i had hoped would fix my problem.

Does anyone know how I can restore /usr/bin/java ?

share|improve this question

migrated from Jun 21 '13 at 11:46

This question came from our site for professional and enthusiast programmers.

which java version do you have? – agim Jun 19 '13 at 22:11
up vote 1 down vote accepted

/usr/bin/java is usually just a symlink, sometimes to your actual java installation, sometimes to something like /etc/alternatives/java.

What java are you using? Sun/Oracle? OpenJDK? And what is your distro?

Running the command:

find / -type f -name java

Should get you started finding the real java binary.

share|improve this answer
That makes sense. I found the real binary in /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands As far as I can remember I have (or had) java -verson 1.6.0.(something) installed. How can I link /usr/bin/java to the actual java installation again? And how can I move JsTestDriver.jar to the correct folder? I beleive I have seen people just copying jar files into /usr/bin/java or something... – stianlp Jun 19 '13 at 21:13
Just in case : on my machine, /usr/bin/java points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java – Guillaume Darmont Jun 19 '13 at 21:15
cd /usr/bin; rm java; ln -s /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java . – user829755 Jun 19 '13 at 21:23
I've now removed the old java symlink in /usr/bin and replaced it with a new link from the actual java installation, as user829775 suggested. Still doesn't work - same error as I got earlier. Thanks for the help so far! – stianlp Jun 19 '13 at 21:27
What does ls -l /usr/bin/java show? – jedwards Jun 19 '13 at 21:34

just to be sure: could you execute the following and post the result?

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
share|improve this answer
the first command: readlink: illegal option -- f usage: readlink [-n] [file ...] – stianlp Jun 19 '13 at 21:43
the second command: pretty much the same error as above. – stianlp Jun 19 '13 at 21:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.