This is the real reason, probably from the maven forum answer
βJerome is right that he is not recommended to use the com.sun classes from rt.jar. And especially those that are designated asβ internal β; you're just asking for a problem.
However, I was interested, so I tried it. The above class can really access Eclipse. However, compiling code using javac with the error "does not exist." So my assumption is that the Sun java compiler detects when a special βinnerβ class accesses it and refuses to import the class. Eclipse uses a different compiler, which apparently does not have this check.
Maven just uses the javac compiler, available at system runtime track. Therefore, the problem has nothing to do with Maven. This is a maven compiler that refuses to compile the source. I do not see any public flags on the javac command line to disable this "lock" of internal access, so if you do not want to use Sun javac, you just need to avoid using this internal class.
Just for fun, I tried Jerome's suggestion to put rt.jar on the Class Path: javac -cp / usr / java / jdk1.6.0_03 / jre / lib / rt.jar Foo.java but it still failed compile.
The ByteOutputStream class can be loaded at run time through Class.forName ("..").
Interestingly, the project I'm working on really makes sense to import the com.sun.org.apache.xml.internal.utils.SAXSourceLocator class; and it works fine. Warnings are issued, but the code compiles (and yes, it's on my TODO list to fix this :-). So these are not all the inner classes that are blocked, only the selected ones. "
deelew
source share