Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Thursday, July 12, 2012

Eclipse build error: The project was not built since its build path is incomplete. Cannot find the class file for xxxxx. Fix the build path then try building this project

We are creating a project in Eclipse studio, building the project and it executes. Everything goes fine and smooth. Next time we open the Eclipse studio and see red cross mark error beside our imports on basic java class references. To be more specific, we get the following issue:

The project was not built since its build path is incomplete. Cannot find the class file for xxxxx. Fix the build path then try building this project

Here xxxxx can be any of the java class file. We wonder why we get this and that it didn’t happen when we worked on the project just before Lunch!!! Annoying huh.. Ok so what is the problem and how to get rid of this ASAP? Well…the problem is with the reference of java library in our project. Sometimes Eclipse loses the reference path and require us to help it out. And how do we do that…here are the steps:

1.       Right click on the project from the Project Explorer and select “Properties”. Alternatively we can also select “Properties” from the Project menu.
2.       From the Properties dialog, select “Java Build Path” from the left side view.
3.       Clicking the “Libraries” tab we can see the libraries referenced in the project and will also see that something is wrong with JRE library referenced in the project as shown below:


4.       Next we select this library and remove it. Then we click the “Add Library…” button on the right and then select the “JRE System Library” and then click the “Next” button as shown below:


5.       By default, we will see that “Workspace default JRE” is selected as shown below. We can leave this as is and then click the “Finish” button


Now that we have the JRE library referenced to the project, we should see the error go away. But sometimes not. In this case, we do the regular clean-up of the project as follows:

1.       Project Menu -> Clean

2.       Right click on the project from “Project Explorer” and “Refresh”

3.       Right click on the project from “Project Explorer” and under "Android Tools" click “Fix Project Properties”

4.       May be even restart Eclipse if the above 3 steps doesn’t work and then repeat the 3 steps after restarting

Finally we see the error go away. Whew….
Hope this helps reduce your headache and…

Happy Programming!!!


Thursday, June 21, 2012

Eclipse TFS Plugin Source control issue

At times when working with Team explorer, connecting to TFS Server from Eclipse studio can be a painful experience. Assume that you are working in a project and the source code is controlled from TFS server. Every changes are checked id and you are good for the day.

Next day you open the Eclipse studio ready to work on your project and notice that your project is not getting connected to TFS server (though all internet connectivity and your TFS server is up). You notice from the “Team” menu (right click your project to find this menu) that all command of TFS are disabled but “Return online…”. Clicking “Return online…” You will notice a window shows up displaying progress trying to connect to TFS server to associate source control binding to your project but fails in the first attempt but still continues and then displays the projects you have permission on. You select the project from the list of projects displayed and click the Finish button believing your project would now be associated but still no luck. You will find that all commands are still disabled under “Team” menu except “Return online…”. Annoying huh…

In this situation we can notice that if we double click the source control from the Team Explorer window, nothing will show up in the Source Control Explorer window…arrrr

We can try cleaning the project, restarting the eclipse studio, etc.., but nothing helps and we continue to face this issue and the Team Explorer will continue its struggle trying to connect to the TFS Server.

Ok so what’s the solution then…well...In this situation, instead of spending more time researching on this issue, we can perform the following actions to restore source code binding with TFS:

1.       Delete the project (remove only) from eclipse studio (Important Note: Not physical delete of the project from the system)
2.       Restart Eclipse studio and connect to TFS server. This time you will notice that it connects successfully without any issues.
3.       From the Source Control Explorer, right click on your project and click Import… button.
4.       Provide appropriate details in the “Import Project from Team Foundation Server” wizard and…

Things are back to normal….
Hope this help you solve your problem…

Wednesday, June 06, 2012

Eclipse displaying error icon on Android Project

When working with Android Project files, sometimes we work directly from within Eclipse studio and sometimes outside of the studio. Assume that in one our android project, we are in need of one complex functionality to be performed. We Google and get hold of java source that does exactly what we require. So, we go ahead and download the java source file and add it using Eclipse studio to our android project. Having added that we notice a couple of errors in the downloaded java file. Instead of fixing it right away, we decide to fix at a later point of time and close the eclipse editor (assuming a long break time).

Returning back we learn that our R & D team have implemented the complex functionality and now we decide to get rid of the downloaded java file. We move to the src folder location using windows explorer and delete the file. (Note that this file was added using the eclipse studio and on top of that the downloaded file had errors). Now we open the eclipse studio and notice that there are no error icons displayed for any files but the android project.

We try the following ways to get rid of the error but all goes in vain:
1. Clean the project but still the error remains
2. Refresh the project but still the error remains
3. Fix Project Properties from Android Tools but still the error remains

The fix that worked in our case is removing the .metadata folder from the project root location. This folder seems to hold reference to all the files added using eclipse studio.

Wednesday, May 30, 2012

Eclipse & TFS ~ Ignoring file from commit

The TFS plugin for Eclipse doesn’t have a direct way to support ignoring the files from committing directly from IDE just like SVN does. For example, we prefer not to commit the “bin” directory. In order to ignore certain files or directory, we will have to create a file with the name .tpignore and save it in the root directory of the project. For example, to ignore bin directory and all of its files, the content of the .tpignore file should be as follows:

/bin/
/bin/.*