Reputation: 491
I added Lombok 1.12
jar file in classpath while I gave Lombok 1.16
jar file in libraries (while configuring build path in eclipse). Eclipse
could not recognise some annotations of lombok like @Builder
( was giving compiler error).
(Also @Builder
was included in the main Lombok
package in version 1.12
)
Later I corrected gave Lombok 1.16
jar file in classpath also. @Builder
annotation gets recognised this time by eclipse. Everything works well now.
This means the classpath in vm gets compared with the build path and a check is performed whether binary file (lombok.jar
) is same for the classpath and buildpath both. Is my assertion correct ? Pls correct me if I'm wrongly interpreting this.
Upvotes: 1
Views: 1376
Reputation: 11
in eclipse if both jar is there in build path order them the one u want to refer give it priority order by making it to top-- Build path last tab or u can delink the lower version which u dont want to refer.
Upvotes: 0
Reputation: 781
build path is kind of a superset of class path,it holds class path,source code path and all resources that are dependent on project. If you have 2 different version of jars JVM will load the class from the jar which comes first in build path.This can be managed by editing (build path->configure build path->order of export). If the required class is not available in the first version it will check in 2nd version jar .if it doesn't find it at all then compilation error will be thrown
Upvotes: 1