Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How To Access Folders When Testing Plugins
How To Access Folders When Testing Plugins [message #328046] Tue, 13 May 2008 05:47 Go to next message
Eclipse UserFriend
Originally posted by: gautam_hn.yahoo.com

Hi friends,

I've searched enough to find a solution for this particular issue, all in
waste.
Here's the situation I'm facing now.

I have two projects in Eclipse, lets say :

com.test.PluginProject (plugin project)
com.test.JavaProject (java project)

PluginProject has the business logic and JavaProject is dependant on
PluginProject. Everything works pretty much fine, except for, there are
some folders in the JavaProject which I'm not able to get a handle to,
when I launch the plugin for testing.

com.test.PluginProject -- depends on
com.test.JavaProject
-- Folder
-- Sub-Folder1
-- Sub-Folder2
-- Internal-Folder1
-- Internal0Folder2

I want to browse through the contents of the folder and subfolders and
internal folders.

this.getClassloader().getResource()

gets the URL (Absolute), but since my launched application I won't be able
to create a file object.

Any lead on this one will be helpful. I'm not sure if this is the right
approach, suggestions to do it right way much appreciated.

Thanks,
/G
Re: How To Access Folders When Testing Plugins [message #328065 is a reply to message #328046] Tue, 13 May 2008 14:16 Go to previous message
Wayne Beaton is currently offline Wayne BeatonFriend
Messages: 554
Registered: December 2017
Senior Member
You could try setting the working directory in the launch configuration
to the root of your com.test.JavaProject. Look for "Working directory"
on the "Arguments" page.

With the working directory set, you should be able to access the root of
your project with new File(".") and navigate from there.

Note that this won't work if you package your project up as a JAR for
delivery. I assume that this won't be a problem since you said that this
is for testing (I'm assuming development/unit testing in the Eclipse
environment). As a general rule, the getResource() and
getResourceAsStream() are the safe way to go.

HTH,

Wayne

On Tue, 2008-05-13 at 05:47 +0000, Exquisitus wrote:
> Hi friends,
>
> I've searched enough to find a solution for this particular issue, all in
> waste.
> Here's the situation I'm facing now.
>
> I have two projects in Eclipse, lets say :
>
> com.test.PluginProject (plugin project)
> com.test.JavaProject (java project)
>
> PluginProject has the business logic and JavaProject is dependant on
> PluginProject. Everything works pretty much fine, except for, there are
> some folders in the JavaProject which I'm not able to get a handle to,
> when I launch the plugin for testing.
>
> com.test.PluginProject -- depends on
> com.test.JavaProject
> -- Folder
> -- Sub-Folder1
> -- Sub-Folder2
> -- Internal-Folder1
> -- Internal0Folder2
>
> I want to browse through the contents of the folder and subfolders and
> internal folders.
>
> this.getClassloader().getResource()
>
> gets the URL (Absolute), but since my launched application I won't be able
> to create a file object.
>
> Any lead on this one will be helpful. I'm not sure if this is the right
> approach, suggestions to do it right way much appreciated.
>
> Thanks,
> /G
>
Previous Topic:Strange Behavior when adding a FormPage into SharedHeaderFormEditor
Next Topic:Inserting external library
Goto Forum:
  


Current Time: Sat Jul 27 12:32:02 GMT 2024

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

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

Back to the top