thebaselab / codeapp

Building a full-fledged code editor for iPad
https://code.thebaselab.com
MIT License
2.95k stars 202 forks source link

Support for local OpenJDK #101

Closed bummoblizard closed 9 months ago

oelhatab commented 3 years ago

how is the progress on local java?

bummoblizard commented 3 years ago

Hello. I have been attempting to build both JDK 9 and JDK 16 for iOS, but so far without success. However, it's something that I will continue to work on.

how is the progress on local java?

Ryorama commented 3 years ago

Thought I’d write up a way to add this since I’m still having troubles running this on my device to test. My way of doing this would be to find a certain input command such as java or javac then use something like this https://gist.github.com/andreacipriani/8c3af3719da31c8fae2cdfa8c21e17ba to execute the following executable file in the Java install path. The Java runtime built for iOS can be found here: https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/actions/runs/1069602351

bummoblizard commented 3 years ago

Thought I’d write up a way to add this since I’m still having troubles running this on my device to test. My way of doing this would be to find a certain input command such as java or javac then use something like this https://gist.github.com/andreacipriani/8c3af3719da31c8fae2cdfa8c21e17ba to execute the following executable file in the Java install path. The Java runtime built for iOS can be found here: https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/actions/runs/1069602351

Thanks for the links! But the gist you linked would actually not work on iOS since Process is unavailable in iOS, or at least non-jailbroken devices. It's therefore not possible to spawn another process and run an executable within the app. The way Code App handles the current commands is to compile such commands as shared libraries and call them dynamically during the runtime. You can read more about this on https://github.com/holzschu/ios_system.

That being said, I think the build scripts in android-openjdk-build-multiarch would be helpful for me to build JDK properly for Code App. Thanks again for the time and research!

Ryorama commented 3 years ago

Ok 👍. One more update though, if the method dlopen works on iOS without jailbreaking (after some research it looks like you can)you should still be able to start the Java executable. I’m not entirely sure on this, but I’ve looked at this script which launches Java and that’s what it seems like: https://github.com/PojavLauncherTeam/PojavLauncher_iOS/blob/main/Natives/JavaLauncher.m

bummoblizard commented 3 years ago

Ok 👍. One more update though, if the method dlopen works on iOS without jailbreaking (after some research it looks like you can)you should still be able to start the Java executable. I’m not entirely sure on this, but I’ve looked at this script which launches Java and that’s what it seems like: https://github.com/PojavLauncherTeam/PojavLauncher_iOS/blob/main/Natives/JavaLauncher.m

It looks promising! I will give it a try and let you know the result.

luni-moon commented 3 years ago

Ok 👍. One more update though, if the method dlopen works on iOS without jailbreaking (after some research it looks like you can)you should still be able to start the Java executable. I’m not entirely sure on this, but I’ve looked at this script which launches Java and that’s what it seems like: https://github.com/PojavLauncherTeam/PojavLauncher_iOS/blob/main/Natives/JavaLauncher.m

It looks promising! I will give it a try and let you know the result.

Is there any progress on this?

bummoblizard commented 9 months ago

Good news: I have OpenJDK8 working in Code App. Important features including java and javac should work. Will push the changes to TestFlight once I cleaned up the code.

Here's is a demo: https://github.com/thebaselab/codeapp/assets/38398443/2cf5ddb0-a5d4-40e8-bb68-51dbb2e3971f

bummoblizard commented 9 months ago

Added in https://github.com/thebaselab/codeapp/commit/39155744844ad472f0b79c714230a8691a7832bb.