API com.sun.mirror.apt

I am new to Java and I get an error message through Eclipse in the following lines:

import com.sun.mirror.apt.AnnotationProcessorFactory; import com.sun.mirror.apt.AnnotationProcessor; import com.sun.mirror.apt.AnnotationProcessorEnvironment; 

Error: "Import error com.sun.mirror could not be resolved."

How to fix this error?

+4
source share
4 answers

To the point: just put it in the classpath (build path, in Eclipse). You can download here .

However, this use is not recommended. Rather, use the standard API classes and methods in the javax.annotation.processing API , which are already in the standard Java SE API. He “behind the scenes” uses the necessary classes for the desired tasks.

+6
source

Outdated

Tool

apt and APIs were deprecated since JDK 7. Mention: https://blogs.oracle.com/darcy/entry/apt_api_files

To solve the problem, you can import tools.jar% JDK JAVA% \ lib \ tools.jar.

In my case, "C: \ Program Files \ Java \ jdk1.7.0_01 \ lib \ tools.jar"

+4
source

BalusC's answer is also correct, but the link is dead, and there is a simpler solution in Sun JDK and 1.5 and 1.5 have tools.jar in / lib / add it to the class path, it's all there.

+1
source

Although it's out of date, if you want to try trying out a sample book, you can download the apt-mirror-api-0.1.jar zip file here , and then just create a path in your IDE. For eclipse, simply right-click the JRE System Library icon → Build PathConfigure Build PathAdd External JARs and finally find the downloaded jar file and apply it.

0
source

Source: https://habr.com/ru/post/1311324/


All Articles