Sony Bridge for Mac vs. Java

2013-04-06 by Thomas Lotterer

I wanted to upgrade the Android Firmware of my Sony Xperia J using Sony Bridge for Mac 3.2 on my iMac running OS X 10.8.3 Mountain Lion and Java SE Runtime Environment 1.7.0. Upgrade failed because SB4M insists on having Java 6 available. It bailed out with error message: Java SE 6 is required to complete the process and must be installed and activated on this computer. Last time my workaround was to use a Windows PC but this time I found a more elegant solution.

For Mac OS X Users the gap between Java 6 and Java 7 is huge because the former was shipped with the OS up to Lion 10.7.2, supported by Apple and brought up to date with Software Update. With Lion 10.7.3 Apple dropped Java, no longer shipped nor supported nor maintained it. Users have to download, install and maintain Java 7 directly from Oracle/ Sun. Usually I immediately flush any application which forces me to go back. But there is no alternative for Sony Bridge for Mac.

After finding the error message inside “DeviceUpdate” I noticed it runs “/usr/bin/java -version“. My idea was to create a wrapper around Java which fakes the version output to cheat SB4M thinking it has the correct Java SE available. It turned out things are easier than that. Java is not needed at all! Just replace the calls to “/usr/bin/java” with the no-op “/usr/bin/true” and you’re done.

I do not want to redistribute copyrighted material without permission so here is a way to search&replace the binary:
$ sudo bash
# cd /Applications/Sony\ Ericsson\ Bridge\ for\ Mac.app/
# cd Contents/Frameworks/DeviceUpdate.framework/Versions/A/
# mv DeviceUpdate DeviceUpdate.ORIG
# perl -e 'while(<>) { s|/usr/bin/java|/usr/bin/true|g; print $_ }' \
  <DeviceUpdate.ORIG >DeviceUpdate.NOJAVA
# ln DeviceUpdate.NOJAVA DeviceUpdate
# ls -li DeviceUpdate*
3665195 -rw-r--r-- 2 thomas staff 5743168 Apr 5 18:17 DeviceUpdate
3665195 -rw-r--r-- 2 thomas staff 5743168 Apr 5 18:17 DeviceUpdate.NOJAVA
3623278 -rwxr-xr-x 1 thomas staff 5743168 Mar 14 17:07 DeviceUpdate.ORIG

Restart Sony Bride for Mac afterwards and the Upgrade works. Have fun!

30 Responses to “Sony Bridge for Mac vs. Java”

  1. Giuseppe Says:

    works!!!!!!!! thak you!!!!

  2. Mark Says:

    Thank you!!! :)

  3. Øyvind Says:

    Brilliant, thank you :)

  4. Balaji Says:

    Thank You!!!
    Works on my mac book pro!!

  5. Hotcutie Says:

    ILY :p thank you so much

  6. MiChaelinzo= PSN Says:

    Bro your a genius :) ) Thank you:))

  7. django Says:

    I’m not able to do this, please help.

  8. MaaT Says:

    Great Job mate!

  9. Thomas Lotterer Says:

    @django: please ask more specific. You probably need help from someone who knows what “Terminal” is.

  10. Joucke Says:

    Thomas, you’re a life saver. Maybe the problem at django’s is what I encountered at first: is there a space or a newline or something else before <DeviceUpdate.ORIG? I've solved that part by copy-pasting into my terminal. After getting "Can't open : No such file or directory at -e line 1." ;)

  11. Thomas Lotterer Says:

    @django, joucke: everything from “perl” to “NOJAVA” is actually one single logical line. It is wrapped into two visual lines and the backslash at the end is for concatenation. In case of doubt merge the two visual lines into one and drop the backslash. BTW, line length limitation in the blog is the reason for the two “cd” statements. It could be done in one step, too.

  12. Ethan Says:

    maybe a stupid question, but where can I find the error mssg?

  13. Robert Provencal Says:

    Works like a charm! Thank you for posting!!!

  14. Rafael Says:

    It works like a charm! Thank you! :)

  15. blackadmin Says:

    Great Works like a charm….

  16. Riddhish Says:

    Thanks. It works.

  17. Alan Says:

    Works like a charm!

  18. HoarFrost Says:

    Works perfectly

  19. Rashid Says:

    Wowwwww… Working fine, thanks

  20. Jimy12 Says:

    Problem fixed perfectly!! Thanks!!

  21. Vanna Says:

    Hi, I tried your method, there were no errors (I tried a grep and there’s no /usr/bin/java” in the new file) but Sony Bridge still insists that I need Java 6. Any ideas? I have 10.8.5.
    Thanks.

  22. Thomas Lotterer Says:

    I tried the replacement with Sony Bridge for Mac 3.5(3503) and the result should look like this

    # strings DeviceUpdate.ORIG | fgrep /usr/bin
    /usr/bin/java
    /usr/bin/ditto

    # strings DeviceUpdate.NOJAVA | fgrep /usr/bin
    /usr/bin/true
    /usr/bin/ditto

  23. Vanna Says:

    Yes, that’s what I got. Thanks for the super quick response.

  24. Rene Lesser Says:

    Hey i tried your method too but honestly i used the terminal for the first time and afterwards i cant open sony bridge at all :(

    Im running SB4M 3.4 (3404) and ios 10.8.5 please help !! i need to fix my Xperia Z1 with the new firmware update because it has allot of bugs

    thx allot really appreciate it !!

  25. Rene Lesser Says:

    sorry just updated to SB4M 3.5 (3505)

  26. Andy Says:

    Great tip! Worked like a charm.

  27. Simone Rocchi Says:

    Great!!! Thanks a lot!

  28. Marc Says:

    Still working in 09/2014 ;)

    Thx mate and regards from Luxembourg!

  29. MaaT Says:

    Thomas,
    Legendary!

    For those using the last version of java (1.7.0_11) and the software is still failing to work for phone upgrades, try it:

    - Start the Sony Bridge from the command line:
    $ /Applications/Sony\ Ericsson\ Bridge\ for\ Mac.app/Contents/MacOS/Sony\ Ericsson\ Bridge\ for\ Mac

    - Carry on with the upgrade and keep an eye on the Terminal Window. If you see a error like this:
    JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/bundle/Libraries/libserver.dylib
    JavaVM FATAL: Failed to load the jvm library.
    Sony Ericsson Update Engine:
    Failed to create the Java Virtual Machine.

    - Execute:
    # mkdir /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/bundle/
    # mkdir /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/bundle/Libraries/
    # ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/jre/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/bundle/Libraries/libserver.dylib

    It should solve the issue.

  30. Sonia Says:

    WOW. Worked! And I still have 10.6.8!
    Thank youuuuuuuuuu, you are precious.

Leave a Reply