Is it possible to generate with Java 8 and Install4j 5.1.5 a warning free installation file

心不动则不痛 提交于 2019-12-10 23:56:47

问题


We are using Install4j 5.1.5, install4j-maven-plugin 1.0.5 and Java 8 EA Build 124.

During installation file generation we got couple of warnings from install4j (more than 100 pages)

 [warning] major version should be between 45 and 51 for JDK <= 1.7 

As a result we have a installation file, but is it possible to got a warning free installation file? Exist a hidden switch to disable JDK version check?

Konfiguration:

Application is part of a second maven module and compile with JDK 8. We are using language feature of Java 8.

Install4j maven module use actual java8 runtime and following compiler settings

 <maven.compiler.source>1.7</maven.compiler.source>
 <maven.compiler.target>1.7</maven.compiler.target>

If we change compiler target to 1.8 we got a compiler error in a custom view component inside from install4j

 java.lang.UnsupportedClassVersionError: ... Unsupported major.minor version 52.0
 ....
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement
 ....
         at java.beans.XMLDecoder.readObject(Unknown Source)    
 [INFO]  at com.install4j.config.a.e.z(ejt:237)
 [INFO]  at com.install4j.b.c.a.a(ejt:870)
 [INFO]  at com.install4j.b.c.a.a(ejt:849)
 [INFO]  at com.install4j.b.c.a.a(ejt:820)     

It seems to me we got here a problem inside xerces code generation


回答1:


It is because install4j doesn't support java 8 but it does works anyway.




回答2:


Its because the code you are using was compiled against versions lower than Java 8.

J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

Try adding the source level to your maven build.pom.xml file. Something like this but check the docs. maven-compiler-plugin

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>1.7</source>
      <target>1.7</target>
    </configuration>
  </plugin>



回答3:


I contacted the install4j folks about this and according to them:

This is a warning from the jar shrinking library for the runtime. It should disappear when you switch off "Shrink runtime library ..." in the media file options.



来源:https://stackoverflow.com/questions/21695950/is-it-possible-to-generate-with-java-8-and-install4j-5-1-5-a-warning-free-instal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!