Skip to main content



      Home
Home » Newcomers » Newcomers » IFile ResourceException: specifying workspace resource on command prompt
IFile ResourceException: specifying workspace resource on command prompt [message #238216] Thu, 18 October 2007 17:39 Go to next message
Eclipse UserFriend
Originally posted by: aquamp.gmail.com

I am running a headless application from command prompt, one of the
arguments are a file name within workspace. If the file exists already, it
is
overwritten. If it does not exist, it is created and written to.

When I run it within workbench, something like '\proj1\log' works fine
(proj1 is a project in workspace).

However running from command prompt using eclipsec command with the same
parameters throws error:
org.eclipse.core.internal.resources.ResourceException: Resource '/common'
does not exist.

The code is something like:
IPath path = new Path(cmdArgs[cmdIndex]);
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);

file.exists returns false even if it exists and
file.create(input, true, null) throws the above ResourceException.

ResourcesPlugin.getWorkspace().getRoot() returns the same String 'R/'
running from command prompt and within workbench.

Any idea how to specify resource here? Anything else I am missing here?
In addition to path related to workspace, I tried complete absolute paths,
paths relative to Eclipse installation directory, file URLs...they don't
work either.
Thank you.
Re: IFile ResourceException: specifying workspace resource on command prompt [message #238258 is a reply to message #238216] Fri, 19 October 2007 08:49 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Is it possible that file.getParent().exists() is false as well? After
all, you might need to create the project and the full path up to the
file itself...


aquamp wrote:
> I am running a headless application from command prompt, one of the
> arguments are a file name within workspace. If the file exists
> already, it is overwritten. If it does not exist, it is created and
> written to.
>
> When I run it within workbench, something like '\proj1\log' works fine
> (proj1 is a project in workspace).
> However running from command prompt using eclipsec command with the
> same parameters throws error:
> org.eclipse.core.internal.resources.ResourceException: Resource
> '/common' does not exist.
>
> The code is something like:
> IPath path = new Path(cmdArgs[cmdIndex]);
> IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
>
> file.exists returns false even if it exists and file.create(input,
> true, null) throws the above ResourceException.
>
> ResourcesPlugin.getWorkspace().getRoot() returns the same String 'R/'
> running from command prompt and within workbench.
>
> Any idea how to specify resource here? Anything else I am missing here?
> In addition to path related to workspace, I tried complete absolute
> paths, paths relative to Eclipse installation directory, file
> URLs...they don't work either. Thank you.
>
>
>
Previous Topic:CDT Multiple Build Targets
Next Topic:need eclipse source code
Goto Forum:
  


Current Time: Mon Jun 09 03:24:08 EDT 2025

Powered by FUDForum. Page generated in 0.07285 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top