Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't resolve jdk.internal package

Tags:

java

netbeans

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
like image 906
Teletha Avatar asked Dec 08 '22 07:12

Teletha


1 Answers

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.

like image 171
Teletha Avatar answered Dec 13 '22 22:12

Teletha