A resource exists with a different case, and class files not generating

40,376

Solution 1

The best way I found to avoid this problem is to make an intermediate change to another package name, so if you are trying to rename a package from com.example.MyApplication to com.example.myapplication you need to do the following:

  1. Rename the package com.example.MyApplication to com.example.myapplication2 (this should be successful and you will not face the error: [A resource exists with a different case ..]

  2. Rename the package com.example.myapplication2 to com.example.myapplication

This way I could avoid this error in Eclips, I think it is related to the fact that package names has to be reflected to the folder names in the file system, so you can not have two folders with the same name but different with the case only.

Solution 2

Faced this problem just now and found the cause. My source code was under the package com.ABCD.util and test code in com.ABCD.util.test. Then I changed the source code package name from com.ABCD.util to com.abcd.util. After that I started getting this error. Test classes which were going to the same bin folder, differed in case (ABCD and abcd). Once I changed the case of test-classes too, the problem went away. All his, even though the package ABCD was empty.

Solution 3

This problem is caused by a typo in your package name some where in the project, "a different case".

I suggest you compare package name in all these places:

1.Manifest.xml >> package name should be all in small letters

2.packages in src folder

3.packages in gen folder

they should all be the same, if not fix it or refactor the wrong package name, this will solve it.

my problem was in different case in gen folder package, i hope this helps.

*keep on cleaning, building the projects, closing/reopen them and restarting eclipse sometimes

Share:
40,376
steff_bdh
Author by

steff_bdh

Updated on August 05, 2022

Comments

  • steff_bdh
    steff_bdh almost 2 years

    Getting a problem in eclipse which says

    The project was not built due to "A resource exists with a different case: 
    '/AgriExpenseTT/bin/classes/uwi/dcit/agriexpensett'.". Fix the problem, then try           refreshing this project and building it since it may be inconsistent
    

    I've read other posts saying to check my package name/ delete my R.java/ delete bin folder/clean the project/restart eclipse and or computer, i've tried them all but to no avail, however i've noticed that in my bin/classes/uwi/dcit/agriexpensett there were no class files, is that supposed to happen if i've an error, any help is appreciated thanks

  • user435421
    user435421 about 6 years
    Fastest way to find the problem source is to do a in-folder search (on Windows although other operating systems should have this feature too). In this case phrase "agriexpensett" should be entered for the search and among the results you should quickly find the problematic folder/package with different case letters