Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move usr/bin/java in Terminal

After updating to OS X 10.11, my java stopped working. I read multiple places that I should do a:

sudo mv /usr/bin/java /usr/bin/java.old
sudo ln -ns /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java

But the issue is when I run the first line of code, I just get:

mv: rename /usr/bin/java to /usr/bin/java.old: Operation not permitted

Any ideas what I can do to fix this?

like image 995
Jesper Andersen Avatar asked Oct 08 '15 06:10

Jesper Andersen


People also ask

What is/usr/bin/Java in Linux?

On your system, /usr/bin/java is a symlink to /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java. When you combine the two commands together like this you substitute the output of which into the command line of readlink -f to create:

Where do I put /usr/local/bin?

Perhaps better would be to either put /usr/local/bin in your $PATH, or make a symbolic link from /usr/local/bin to /usr/bin. Assuming you are in a shell inside the /usr/bin directory and you have root permissions, you could type

How do I create a readlink from/usr/bin/Java?

On your system, /usr/bin/java is a symlink to /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java. When you combine the two commands together like this you substitute the output of which into the command line of readlink -f to create: readlink -f /usr/bin/java.

What is the difference between/usr/lib/JVM/jdk-1 and/usr/bin/Java?

/usr/bin/java is a soft (symbolic) link to /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java. There is no difference as they are the same file. If you type something like.


1 Answers

Seems like the problem with the new System Integration Protection (a.k.a rootless) that just got introduced with the new OS X.

You could try to disable the rootless in recovery mode through these steps :

  1. go to recovery mode (reboot and hold down Command + R keys simultaneously after you hear the startup chime)
  2. When the “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”
  3. run this command csrutil disable;reboot. This will reboot the laptop.

After that. Then, try to run the command again and see what will happen :D.

like image 155
kucing_terbang Avatar answered Sep 25 '22 01:09

kucing_terbang