<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Even More Oracle Java Compatibility (Minecraft!) &#8211; mikeymikey blogs here</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Make Minecraft (and more) run as-is on OS X without Apple Java">
    <meta name="author" content="Michael Lynn">
    <meta name="keywords" content="">
    <link rel="canonical" href="http://michaellynn.github.io/2015/08/10/even-more-oracle-java-compatibility/">
    <link rel="alternate" type="application/rss+xml" title="RSS Feed for mikeymikey blogs here" href="/feed.xml" />

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/pixyll.css?202005251226" type="text/css">

    <!-- Fonts -->
    <link href='//fonts.googleapis.com/css?family=Merriweather:900,900italic,300,300italic' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Lato:900,300' rel='stylesheet' type='text/css'>
    


    <!-- Open Graph -->
    <!-- From: https://github.com/mmistakes/hpstr-jekyll-theme/blob/master/_includes/head.html -->
    <meta property="og:locale" content="en_US">
    <meta property="og:type" content="article">
    <meta property="og:title" content="Even More Oracle Java Compatibility (Minecraft!)">
    <meta property="og:description" content="the vent for my mind">
    <meta property="og:url" content="http://michaellynn.github.io/2015/08/10/even-more-oracle-java-compatibility/">
    <meta property="og:site_name" content="mikeymikey blogs here">

    <!-- Twitter Card -->
    <meta name="twitter:card" content="summary" />
    
    <meta name="twitter:title" content="Even More Oracle Java Compatibility (Minecraft!)" />
    <meta name="twitter:description" content="Make Minecraft (and more) run as-is on OS X without Apple Java" />
    <meta name="twitter:url" content="http://michaellynn.github.io/2015/08/10/even-more-oracle-java-compatibility/" />

    <!-- Icons -->
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
    <link rel="icon" type="image/png" href="/favicon-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="/favicon-160x160.png" sizes="160x160">
    <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
    <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
        
    
</head>

<body class="site">
  <div class="site-wrap">
    <header class="site-header px2 px-responsive">
  <div class="mt2 wrap">
    <div class="measure">
      <a href="http://michaellynn.github.io" class="site-title">mikeymikey blogs here</a>
      <nav class="site-nav">
        <a href="/about/">About</a>
      </nav>
      <div class="clearfix"></div>
      
    </div>
  </div>
</header>


    <div class="post p2 p-responsive wrap" role="main">
      <div class="measure">
        


<div class="post-header mb2">
  <span class="post-meta">Aug 10, 2015</span>
    
  <h1>Even More Oracle Java Compatibility (Minecraft!)</h1>
  
  <small><span class="post-meta">tags:
  
  <a href="/tag/python">python</a>
  
  <a href="/tag/osx">osx</a>
  </span></small><p/><p/>
</div>

<article class="post-content">
  <p><a href="https://twitter.com/rtrouton">Rich Trouton</a> kindly wrote <a href="https://derflounder.wordpress.com/2015/08/08/modifying-oracles-java-sdk-to-run-java-applications-on-os-x/">a wonderful blog post</a> covering <a href="https://gist.github.com/pudquick/349f063c242239952a2e/64c295fc4576d7df9b8632e6ddecbe6165fd7663">a python script of mine</a> (<em>note: this is the old version, don’t use it!</em>) which modifies installations of Oracle’s Java JDK to extend its capabilities to allow it to run JavaApplicationStub .app bundles as was <a href="https://forums.developer.apple.com/message/6741">discussed</a> on Apple’s Developer forums (go ahead and read it, Apple has made the forum open to the public for now).</p>

<p>One thing that annoyed me a bit about the fix though was that it didn’t seem to work with <em>everything</em> (read: <a href="http://minecraft.net/">Minecraft</a>), just a large number of Java .apps.</p>

<p>After it was posted, a Twitter friend of mine <a href="https://twitter.com/morningwoodspor/status/630886277538258945">asked for a little more help</a> with one of these more problematic apps.</p>

