score:208

Accepted answer

it means: "a class that you use needs another class that is not on the classpath." you should make sure (as harry joy suggests) to add the required jar to the classpath.

score:-1

point the jre in the build path to a jdk. that worked for me.

score:0

in addition to the already suggested cause of missing a class file this error can also indicate a duplicate class file, eclipse reports this error when an class file on the build path uses another class that has multiple definitions in the build path.

score:0

since you give us very little details, most likely what you did, which is an incredibly easy mistake to make, is that instead of heading to

build path > configure build path > projects

and adding your additional project folder from there, instead you went to

build path > configure build path > libraries

and added your project folder from there instead.

this is most definitely the case if your code is all correct, but upon automatically reorganizing imports via the ctrl+space shortcut , instead of your import statements referring to com.your.additionalproject, your references all point to bin.com.your.additionalproject.

note the bin. meaning that you -are- indirectly referring to your class by treating your other project folder structure as a library, making your ide doing all the wokr of finding the exactly binary class you're referring to.

to correct this, remove the folder from the libraries, and instead add it under the projects tab, and reorganize your imports. your project should work fine.

score:0

when i use a new eclipse version and try to use the previous workspace which i used with old eclipse version, this error occured.

here is how i solve the problem:

right click my project on package explorer -> properties -> java build path -> libraries -> i see an error(cross sign) on jre system library. because the path cannot be found. -> double click the jre system library -> select the option "workspace default jre" -> finish -> ok. -> bum it is working

fyi.

score:0

in my case it was a result of my adding a new dependency to my pom.xml file.

the new dependency depended on an old version of a library (2.5). that same library was required by another library in my pom.xml, but it required version 3.0.

for some reason, when maven encounters these conflicts it simply omits the most recent version. in eclipse when viewing pom.xml you can select the "dependency hierarchy" tab at the bottom to see how dependencies are resolved. here you will find if the library (and thus class) in question has been omitted for this reason.

in my case it was as simple as locking down the newer version. you can do so by right-clicking the entry - there is an option to lock it down in the context menu.

score:0

for me none of the solutions above worked. what worked for me was to select all the code in the class, then convert it to a comment, save, then convert it back to normal text, the error was gone.

score:0

in my case the problem was "javax.ws.rs.webapplicationexception cannot be resolved" in execution when starting the web application in tomcat.

solution adding the following library (maven):

<dependency>
    <groupid>javax.ws.rs</groupid>
    <artifactid>javax.ws.rs-api</artifactid>
    <version>2.0</version>
</dependency>

score:0

right click on your project->properties->maven->active maven profile(comma seperated) then in that box write pom.xml and check the resolve dependencies from workspace project

score:1

i got the error when i just changing some svn settings and not anything in the code. just cleaning the projects fixed the error.

score:1

in my case ,i created a project and made its minsdkversion=9 and targetsdkversion=17. i used automatically generated libs/android-support-v4.jar. i also had to make use of actionbaractivity using android-support-v7-appcomapt.jar. so i just copied the android-support-v7-appcompat.jar file from android-sdk/extras/andrid/support/v7/appcompat/libs folder and pasted it to my project libs folder. and this caused the above error. so basically,i needed to put android-support-v4.jar file from android-sdk/extras/andrid/support/v7/appcompat/libs as well to my project libs folder. as per my knowledge the v7.jar file had dependencies on v4.jar file. so ,it needed it own v4.jarfile,instead of my project,automatically created v4.jar file.

score:1

quickly and simply i fixed it this way ( i use adt version: v21.0.0-531062 on windows xp home edition)

  1. opened manifest file.
  2. changed the existing project minsdkversion to the same value as maxsdkversion ( advise: it may be good to create a new project and see what is it's maxsdkversion )
  3. save manifest file.
  4. right click the project and select build project.
  5. from top menu: project - clean.. - check only the relevant project, below i checked start a build immediately and build only the selected projects and ok.
  6. open the java file - no red errors anymore !
  7. back to step 1 above and changing back minsdkversion to it's original value (to supoprt as many android version as possible).

it worked but the problem returns every few days. i do the same as above and it solves and lets me develop.

score:2

for me, it happens when i upgrade my jdk to 1.8.0_60 with my old set of jars has been used for long time. if i fall back to jdk1.7.0_25, all these problem are gone. it seems a problem about the compatibility between the jre and the libraries.

score:3

if you still can not find anything wrong with your setup, you can try project -> clean and clean all the projects in the workspace.

edit: sorry, did not see the suggestion of verbose_mode ... same thing

score:3

what fixed it for me was right clicking on project > maven > update project

score:4

i got this exception because eclipse was working in a different version of jdk, just changed to the correct, clean and build and worked!

score:4

i had an interesting case of this problem with eclipse 4.4.2. my project (p1) referenced an external class (project p2) with two methods with the same name but different argument types:

public static void setitem(integer id) …
public static void setitem(item item) …

the type item was contained in a third project p3, which i did not want to be visible here. p1 called only the first method:

externalclass.setitem(integer.valueof(12345));

so the second method, which used the item class, was not used, and it is true that p3 was not in the compilation classpath – why should it if it is not used.

still eclipse told me

the type ...item cannot be resolved.
it is indirectly referenced from required .class files

compiling from the command line did not produce any such issues. changing the name of the second method (unused here!) made the problem go away in eclipse, too.

score:5

this error occurs when the classes in the jar file does not follow the same structure as of the folder structure of the jar..

e.g. if you class file has package com.test.exam and the classes.jar created out of this class file has structure test.exam... error will be thrown. you need to correct the package structure of your classes.jar and then include it in ecplipse build path...

score:11

it sounds like this has been a known issue (bug 67414)that was resolved in 3.0 ... someone has commented that it's occurring for them in 3.4 as well.

in the mean time, the work around is to remove the jre system library from the project and then add it back again. here are the steps:

  • go to properties of project with the build error (right click > properties)

  • view the "libraries" tab in the "build path" section

  • find the "jre system library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project)

  • remove the "jre system library"

  • hit "add library ...", select "jre system library" and add the appropriate jre for the project (eg. 'workspace default jre')

  • hit "finish" in the library selection and "ok" in the project properties and then wait for the re-build of the project

hopefully the error will be resolved ...

score:16

i had this error because of a corrupted local maven repository.

so, in order to fix the problem, all i had to do was going in my repository and delete the folder where the concerned .jar was, then force an update maven in eclipse.

score:17

it happens to me sometimes, i always fixed that with "mvn eclipse:clean" command to clean old properties and then run mvn eclipse:eclipse -dwtpversion=2.0 (for web project of course). there are some old properties saved so eclipse is confused sometimes.

score:24

this is as likely a matter of eclipse's getting confused as it is an actual error. i ignored the error and ran the web service whose endpointinterface it complained about, and it ran fine, except for having to deal with the dialog every time i wanted to run it. just another opaque error that tells me nothing.


Related Query

More Query from same tag