我有问题,我根本无法使用OpenJDK运行任何jar,就像普通的OracleJDK一样,没问题.
OpenJDK # java -version
openjdk version "1.8.0_101"
OpenJDK Runtime Environment (IcedTea 3.1.0) (suse-14.3-x86_64)
OpenJDK 64-Bit Server VM (build 25.101-b13, mixed mode)
当我用这个JDK运行一个jar时,它永远找不到主类,即使它在清单中也很难.
OracleJDK # java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
当我用这个JDK启动一个jar时没问题.
我是否需要在OpenJDK中配置一些东西,以便它可以从清单中找到主类或者OpenJDK无法做到这一点?
编辑:
源文件结构:
-- ui
---- Main.java
Gradle构建脚本:
group 'some.group'
version '0.1'
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "ui.Main"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.zeromq', name: 'jeromq', version: '0.3.5'
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.12'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
jar {
manifest {
attributes 'Implementation-Title': 'PlaceholderTitle',
'Implementation-Version': version,
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': mainClassName
}
}
使用installDist构建
表现:
Manifest-Version: 1.0
Implementation-Title: PlaceholderTitle
Implementation-Version: 0.1
Class-Path: jeromq-0.3.5.jar controlsfx-8.40.12.jar
Main-Class: ui.Main
//new line here