经过数小时的尝试,我终于找到了问题所在.
Ubuntu(和Raspbian)默认使用OpenJDK.我的应用程序的开发是在Oracle Java 8上完成的.
在Ubuntu上安装Oracle JDK之后,它首先就可以使用.
我不知道这是否是预期的行为.我有两个问题:
>执行Java文件时,OpenJDK是否应具有相同的参数?
>如果不是:Gradle不应该支持OpenJDK吗?
为了完善我的解决方案,我想发布一些信息,说明如何在Ubuntu(15.10)上轻松安装Oracle JDK 8:
我使用了webupd8存储库,该存储库提供了一种在Ubuntu上自动安装Java 8的方法(Ubuntu / Canonical也建议这样做).
Our PPA supports Ubuntu 15.04, 14.10, 14.04 and 12.04 as well as Linux
Mint 17.1, 17 and 13. Add the PPA and install Oracle Java 8 (the
package provides both JDK8 and JRE8) using the following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update sudo
apt-get install oracle-java8-installer
Tip: if you’re behind a firewall / router that blocks some of the
redirects required to download the Oracle Java archive, you can
download the JDK tar.gz archive manually and place it under
/var/cache/oracle-jdk8-installer – then, installing the
“oracle-java8-installer” package will use the local archive instead of
trying it to download it itself.
Once installed, running “java -version” in a terminal should output
something like this:
andrei@andrei-desktop:~$java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)