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.

Anand
  • 10,310
  • 24
  • 90
  • 135

7 Answers7

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.

palacsint
  • 28,416
  • 10
  • 82
  • 109
Sentry
  • 4,102
  • 2
  • 30
  • 38
  • Also had to do the same for the `.project` file – Al Lelopath Nov 14 '13 at 14:23
  • apparently windows sets the hidden attribute when copying the files using windows file sharing – Alex Dec 04 '13 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 '14 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 '14 at 06:16
  • Worked like charm :) thanx – Coder ACJHP Mar 26 '17 at 08:36
13

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

victor
  • 131
  • 1
  • 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). – Brian Reinhold Jul 31 '12 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 '14 at 05: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.

Ed Griebel
  • 631
  • 9
  • 22
  • 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 '09 at 16:47
  • 3
    This should not be accepted as an answer. What Sentry said is a better answer. – Noman Arain Oct 08 '13 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 '14 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

Alexander Pogrebnyak
  • 44,836
  • 10
  • 105
  • 121
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.

Thomas Lötzer
  • 24,832
  • 16
  • 69
  • 55
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

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

On Mac, Below command helped me to resolve this.

sudo chmod 777 .classpath

Sathya
  • 233
  • 1
  • 4
  • 13