如何在 Android 中运行 Java 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19286451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 15:43:01  来源:igfitidea点击:

How to run Java app in Android

javaandroid

提问by Agoeng Liu

Is it possible to run java app (jar) in my android application? Because I need to create PDF, the problem is if I generate PDF in android, only can show with small image, if it contains large image in many pages, it will be error. So I think, I can generate PDF in java and then included to android app.

是否可以在我的 android 应用程序中运行 java 应用程序(jar)?因为我需要创建PDF,问题是如果我在android中生成PDF,只能用小图显示,如果它在很多页面中包含大图,就会出错。所以我想,我可以用 java 生成 PDF,然后包含到 android 应用程序中。

回答by Anish Antony

You can use JBED. JBED is an .apk Android application which run java games and app on your android Device. JBED is a java android emulator, by using this application we can install .JAR/.JAD/Java/J2ME/MIDP app on android phones.

您可以使用JBED。JBED 是一个 .apk Android 应用程序,可在您的 android 设备上运行 java 游戏和应用程序。JBED 是一个 java android 模拟器,通过使用这个应用程序,我们可以在 android 手机上安装 .JAR/.JAD/Java/J2ME/MIDP 应用程序。

回答by Mike Tang

You can import java Third-party libraries into Android app, follow the steps here.

您可以将 java 第三方库导入到 Android 应用程序中,请按照此处的步骤操作。

I am not sure whether it will work,but just try.

我不确定它是否会起作用,但请尝试一下。

回答by Andreas J

Concernig the mentiones app JBED: Well honestly, I could not find any credible source for this tools JBED, so I would really be very cautious (e.g. who is the developer?)

关注提及的应用程序 JBED:老实说,我找不到这个工具 JBED 的任何可靠来源,所以我真的会非常谨慎(例如,谁是开发人员?)

In the manifestfile (in Androidmanifest.xml, where every app has to state what rights it needs to run, see How to view AndroidManifest.xml from APK file?) there are many rights mentioned (what could be necessary, as the app wants to run as an emulator), so a java application might want to send an SMS, record audio, take pictures and place calls -- so the emulator would need those rights as well.

在清单文件中(在 Androidmanifest.xml 中,每个应用程序都必须说明它需要哪些权限才能运行,请参阅如何从 APK 文件查看 AndroidManifest.xml?)中提到了许多权限(可能需要哪些权限,因为应用程序想要作为模拟器运行),因此 Java 应用程序可能想要发送 SMS、录制音频、拍照和拨打电话——因此模拟器也需要这些权限。

But then the app also registers the "android.intent.action.BOOT_COMPLETED" event (i.e. autostart after boot) and this would go against every description of the tool.

但随后该应用程序还会注册“android.intent.action.BOOT_COMPLETED”事件(即启动后自动启动),这将与该工具的每个描述背道而驰。

Ah yeah and giveaway: The apk has a folder "certs" that has some (root-)certificates. But those are not the real certificates of the authorities, e.g. Versign. If one installs the app and by that those certificates the trust you might have in https-connections is lost because those who made the fake certificates can create own, false certificates that your phone would trust.

啊,是的,赠品:apk 有一个文件夹“certs”,其中包含一些(根)证书。但那些不是权威机构的真实证书,例如 Versign。如果安装了该应用程序,并且通过这些证书,您可能对 https 连接的信任就会丢失,因为制作假证书的人可以创建自己的手机会信任的虚假证书。

I assume (or am pretty sure) this is a spy tool, but I could be wrong. The (rare) testimonials that claim the tool ran perfectly will probably be the same person that posted the tool under a different name.

我假设(或者很确定)这是一个间谍工具,但我可能是错的。声称该工具运行良好的(罕见)推荐信可能是以不同名称发布该工具的同一个人。

Andreas

安德烈亚斯

回答by Himanshu

You can do it quite easily as there are many ways to run java apps on android. Specific application called Java Emulators can do it quite easily.

你可以很容易地做到这一点,因为有很多方法可以在 android 上运行 java 应用程序。称为 Java Emulators 的特定应用程序可以很容易地做到这一点。

These are four most popular java emulators for android viz, JBED, PhoneME, Jblend and NetMite. These are arranged in order of their preference. You can use phoneme for non rooted device, however if your device is rooted try any of the remaining three applications.

这些是适用于 android viz、JBED、PhoneME、Jblend 和 NetMite 的四种最流行的 Java 模拟器。这些是按照他们的喜好顺序排列的。您可以将音素用于非 root 设备,但是如果您的设备已 root,请尝试其余三个应用程序中的任何一个。