调用Java的JVM实例更换功能在Android应用程序中是否有任何影响?

发布于 2025-02-10 04:22:39 字数 516 浏览 2 评论 0 原文

例如,在它说Locale.setDefault()

设置Java虚拟机的这一实例的默认场所。 这不会影响主机地区。

由于Android OS(又名主机)不使用JVM,而是使用ART将Android应用程序编译到Dalvik字节码中,因此可以肯定地假设每个Android过程都是ART(或DVM?)实例,而不是JVM实例。这意味着执行Locale.SetDefault()在Android应用程序中不应产生效果,或者至少我假设。

我是否错过了与JVM有关的Android如何工作(或缺乏)?呼叫Java SDK方法会影响JVM实例,例如LoCale.SetDefault(Locale)对艺术实例也有任何影响吗?

For example, in Java's Locale class documentation it says that Locale.setDefault()

Sets the default locale for this instance of the Java Virtual Machine.
This does not affect the host locale.

Since Android OS (aka the host) doesn't use JVM, and instead uses ART to compile Android apps into Dalvik bytecode, it's safe to assume that each Android process is an ART (or DVM?) instance and NOT a JVM instance. Meaning that executing Locale.setDefault() shouldn't have an effect inside an Android app, or at least I assumed.

Am I missing something with how Android works in relation to JVM (or lack thereof)? Does calling Java SDK methods that affect JVM instances such as Locale.setDefault(locale) have any affect on ART instances as well?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烏雲後面有陽光 2025-02-17 04:22:39

这意味着执行locale.setDefault()在Android应用程序中不应有任何效果吗?

否。

当您阅读 Java的Android Javadocs时。 。

That would mean that executing Locale.setDefault() should have no effect whatsoever inside an Android app wouldn't it?

No.

When you are reading Android JavaDocs for java.* and javax* classes, references to the JVM should be interpreted as including Android VMs (whether based on Dalvik or ART).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文