5

NetBeans seems to be not able to resolve jdk.internal.* classes, but other internal API (i.e. com.sun.*) has no problem resolving.

Compile : "jdk.internal.org.objectweb.asm.ClassReader does not exist" <br>
(This package exists in rt.jar)

Is this NetBeans bug?

NetBeans: 8.0 (Build 201403101706)<br>
Java: 1.8.0_20-ea; Java HotSpot(TM) 64-Bit Server VM 25.20-b20<br>
System: Windows 7 version 6.1 running on amd64
Vishrant
  • 15,456
  • 11
  • 71
  • 120
Teletha
  • 419
  • 1
  • 3
  • 7
  • possible duplicate of [NetBeans Cant find rt.jar when building](http://stackoverflow.com/questions/13016037/netbeans-cant-find-rt-jar-when-building) – Nir Alfasi Jul 13 '14 at 08:01

1 Answers1

14

This is javac's restriction. By default, javac does not read classes from rt.jar. It reads from a symbol file, which only contains standard API and some internal API (e.g. com.sun., com.oracle. and sun.*).

To disable this mechanism, I can use javac -XDignore.symbol.file=true option.

For Maven, edit POM file like the following.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <compilerArgument>-XDignore.symbol.file</compilerArgument>
  </configuration>
</plugin>

Now, I can build project without error, but Error notification remains on NetBeans editor UI. To remove these error, I append -J-DCachingArchiveProvider.disableCtSym option in NETBEANS_HOME/etc/netbeans.conf file.

netbeans_default_options="... -J-DCachingArchiveProvider.disableCtSym=true"

Finally, I removed all error from NetBeans environment.

Teletha
  • 419
  • 1
  • 3
  • 7
  • 1
    Per @karmakaze answer to https://stackoverflow.com/questions/4065401/using-internal-sun-classes-with-javac true must be included in element. That was the case for me too, my Maven is 3.3 – igor.zh Oct 29 '19 at 21:10