When I try to make a project in IntelliJ I receive the following error on this line:
Sentence sent = new Sentence(); sent.emptySegments();
Error:
Error:(151, 10) java: cannot access javax.xml.bind.RootElement class file for javax.xml.bind.RootElement not found
Sentence
is a class which implements the RootElement
interface
import javax.xml.bind.RootElement; ... public class Sentence extends MarshallableRootElement implements RootElement {
All packages exist and I can jump to declaration of each interface or class but I don't know why IntellJ says it cannot access or find them? However RootElement
is an interface and not a class
public interface RootElement extends Element { void validate() throws StructureValidationException; }
The above declaration is in a jar file named jaxb-rt-1.0-ea.jar
and it exists in the Project librarians.
class file in java is generated when you compile . java file using any Java compiler like Sun's javac which comes along with JDK installation and can be found in JAVA_HOME/bin directory.
In order to decompile class file, just open any of your Java projects and go to Maven dependencies of libraries to see the jar files included in your project. Just expand any jar file for which you don't have the source attached in Eclipse and click on the . class file.
Try this
(See Invalidate caches on IntelliJ's manual)
The project contained several modules. While the library was added to the project libraries, some modules lacked it in their dependency part. So I solved the problem using the following steps in IntelliJ
Creating a module library and adding it to the module dependencies:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With