簡體   English   中英

是否可以在 Android 設備上安裝 JDK?

[英]Is it possible to install the JDK on an android device?

我希望能夠在 android 終端 termux 中編譯和運行基本的 java 應用程序。 我檢查了 Terminal IDE,但它與 Android 5.0+ 不兼容。 此外,我嘗試從 Oracle 的網站安裝 arm64 jdk,android 無法識別它。 我正在運行 CM 13,澄清一下,我希望能夠直接從我的手機運行 javac 和 java 等命令。

如果你有Termux ,你可以在這里下載 deb 文件,並使用apt-get install /path/to/deb安裝它。 為 arm 下載和安裝 JRE 和 JDK 的命令:

cd ~ # Change to home directory
apt-get install -y wget # BusyBox wget doesn't support HTTPS
hash -d wget # Forgets the BusyBox wget path so new one is used
wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jre-headless_9.2017.8.20-1_arm.deb # Download JRE
wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb # Download JDK
apt-get install -y ./openjdk-9-jre-headless_9.2017.8.20-1_arm.deb ./openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb # Install the files
rm openjdk-9-*.deb # Remove the files after because they're huge

或單行復制和粘貼:

cd ~ && apt-get install -y wget && hash -d wget && wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jre-headless_9.2017.8.20-1_arm.deb && wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb && apt-get install -y ./openjdk-9-jre-headless_9.2017.8.20-1_arm.deb ./openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb && rm openjdk-9-*.deb

要為其他架構安裝,請用正確的架構替換出現的“arm”。 有“arm”(大多數 32 位手機)、“aarch64”(ARM64/armv8、大多數 64 位手機)、“i686”(x86)和“x86_64”的文件。 大多數手機都有 arm 或 aarch64。 我相信 arm 版本至少應該適用於 aarch64(可能是錯誤的?),所以 arm 應該適用於幾乎所有人。 但是,如果您知道您的設備有什么,請改用它。

編輯:要查找設備的架構,請從 Termux 運行uname -m

@moderatelygood 前往 Google Play 商店並下載 GNURoot Debian。 它是一個fakeroot,即終端模擬器。 Play Sore 中提供了許多其他終端仿真器,但這個ine 非常好。 它位於https://github.com/corbinlc/GNURootDebian和網站是http://corbinlc.github.io/GNURootDebian您可以下載許多這樣的軟件包:

apt-get 更新

apt-get install default-jdk

apt-get 安裝 python

等等。

您將能夠編譯/運行這些語言的程序。 使用一些文本編輯器編寫程序,例如 Jota 文本編輯器,也可在 Play 商店中使用。

實際上,如果您只對javacjavajar感興趣,可以使用 Terminal 。 也就是說,你可以在 Lollipop 上使用這三個。 我在 Android 5.1.1 上使用終端 IDE,它按預期工作。 可用版本可以在https://www.dropbox.com/s/h2d23ecbrt2akeu/terminalide-2.02-binary-mod-signed.apk?dl=0找到。 如果您想嘗試一下,請打開此 mod 終端並執行以下操作: cp /system/lib/libjavacrypto.so ~/system/lib ,復制此庫應該可以完成工作(為我做的)讓javadx命令工作。

該死的 Termux 的好解決方案: https : //github.com/MasterDevX/Termux-Java一個安裝命令,你可以用 Java 做任何你想做的事

Java 可以安裝在 termux 上。 在 termux 上安裝 java 需要很短的時間並直接從 termux-source 安裝,這個程序真的對我有用,我敢肯定它也對你有用......

 git clone https://github.com/EagleComrade/Termux-java.git

 cd Termux-java
 
 chmod +x install.sh

 bash install.sh

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM