IFile ResourceException: specifying workspace resource on command prompt [message #238216] |
Thu, 18 October 2007 17:39  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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.
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06222 seconds