23

I am using an API called jtwitter. It has a single jar file jtwitter.jar I have been working with it and maintained it using git. I hosted the code in github. For somedays, i have not touched its code. Today, when i cloned my git repo (actually my system got a crash some days back so I had to clone ) and loaded the project into eclipse. Now when i wanted to add the jtwitter.jar into the buildpath, the following error occurs.

I am giving the partial exception stack trace here

java.io.FileNotFoundException: D:\workspace\ltwitter\.classpath (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:377)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:956)

please help.

7 Answers 7

102

I had the same problem, and I found out it was because the .classpath file was hidden. Removing the hidden attribute resolved the issue.

5
  • Also had to do the same for the .project file Nov 14, 2013 at 14:23
  • apparently windows sets the hidden attribute when copying the files using windows file sharing
    – Alex
    Dec 4, 2013 at 15:15
  • 3
    Right click on .classpath file and select properties. At the bottom of the window, uncheck the "Hidden" attribute checkbox.
    – Susie
    Jan 16, 2014 at 18:37
  • +1. This should be the accepted answer. If you have a problem with finding hidden files, go into Control Panel, choose Folder Options, click on the View tab, then under the Advanced Settings, choose "Show hidden files, folders and drives". You should be able to find the .classpath file in your working directory after.
    – rayryeng
    Apr 25, 2014 at 6:16
  • Worked like charm :) thanx Mar 26, 2017 at 8:36
13

I had the same issue with 64-bit Windows 7 and it was resolved by clearing the Hidden attribute.

2
  • THAT WORKED FOR ME on Windows 7 64 after many hours of frustration. I kept trying to clear the read only indicator on the folder (which I could not do even with the attrib command as instructed by MSN) but clearing the hidden bit did the job. Now I can attach a Javadoc to a referenced lib (jar). Jul 31, 2012 at 10:28
  • 1
    If your copying the project from a MAC or Linux system to a windows OS then this is the fix. Please remove the check mark for hidden on .classpath and .project files.
    – LokiDroid
    Apr 29, 2014 at 5:59
10

Make sure that the directory and file are still there, take a look at D:\workspace\ltwitter is a valid path, has a .classpath file and it is readable. Try opening .classpath in Notepad for a test of readability.

3
  • 6
    ya, your solution worked for me. But the thing I dont understand is that when i clone a git repo (which is actually an eclipse project root directory), the .classpath and .project files are changed to hidden files under windows explorer.. you got any idea about it ?
    – Anand
    Dec 11, 2009 at 16:47
  • 3
    This should not be accepted as an answer. What Sentry said is a better answer. Oct 8, 2013 at 20:34
  • Technically this answer doesn't really have a solution, it just says to look at a file and see if it is there. I'm guessing, we change a checkbox???
    – Stephen J
    Jun 19, 2014 at 19:01
2

Check directory permissions on D:\workspace\ltwitter and file permissions on D:\workspace\ltwitter\.classpath.

File Properties->Security tab in Windows Explorer

0

Does D:\workspace\ltwitter\ exist? Do you have access to it? Is this where the project lies?

You can fix the build path using the context menu of the project -> Build Path -> Configure Build Path. There you can see all entries, the ones which are not valid are marked as such.

0

Assuming the directory exist and has the proper authorization, check also your logs for missing properties during eclipse launch (see this thread)

If you find some missing properties, try this eclipse.ini

0

On Mac, Below command helped me to resolve this.

sudo chmod 777 .classpath

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.