News for hackers. Stuff that matters.
Re:Show HN: I Built a Java IDE for iPad by aduffy on Tuesday April 30, 2024 @11:35AM (#40212214)
I’m very curious, are you running the JDK inside the app? What difficulties did you run into trying to embed an external runtime?
Re:Show HN: I Built a Java IDE for iPad by robrtsql on Tuesday April 30, 2024 @03:01PM (#40214853)
The app is monetized by limiting the number of “runs” you can do per month. Based on iOS limitations I think we can assume this means the compilation is done on a remote server.

EDIT: nevermind! I tried running a program with airplane mode on and it still worked. Now I’m really interested to hear how this was accomplished.

Re:Show HN: I Built a Java IDE for iPad by lewurm on Tuesday April 30, 2024 @03:28PM (#40215209)
Probably a OpenJDK Zero VM build. That's a configuration without JIT or template interpreter, but a "plain" C++ switch dispatch interpreter that requires no runtime code generation.
Re:Show HN: I Built a Java IDE for iPad by mdaniel on Tuesday April 30, 2024 @04:14PM (#40215757)
I felt out of the loop, thinking that Zero VM was some kind of new distro for OpenJDK but chasing <https://packages.debian.org/sid/openjdk-22-jre-zero#:~:text=...> to <https://sources.debian.org/src/openjdk-22/22.0.1%2B8-1/debia...> lead me to https://github.com/openjdk/jdk/tree/jdk-22-ga/src/hotspot/cp...

It seems that it's a specific CPU target for the Hotspot JIT for non-mainstream architectures (or for research purposes, as I saw mentioned once)

Re:Show HN: I Built a Java IDE for iPad by saagarjha on Wednesday May 01, 2024 @04:19AM (#40220807)
No, it's just a tier where it doesn't JIT. You can build it for your computer, too.
Re:Show HN: I Built a Java IDE for iPad by Rohansi on Tuesday April 30, 2024 @04:00PM (#40215606)
I don't have a compatible device but I'm curious how the pricing works. Does it work like a subscription where you pay monthly for unlimited runs per month? Or do you just need to pay for enough runs and buy more if you run out?
Re:Show HN: I Built a Java IDE for iPad by lnxg33k1 on Tuesday April 30, 2024 @03:22PM (#40215126)
Didn't Apple recently allow to run "emulators"? So code that generates code on the app store?
Re:Show HN: I Built a Java IDE for iPad by glhaynes on Tuesday April 30, 2024 @04:37PM (#40216018)
More like code that runs code, not code that generates code. Assuming the latter means that it's generating native code and attempting to execute it natively, that's not allowed.
Re:Show HN: I Built a Java IDE for iPad by kmeisthax on Tuesday April 30, 2024 @11:51PM (#40219324)
Code that generates code - specifically user-specified code - has been allowed on the App Store for years now. They have a very patronizing term for it, too: "learn-to-code apps".

Granted, Apple's never going to give you the entitlements necessary to make this performant or let you create separate temporary containers for compiled apps like Swift Playgrounds can. But you can absolutely ship a dev environment on iPadOS as long as you're willing to deal with those limitations.

Re:Show HN: I Built a Java IDE for iPad by trollied on Tuesday April 30, 2024 @05:11PM (#40216410)
Emulators don't have to generate code. At the simplest level, a CPU emulator is a switch statement.
Re:Show HN: I Built a Java IDE for iPad by mrbungie on Tuesday April 30, 2024 @05:46PM (#40216768)
Emulators don't necessarily generate code (maybe if they use JIT). They run arbitrary code, but that's other thing.
Re:Show HN: I Built a Java IDE for iPad by coolius on Tuesday April 30, 2024 @03:25PM (#40215161)
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.

Re:Show HN: I Built a Java IDE for iPad by cyberpunk on Tuesday April 30, 2024 @03:29PM (#40215213)
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?
Re:Show HN: I Built a Java IDE for iPad by throwaway11460 on Tuesday April 30, 2024 @04:04PM (#40215646)
No technical reason, but you won't be able to run a compiled binary due to policy. You need to use an interpreter.
Re:Show HN: I Built a Java IDE for iPad by cyberpunk on Tuesday April 30, 2024 @04:33PM (#40215963)
I wonder if qemu with cpu=host counts...
Re:Show HN: I Built a Java IDE for iPad by greenavocado on Tuesday April 30, 2024 @06:23PM (#40217155)
Maybe run a VM inside Safari via QEMU and WASM that boots a Linux desktop environment
Re:Show HN: I Built a Java IDE for iPad by lxgr on Wednesday May 01, 2024 @12:22AM (#40219475)
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/

Re:Show HN: I Built a Java IDE for iPad by indigoabstract on Tuesday April 30, 2024 @06:06PM (#40217012)
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!

Re:Show HN: I Built a Java IDE for iPad by jimbobthrowawy on Wednesday May 01, 2024 @12:37AM (#40219551)
Where did you get a non-GPL version of OpenJDK?
Re:Show HN: I Built a Java IDE for iPad by jevinskie on Wednesday May 01, 2024 @01:15AM (#40219744)
Alternatively, where can I get the source for the app?
Re:Show HN: I Built a Java IDE for iPad by Benjamin_Dobell on Wednesday May 01, 2024 @05:06AM (#40221031)
Fair question if you've bought the app.
Re:Show HN: I Built a Java IDE for iPad by echoangle on Wednesday May 01, 2024 @09:15AM (#40222738)
You can download it for free and you can then compile stuff with it, so you don't need to buy anything for this
Re:Show HN: I Built a Java IDE for iPad by jimbobthrowawy on Thursday May 02, 2024 @10:01PM (#40243259)
The appstore ToS explicitly forbids submitting apps containing code under the GPL or similar licenses, which was one of the main reasons I asked.
Re:Show HN: I Built a Java IDE for iPad by hnarn on Wednesday May 01, 2024 @03:49AM (#40220599)
OpenJDK isn’t mentioned once in the apps description, and it is GPL which means this entire application may have to be GPL (IANAL)
Re:Show HN: I Built a Java IDE for iPad by kryptiskt on Wednesday May 01, 2024 @06:38AM (#40221561)
OpenJDK has the classpath exception in its version of the GPL, which allows non-GPL code to link to it without triggering GPL requirements.
Re:Show HN: I Built a Java IDE for iPad by fweimer on Wednesday May 01, 2024 @07:33AM (#40221886)
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.
Re:Show HN: I Built a Java IDE for iPad by karussell on Wednesday May 01, 2024 @09:46AM (#40223154)
Impressive. Can you please work together with Oracle and make this available to everyone :) ?

And did you also try to use GraalVM?