Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 366
steff_bdh Avatar asked Jul 21 '14 16:07

steff_bdh


3 Answers

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.

like image 136
Hasson Avatar answered Oct 17 '22 14:10

Hasson


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.

like image 30
Amit Avatar answered Oct 17 '22 13:10

Amit


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

like image 4
Abeer Sul Avatar answered Oct 17 '22 14:10

Abeer Sul