Unable to create java 9 jars -
if run command jar --create --release 9 -c com.java.mrjar.nine\build\classes .
have error
entry: meta-inf/versions/9/com/java/mrjar/nine/main.class, contains new public class not found in base entries entry: meta-inf/versions/9/com/java/mrjar/nine/timeut.class, contains new public class not found in base entries invalid multi-release jar file mrjars\com.java.mrjar.jar deleted
these main , timeut classes:
package com.java.mrjar.nine; import java.time.instant; public class main { public static void main(string[] args) { system.out.println("inside jdk9 main.main()..."); timeut t = new timeut(); system.out.println("local date: "+t.getlocaldate(instant.now())); } }
package com.java.mrjar.nine; import java.time.instant; import java.time.localdate; import java.time.zoneid; public class timeut { public timeut() { system.out.println("creating jdk9 version of timeut"); } public localdate getlocaldate(instant now){ return localdate.ofinstant(now, zoneid.systemdefault()); } }
i can create jar without addidng --release 9 it's normal jar, doesn't have versions>9 data.
the jar
command in question attempting create mr jar without classes in base section, instead attempting put classes (including public/api classes) in versioned section. if trying create jar file drop --release
option. if trying create mr jar should put public/api classes in base section, put 9 specific classes in versioned section. jep 238 has details on help, jar --help
output has examples too.
Comments
Post a Comment