Hacker News new | ask | show | jobs
by coolius 775 days ago
I got OpenJDK 17 to compile for iOS, but I had to disable JIT compilation as iOS doesn't allow running unsigned Code. Running the JVM itself is possible as long as the binaries are signed, and located at the correct paths. The paths issue really made me jump through hoops because Apple doesn't sign binaries unless they are bundled in Frameworks at the root of the bundle. That forced me to create symlinks to replicate the directory structure expected by the JVM while satisfying Apple's stupid policy.

Of course this whole thing only occured when I tried to submit to the App Store and the whole app was finished. I wasn't going to give up at that point.

5 comments

I don't use Java much these days, but for some reason I find this project inspiring. If only because of the level of commitment to get it working.

I just wanted to say great job!

OpenJDK isn’t mentioned once in the apps description, and it is GPL which means this entire application may have to be GPL (IANAL)
OpenJDK has the classpath exception in its version of the GPL, which allows non-GPL code to link to it without triggering GPL requirements.
This is a common misconception. The Classpath exception only applies to the class library, not to Hotspot (the core of the JVM implementation). The class library is also more tightly integrated with Hotspot than it used to be.

And of course the Classpath exception does not waive the notification and other requirements for the OpenJDK libraries that are distributed under the Classpath exception.

Where did you get a non-GPL version of OpenJDK?
Alternatively, where can I get the source for the app?
Fair question if you've bought the app.
You can download it for free and you can then compile stuff with it, so you don't need to buy anything for this
The appstore ToS explicitly forbids submitting apps containing code under the GPL or similar licenses, which was one of the main reasons I asked.
Impressive. Can you please work together with Oracle and make this available to everyone :) ?

And did you also try to use GraalVM?

Is there any technical reason why one couldn’t run e.g clang or go compilers in this way? I assume you’re running javac on-device?
No technical reason, but you won't be able to run a compiled binary due to policy. You need to use an interpreter.
I wonder if qemu with cpu=host counts...
Maybe run a VM inside Safari via QEMU and WASM that boots a Linux desktop environment
WASM is indeed one possible workaround. That's how a-Shell [1] manages to include a C compiler and run resulting programs at (I believe) better-than-interpreted speeds.

[1] https://holzschu.github.io/a-Shell_iOS/