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  |
Eclipse User |
|
|
|
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 #252125 is a reply to message #252115] |
Wed, 19 March 2008 13:11   |
Eclipse User |
|
|
|
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 #252149 is a reply to message #252125] |
Wed, 19 March 2008 15:35   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Wed May 07 08:27:27 EDT 2025
Powered by FUDForum. Page generated in 0.04820 seconds
|