Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Multiple projects using the same resources...how do I make links to the resource folder?
Multiple projects using the same resources...how do I make links to the resource folder? [message #252089] Tue, 18 March 2008 20:14 Go to next message
Eclipse UserFriend
Originally posted by: kwarner.uneedspeed.net

I have 6 different projects that all use the same resources.
The resources are big jpeg images -- 30 or 40 of them.

Now I have to make a copy of the entire folder and
put it in the src folder so that when I build my app
the resources are copied to the bin folder.

Needless to say, I'm chewing up a lot of disk space having
12 folders with the same resources.

What I want to know is how do I make links; shortcuts; virtual directories
whatever you want to call them so that I just have one folder
full of my images and all the different projects can access the
images in that folder as resources as they need to?

Environment: Eclipse 3.2.1; Windows 2000 SP4; Java 1.5.0.13

How do I make a link to my resource folder? I tried making
a short cut but that didn't work.
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252093 is a reply to message #252089] Tue, 18 March 2008 23:04 Go to previous messageGo to next message
Eclipse UserFriend
DemonDuck wrote:
> I have 6 different projects that all use the same resources.
> The resources are big jpeg images -- 30 or 40 of them.
> Now I have to make a copy of the entire folder and
> put it in the src folder so that when I build my app
> the resources are copied to the bin folder.
>
> Needless to say, I'm chewing up a lot of disk space having
> 12 folders with the same resources.
>
> What I want to know is how do I make links; shortcuts; virtual directories
> whatever you want to call them so that I just have one folder full of my
> images and all the different projects can access the
> images in that folder as resources as they need to?
>
> Environment: Eclipse 3.2.1; Windows 2000 SP4; Java 1.5.0.13
>
> How do I make a link to my resource folder? I tried making a short cut
> but that didn't work.
Hello Mr. DemonDuck. I haven't tried this, but I think it might work for
you. When you create a new folder (New/Folder) in Eclipse, you can press
the Advanced button and this gives you the opportunity to link the
folder to an existing folder in your file system. So you ought to be
able to have linked folders in all of your Eclipse projects linking back
to one real directory on your system. Hope this helps. Mark
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252097 is a reply to message #252093] Wed, 19 March 2008 07:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kwarner.uneedspeed.net

Hi Mark,

That almost works. If I make a new folder in src and link it
to my resource folder, links are created to all the items and
folders in the resource folder.

However, when I Project->Clean and then Run, all the items
in the target (remote) resource folder are copied into the bin
folder. So I still end up with copies of all the resources
in all the bin folders. This reduces disk space by one half --
not so bad -- but still duplicates unecessarily all the
resources.

Close and I think I might be able to use this if I link and clean
all the other projects. I'm still thinking about this.

It would be best if links were copied to the bin folder rather
than the resources them selves.

DD


Mark Dexter wrote:
> DemonDuck wrote:
>
>> I have 6 different projects that all use the same resources.
>> The resources are big jpeg images -- 30 or 40 of them.
>> Now I have to make a copy of the entire folder and
>> put it in the src folder so that when I build my app
>> the resources are copied to the bin folder.
>>
>> Needless to say, I'm chewing up a lot of disk space having
>> 12 folders with the same resources.
>>
>> What I want to know is how do I make links; shortcuts; virtual
>> directories
>> whatever you want to call them so that I just have one folder full of
>> my images and all the different projects can access the
>> images in that folder as resources as they need to?
>>
>> Environment: Eclipse 3.2.1; Windows 2000 SP4; Java 1.5.0.13
>>
>> How do I make a link to my resource folder? I tried making a short
>> cut but that didn't work.
>
> Hello Mr. DemonDuck. I haven't tried this, but I think it might work for
> you. When you create a new folder (New/Folder) in Eclipse, you can press
> the Advanced button and this gives you the opportunity to link the
> folder to an existing folder in your file system. So you ought to be
> able to have linked folders in all of your Eclipse projects linking back
> to one real directory on your system. Hope this helps. Mark
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252101 is a reply to message #252097] Wed, 19 March 2008 07:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mauro.molinari.cardinis.com

DemonDuck ha scritto:
> Hi Mark,
>
> That almost works. If I make a new folder in src and link it
> to my resource folder, links are created to all the items and
> folders in the resource folder.
> However, when I Project->Clean and then Run, all the items
> in the target (remote) resource folder are copied into the bin
> folder. So I still end up with copies of all the resources in all the
> bin folders. This reduces disk space by one half --
> not so bad -- but still duplicates unecessarily all the resources.
>
> Close and I think I might be able to use this if I link and clean
> all the other projects. I'm still thinking about this.
>
> It would be best if links were copied to the bin folder rather
> than the resources them selves.
>
> DD

If I understood it well, you should just create a Java project with the
shared resources. Then, make the other projects depend on this shared
project.

If you have special needs about the deployment of resources, you may
also wish to try to check the shared project in "Order and Export" tab
in Java Build Path properties page of the other projects.

Hope this helps.

Mauro.
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252115 is a reply to message #252101] Wed, 19 March 2008 12:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kwarner.uneedspeed.net

Hi Mauro,

But I only need the image files (the resources) I don't need
anything else from any other project. I don't need any of the
class or Java files.

Are you saying that this Java project would not have any Java
files? That it would just be a dummy project with only resources?

DD


Mauro Molinari wrote:
> DemonDuck ha scritto:
>
>> Hi Mark,
>>
>> That almost works. If I make a new folder in src and link it
>> to my resource folder, links are created to all the items and
>> folders in the resource folder. However, when I Project->Clean and
>> then Run, all the items
>> in the target (remote) resource folder are copied into the bin
>> folder. So I still end up with copies of all the resources in all the
>> bin folders. This reduces disk space by one half --
>> not so bad -- but still duplicates unecessarily all the resources.
>>
>> Close and I think I might be able to use this if I link and clean
>> all the other projects. I'm still thinking about this.
>>
>> It would be best if links were copied to the bin folder rather
>> than the resources them selves.
>>
>> DD
>
>
> If I understood it well, you should just create a Java project with the
> shared resources. Then, make the other projects depend on this shared
> project.
>
> If you have special needs about the deployment of resources, you may
> also wish to try to check the shared project in "Order and Export" tab
> in Java Build Path properties page of the other projects.
>
> Hope this helps.
>
> Mauro.
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252125 is a reply to message #252115] Wed, 19 March 2008 13:11 Go to previous messageGo to next message
Eclipse UserFriend
DemonDuck wrote:
> Hi Mauro,
>
> But I only need the image files (the resources) I don't need
> anything else from any other project. I don't need any of the
> class or Java files.
>
> Are you saying that this Java project would not have any Java
> files? That it would just be a dummy project with only resources?
>
> DD
>
>
> Mauro Molinari wrote:
>> DemonDuck ha scritto:
>>
>>> Hi Mark,
>>>
>>> That almost works. If I make a new folder in src and link it
>>> to my resource folder, links are created to all the items and
>>> folders in the resource folder. However, when I Project->Clean and
>>> then Run, all the items
>>> in the target (remote) resource folder are copied into the bin
>>> folder. So I still end up with copies of all the resources in all
>>> the bin folders. This reduces disk space by one half --
>>> not so bad -- but still duplicates unecessarily all the resources.
>>>
>>> Close and I think I might be able to use this if I link and clean
>>> all the other projects. I'm still thinking about this.
>>>
>>> It would be best if links were copied to the bin folder rather
>>> than the resources them selves.
>>>
>>> DD
>>
>>
>> If I understood it well, you should just create a Java project with
>> the shared resources. Then, make the other projects depend on this
>> shared project.
>>
>> If you have special needs about the deployment of resources, you may
>> also wish to try to check the shared project in "Order and Export" tab
>> in Java Build Path properties page of the other projects.
>>
>> Hope this helps.
>>
>> Mauro.
In playing around with this, I think there are two different issues that
are potentially confusing. In a vanilla Java project, you set up images
(e.g., images) under your source directory (e.g., MyProject/src/images).
Then, when the build happens, normally this entire directory gets copied
over to the bin (e.g., bin/icons).

So, in this scenario, there are actually two entire copies of the images
directory for each project.

In some quick testing, it is easy to set the src/images to be a linked
directory to some central place on your system. (Just create the folder
as a linked folder.) This avoids the problem of having duplicate image
directories for each project. However, I haven't been able to get rid of
the bin/images directory. You can exclude files from being copied in
there, but then the program, when run inside Eclipse at least, doesn't
find the images at runtime.

So, I think the question is: How does one allow the program to run
inside Eclipse without having the images folder copied to the bin/images
directory? Thanks. Mark
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252129 is a reply to message #252125] Wed, 19 March 2008 13:22 Go to previous messageGo to next message
Eclipse UserFriend
Mark Dexter wrote:
> So, I think the question is: How does one allow the program to run
> inside Eclipse without having the images folder copied to the bin/images
> directory? Thanks. Mark
You can put your images folder in a class folder (see Add Class Folder... on Build Path wizard).
In this case, the images won't be copied to the bin folder, but at runtime the class folder will be
put on the classpath and the images will be available.

Jerome
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252137 is a reply to message #252129] Wed, 19 March 2008 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Jerome Lanneluc wrote:
> Mark Dexter wrote:
>> So, I think the question is: How does one allow the program to run
>> inside Eclipse without having the images folder copied to the
>> bin/images directory? Thanks. Mark
> You can put your images folder in a class folder (see Add Class
> Folder... on Build Path wizard).
> In this case, the images won't be copied to the bin folder, but at
> runtime the class folder will be
> put on the classpath and the images will be available.
>
> Jerome
Thanks, Jerome. That seems to be the best answer. Note that you also
need to delete the src/images directory altogether, so there is nothing
to get copied.
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252145 is a reply to message #252129] Wed, 19 March 2008 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kwarner.uneedspeed.net

Clever! That's seems like it would be a good way to do it.

I'll try it later and report...

Jerome Lanneluc wrote:
> Mark Dexter wrote:
>
>> So, I think the question is: How does one allow the program to run
>> inside Eclipse without having the images folder copied to the
>> bin/images directory? Thanks. Mark
>
> You can put your images folder in a class folder (see Add Class
> Folder... on Build Path wizard).
> In this case, the images won't be copied to the bin folder, but at
> runtime the class folder will be
> put on the classpath and the images will be available.
>
> Jerome
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252149 is a reply to message #252125] Wed, 19 March 2008 15:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kwarner.uneedspeed.net

Mark Dexter wrote:
> DemonDuck wrote:
>
>> Hi Mauro,
>>
>> But I only need the image files (the resources) I don't need
>> anything else from any other project. I don't need any of the
>> class or Java files.
>>
>> Are you saying that this Java project would not have any Java
>> files? That it would just be a dummy project with only resources?
>>
>> DD
>>
>>
>> Mauro Molinari wrote:
>>
>>> DemonDuck ha scritto:
>>>
>>>> Hi Mark,
>>>>
>>>> That almost works. If I make a new folder in src and link it
>>>> to my resource folder, links are created to all the items and
>>>> folders in the resource folder. However, when I Project->Clean and
>>>> then Run, all the items
>>>> in the target (remote) resource folder are copied into the bin
>>>> folder. So I still end up with copies of all the resources in all
>>>> the bin folders. This reduces disk space by one half --
>>>> not so bad -- but still duplicates unecessarily all the resources.
>>>>
>>>> Close and I think I might be able to use this if I link and clean
>>>> all the other projects. I'm still thinking about this.
>>>>
>>>> It would be best if links were copied to the bin folder rather
>>>> than the resources them selves.
>>>>
>>>> DD
>>>
>>>
>>>
>>> If I understood it well, you should just create a Java project with
>>> the shared resources. Then, make the other projects depend on this
>>> shared project.
>>>
>>> If you have special needs about the deployment of resources, you may
>>> also wish to try to check the shared project in "Order and Export"
>>> tab in Java Build Path properties page of the other projects.
>>>
>>> Hope this helps.
>>>
>>> Mauro.
>
> In playing around with this, I think there are two different issues that
> are potentially confusing. In a vanilla Java project, you set up images
> (e.g., images) under your source directory (e.g., MyProject/src/images).
> Then, when the build happens, normally this entire directory gets copied
> over to the bin (e.g., bin/icons).
>
> So, in this scenario, there are actually two entire copies of the images
> directory for each project.
>
> In some quick testing, it is easy to set the src/images to be a linked
> directory to some central place on your system. (Just create the folder
> as a linked folder.) This avoids the problem of having duplicate image
> directories for each project. However, I haven't been able to get rid of
> the bin/images directory. You can exclude files from being copied in
> there, but then the program, when run inside Eclipse at least, doesn't
> find the images at runtime.
>
> So, I think the question is: How does one allow the program to run
> inside Eclipse without having the images folder copied to the bin/images
> directory? Thanks. Mark


EXACTLY!!!
Re: Multiple projects using the same resources...how do I make links to the resource folder? [message #252158 is a reply to message #252149] Wed, 19 March 2008 19:04 Go to previous message
Eclipse UserFriend
DemonDuck wrote:
> Mark Dexter wrote:
>> DemonDuck wrote:
>>
>>> Hi Mauro,
>>>
>>> But I only need the image files (the resources) I don't need
>>> anything else from any other project. I don't need any of the
>>> class or Java files.
>>>
>>> Are you saying that this Java project would not have any Java
>>> files? That it would just be a dummy project with only resources?
>>>
>>> DD
>>>
>>>
>>> Mauro Molinari wrote:
>>>
>>>> DemonDuck ha scritto:
>>>>
>>>>> Hi Mark,
>>>>>
>>>>> That almost works. If I make a new folder in src and link it
>>>>> to my resource folder, links are created to all the items and
>>>>> folders in the resource folder. However, when I Project->Clean and
>>>>> then Run, all the items
>>>>> in the target (remote) resource folder are copied into the bin
>>>>> folder. So I still end up with copies of all the resources in all
>>>>> the bin folders. This reduces disk space by one half --
>>>>> not so bad -- but still duplicates unecessarily all the resources.
>>>>>
>>>>> Close and I think I might be able to use this if I link and clean
>>>>> all the other projects. I'm still thinking about this.
>>>>>
>>>>> It would be best if links were copied to the bin folder rather
>>>>> than the resources them selves.
>>>>>
>>>>> DD
>>>>
>>>>
>>>>
>>>> If I understood it well, you should just create a Java project with
>>>> the shared resources. Then, make the other projects depend on this
>>>> shared project.
>>>>
>>>> If you have special needs about the deployment of resources, you may
>>>> also wish to try to check the shared project in "Order and Export"
>>>> tab in Java Build Path properties page of the other projects.
>>>>
>>>> Hope this helps.
>>>>
>>>> Mauro.
>>
>> In playing around with this, I think there are two different issues
>> that are potentially confusing. In a vanilla Java project, you set up
>> images (e.g., images) under your source directory (e.g.,
>> MyProject/src/images). Then, when the build happens, normally this
>> entire directory gets copied over to the bin (e.g., bin/icons).
>>
>> So, in this scenario, there are actually two entire copies of the
>> images directory for each project.
>>
>> In some quick testing, it is easy to set the src/images to be a linked
>> directory to some central place on your system. (Just create the
>> folder as a linked folder.) This avoids the problem of having
>> duplicate image directories for each project. However, I haven't been
>> able to get rid of the bin/images directory. You can exclude files
>> from being copied in there, but then the program, when run inside
>> Eclipse at least, doesn't find the images at runtime.
>>
>> So, I think the question is: How does one allow the program to run
>> inside Eclipse without having the images folder copied to the
>> bin/images directory? Thanks. Mark
>
>
> EXACTLY!!!
>
So, here is what I think I've figured out. You can do this at least two
different ways.

(1) Create a class folder (Libraries tab in Java Build Path) in your
project to point to folder with shared files (e.g., images).
or (2) Use a common Eclipse project that has the images folder in it
(e.g., src/images) and then use the Order and Export tab on the common
Eclipse project to add this folder to the list (i.e., check the
src/images folder to make it exported and visible to dependent
projects). Then, for the projects that need this folder, just make them
dependent on the common project (Projects tab in build path).

In my case, I'm using the org.eclipse.swt project as a common project
for all of the SWT and JFace JAR files, so I can just add the images
folder to that project and it all works.

Note that, in either case, you need to make sure that these files are
selected when you create your JAR file. Mark
Previous Topic:JDT Bug ?
Next Topic:Drag and drop java elements from the package explorer
Goto Forum:
  


Current Time: Wed May 07 08:27:27 EDT 2025

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

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

Back to the top