java_home versus user_home

Johan Vos johan.vos at gluonhq.com
Tue Jul 22 09:18:21 UTC 2025


Hi,

I believe I made a mistake in ce70629f4394184ba517fb99c92ac9374ec8f37a [1]
where I make java_home pointing to a user-controlled directory (user_home).
The reason for this was to allow application developers to store the
required modules and classes wherever they want. That requires them to copy
the files somehow from the "app" and store them in the user_home

However, I believe it is better to keep the modules/classfiles (or, later,
aot'ed methods) within the app itself, so that there is a more standard
location for it. Those resources need to be known at buildtime, and there
is no need to copy them at runtime to a different location. This suggestion
would revert the follow patch in os_bsd.cpp, in
os::init_system_properties_values()

#ifndef __IOS__
...
+#else
+    size_t nlen = strlen(user_home_dir) + 11;
+    char *iosuser_home = NEW_C_HEAP_ARRAY(char, nlen, mtInternal);
+    snprintf(iosuser_home, nlen, "%s/Documents", user_home_dir);
+    Arguments::set_java_home(iosuser_home);
+#endif

Unless someone disagrees, I'll file an issue and a PR for reverting this
small change. Apart from my thinking that this is the right thing to do,
another benefit is that it will bring the OpenJDK/mobile even more in sync
with upstream.

[1]
https://github.com/openjdk/mobile/commit/ce70629f4394184ba517fb99c92ac9374ec8f37a#diff-1f93205c2e57bee432f8fb7a0725ba1dfdbe5b901ac63010ea0b43922e34ac12

- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/mobile-dev/attachments/20250722/5144e4e9/attachment.htm>


More information about the mobile-dev mailing list