• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MyEclipse: adding jar to build path

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When adding jars to my project through Project->Properties->Build Path-.Add External Jar, then clicking "OK",
I get the following error:


Could not write file: C:\development\MyProject\.classpath.
C:\development\MyProject\.classpath (Access is denied)

I realize I can drop the .jar file into WEB-INF/lib, but why can't I add it through the IDE?
This is using Vista; does that have anything to do with the permission problem?

Thanks
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried to add mail.jar to my project as an external jar from this location:
C:\Java\JavaSource\plugins\com.genuitec.eclipse.j2eedt.core_6.5.0.zmyeclipse650200806\data\libraryset\JSTL1.0\lib

but I get an error message each time

Could not write file: C:\development\MyProject\.classpath.
C:\development\MyProject\.classpath (Access is denied)


How can I resolve this?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like there is some permissions problem on the c:\development\MyProject directory. Was that directory, by and chance, created by another user (or while you were logged in as another user, such as an admin user)? If so, you might not have access to it. Check the security settings and give your account full rights to the c:\development directory and all its subdirectories.
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am logged in as a user with Administrator privileges. Is there another way around this or what else can I do?

I only use one login on this laptop so I would think I created the directory as the same user I am now.

I just hit this problem again tonight; last week somehow I got around it, but it was not straightforward so I don't remember how it happened
if I even knew at the time. I just kept trying things. Doesn't seem like it has to be so challenging to add a jar to the build path!

When I look at Properties on this folder, I see that the user name I am logged in as has Full Control; wouldn't that work?

I have turned off UAC and still cannot add a jar to the BuildPath through MyEclipse .

Thank you very much.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the same thing happen after a reboot?

I find it unlikely it's a problem with Eclipse; I do this all the time with no issues.
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree; I think it's a Vista UAC problem, but I can't seem to resolve it.
The last thing I did was a reboot.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the permissions on the .classpath file? Is that file marked read-only? Can you open that file with notepad (or some other text editor), change it, and save the changes?
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Had to do a "clean" on the project. Thanks for your help. I had added full control to every user I had and still I could ot get rid of the compile problem. I have Eclipse set to automatically build after changes, but it doesn't seem to always do a clean when it needs to. Thought of that when I went to bed at 3 a.m. last night. Clear thinking sometimes means to get away from the work. I should know that.
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am able to use log4j; but I'm not certain how I have it included in the CLASSPATH. I added it to the Environment Variables and also dropped it in WEB-INF/lib folder. I still can't add it through the Project-> Properties- Java Build Path method. I feel like it does have to do with the permissions on the log4j.jar file. I have only logged in as one user so the permissions should be the same on that jar as on mail.jar and jstl-1.2.jar which I can add to the project this way.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding the logj4 JAR file to the project libraries should not involve anything in regards to the log4j.jar file itself - all that action really does is add a line to the .classpath file.

Oh no, I just had a thought! It could very well be that the file is in use. Can you temporarily turn off your virus scanner? It could well be that the virus scanner has the file open and thus Eclipse cannot update it. (I have a similar problem with by daily backup - I close Outlook but the backup cannot copy the PST files because the virus scanner is busy scanning them. I have to wait a few minutes to let the scanner run its course, then let the backup run.)

Another way to track whether the file is in use is to get File Monitor or System Monitor from sysinternals. Set it up to monitor only the .classpath file. That should tell you if some other task is accessing the file.

Also, what Eclipse plugins do you have? It could be that a plugin has an extra thread that has that file open, thus preventing it from being updated by other threads. At least, I think that would happen.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had this exact same problem. After hours of frustrating attempts to find out what was causing this, I stumbled across a fix.
It seems that Eclipse can't write to files with the 'hidden' attribute set. For some reason my .classpath and .project files had the "hidden" attribute set.
(No doubt some helpful process or other thought that because they started with '.', they should be hidden)
Unsetting the "hidden" attribute fixed the problem. ("attrib /s -h" in your workspace directory for those who like the command line)
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to everyone for your responses; you were very helpful! The problem is resolved,
and this post may be closed.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mary, for the benefit of future Ranchers who come across this post, could you state exactly what the solution was?
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Must I admit that I had not refreshed the Navigator View in MyEclipse?

It had been a long time since such a thing got me like that.
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic