Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.java is not on the classpath of project, only syntax errors are reported

I could not find a proper answer to this error in other posts. I am using Maven for building my project in VS Code and whenever I create a class this error appears. Do I need to do anything with .classpath file? Correct me if I am mistaken, this error is pointing out that the class is not recognized by the .classpath file in which it belongs to, so I have to address it in that file.

Tnx

like image 313
abbas Avatar asked Dec 08 '22 10:12

abbas


1 Answers

It seems like no one else knew it!

The problem was regarding "folder convention" and "maven-dependency-plugin". As I created my Maven project with the line below via windows command line, maven did not install dependency-plugin and that created the first problem.

Second, what I meant by "folder convention" was, deleting "java" folder which is created by executing bellow Maven command line, caused me a problem since Maven compiler does not find any Java project to go to and execute codes. Deleting Java folder will also lead to the error above because no Java file is recognized, so no java files will be added to .classpath folder respectively.

mvn archetype:generate -DgroupId=name -DartifactId=name -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

like image 67
abbas Avatar answered Dec 09 '22 22:12

abbas