<p>I was able to confirm that the app in question could run if I provided the right arguments to <code class="highlighter-rouge">/usr/bin/java</code>, so why couldn’t JavaApplicationStub launching work?</p>

<p>A little more research (aka Google) turned up <a href="http://apple.stackexchange.com/a/136976">this marvelous additional tidbit</a>.</p>

<p>Basically the problematic Java .apps in question had their .jar files coded to look for <code class="highlighter-rouge">libserver.dylib</code>, which isn’t part of the current JDK distribution.</p>

<p>This fix involves creating the original directory structure it expects it at and symlinking <code class="highlighter-rouge">libjvm.dylib</code> to the old location.</p>

<p>It worked, it fixed the launching! (<strong><em>and Minecraft works as-is for me now, no more modifying the .app bundle!!</em></strong>)</p>

<p>I’ve since <a href="https://gist.github.com/pudquick/349f063c242239952a2e">updated the original code</a>, so that both Rich’s blog post and this one here provide an all-in-one solution.</p>

<p>As always, hope this helps you 😄</p>

<noscript><pre>#!/usr/bin/python
import plistlib, os.path, os

# Based off of https://forums.developer.apple.com/message/6741
#          and http://apple.stackexchange.com/a/136976

def jdk_info_plists():
    # Find all the JDK Info.plist files
    JDK_ROOT = &quot;/Library/Java/JavaVirtualMachines&quot;
    if (os.path.exists(JDK_ROOT) and os.path.isdir(JDK_ROOT)):
        # It&#39;s present, let&#39;s look for installs
        for file in os.listdir(JDK_ROOT):
            jdk_dir = os.path.join(JDK_ROOT, file)
            if (os.path.isdir(jdk_dir)):
                # Check for Info.plist
                info_plist = os.path.join(jdk_dir, &quot;Contents&quot;, &quot;Info.plist&quot;)
                if (os.path.isfile(info_plist)):
                    yield info_plist

for info_plist in jdk_info_plists():
    # Change all the plists of all the installed JDKs
    info = plistlib.readPlist(info_plist)
    # Convert the capabilities into a set
    capabilities = set(info[&#39;JavaVM&#39;][&#39;JVMCapabilities&#39;])
    capabilities.add(&#39;JNI&#39;)
    capabilities.add(&#39;BundledApp&#39;)
    # Update our changes
    info[&#39;JavaVM&#39;][&#39;JVMCapabilities&#39;] = sorted(capabilities)
    # Write back our changes
    plistlib.writePlist(info, info_plist)
    # Create a symlink to fix legacy applications
    # Find the Contents directory
    contents_path = os.path.dirname(info_plist)
    # make the bundle/Libraries subpath
    bundle_libraries = os.path.join(contents_path, &quot;Home&quot;, &quot;bundle&quot;, &quot;Libraries&quot;)
    try:
        # Just in case you run this script multiple times, we&#39;ll fail if the directory already exists
        os.makedirs(os.path.join(bundle_libraries))
    except:
        pass
    # create the symlink between libjvm.dylib and libserver.dylib
    libjvm_dylib = os.path.join(contents_path, &quot;Home&quot;, &quot;jre&quot;, &quot;lib&quot;, &quot;server&quot;, &quot;libjvm.dylib&quot;)
    libserver_dylib = os.path.join(bundle_libraries, &quot;libserver.dylib&quot;)
    try:
        # Just in case you run this script multiple times, we&#39;ll fail if the file already exists
        os.symlink(libjvm_dylib, libserver_dylib)
    except:
        pass
</pre></noscript>
<script src="https://gist.github.com/pudquick/349f063c242239952a2e.js"> </script>

<p><em>- mike</em></p>

</article>







      </div>
    </div>
  </div>

  <footer class="center">
  <div class="measure">
    <small>
      Michael Lynn hangs out at <a href="https://twitter.com/mikeymikey">@mikeymikey</a><br />
      All content copyrighted where possible.<br />
All rights reserved.
    </small>
  </div>
</footer>

</body>
</html>
