Declare maven dependency on tools.jar to work on JDK 9 -
i have project uses this technique work fine in jdk 8 , older. however, in jdk 9 jar removed , no longer work:
'dependencies.dependency.systempath' com.sun:tools:jar refers non-existing file /usr/lib/jvm/java-9-jdk/../lib/tools.jar. please verify run maven using jdk , not jre.
(the path looks strange, though there no tools.jar in jdk 9)
what best practice work across jdk versions , perhaps jdk vendors? have not found workaround jdk 9 on openjdk (while keeping project buildable on jdk 8).
your problems caused project jigsaw changes went java 9 ea build seem have used. jep 220 describes them.
the section removed: rt.jar
, tools.jar
describes in more detail risks , assumptions contains summary:
jdk , jre images will, noted above, no longer contain files
lib/rt.jar
,lib/tools.jar
,lib/dt.jar
, , other internal jar files. existing code assumes existence of these files might not work correctly.
so observed, files gone. further down:
class , resource files found in
lib/tools.jar
, visible when file added class path now, in jdk image, visible via system class loader or, in cases, bootstrap class loader. modules containing these files not, however, mentioned in application class path, i.e., in value of system propertyjava.class.path
.
so classes tools.jar
moved modules seems might not available user. should use jdeps recent jigsaw build...
- ... determine module dependencies:
$jdeps -m -s $your_jar
- ... determine dependencies on jdk-internal apis:
jdeps -jdkinternals $your_jar
if you're lucky, api using published (then not show in second analysis) or have public alternative (which second analysis list ). otherwise should consider taking jigsaw mailing list , ask there, noting explicitly apis using , for.
Comments
Post a Comment