Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to include properties file into resulting jar
How to include properties file into resulting jar [message #879438] Thu, 31 May 2012 08:15 Go to next message
Flavio Palumbo is currently offline Flavio Palumbo
Messages: 3
Registered: May 2012
Junior Member
Hi all,

i'm new to eclipse.

I've package tree like this :

src
|-mypackage
|-properties

mypackage contains the java sources while properties contains only properties files. When I build the project, properties package is excluded from the jar. I'd like to have it in the resulting jar respecting the source structure.
How can I do that ?
Any hint would be appreciated.

Flavio
Re: How to include properties file into resulting jar [message #879639 is a reply to message #879438] Thu, 31 May 2012 15:04 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3225
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 5/31/2012 2:15 AM, Flavio Palumbo wrote:
> Hi all,
>
> i'm new to eclipse.
>
> I've package tree like this :
>
> src
> |-mypackage
> |-properties
> mypackage contains the java sources while properties contains only
> properties files. When I build the project, properties package is
> excluded from the jar. I'd like to have it in the resulting jar
> respecting the source structure.
> How can I do that ?
> Any hint would be appreciated.
>
> Flavio

For what it's worth, here's something I wrote a long time ago. I
probably need to revisit it, particularly the confusion between code
lines 16/36 and the opening statement that the subdirectory is named
"resources", which it need not be (could be "properties" as you
suggest). If you piece together the project and play with it, you'll
begin to understand ResourceBundles.

Hope this helps. I'll try to revisit it soon and fix up anything I
screwed up. Sorry for being lame.

http://www.javahotchocolate.com/topics/resbundle.html
Re: How to include properties file into resulting jar [message #879649 is a reply to message #879639] Thu, 31 May 2012 15:26 Go to previous messageGo to next message
Flavio Palumbo is currently offline Flavio Palumbo
Messages: 3
Registered: May 2012
Junior Member
Hi,
I tried this :
right click on the package (properties) -> Use as a source folder.
I see the folder move down and change color.
I delete jar file and then rebuild but nothing changes.
I use Eclipse Java EE IDE for Web Developers.
Version: Helios Service Release 2
Build id: 20110218-0911
Re: How to include properties file into resulting jar [message #879671 is a reply to message #879649] Thu, 31 May 2012 16:00 Go to previous messageGo to next message
Russell Bateman is currently offline Russell Bateman
Messages: 3225
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 5/31/2012 9:26 AM, Flavio Palumbo wrote:
> Hi,
> I tried this :
> right click on the package (properties) -> Use as a source folder.
> I see the folder move down and change color.
> I delete jar file and then rebuild but nothing changes.
> I use Eclipse Java EE IDE for Web Developers.
> Version: Helios Service Release 2
> Build id: 20110218-0911

You don't need to designate any folder as "source" when it's a child of
"src" in the first place. So, this changes nothing.

So, I sent that link thinking you were having trouble seeing the
resources. If that bit works, then you're only having trouble with
showing up in the JAR?

It's not a package per se, but just a folder. When you create the JAR
via right-click on project, Export... -> Java -> JAR file -> Next, you
shouldn't change anything (until you've generated a JAR and understand
what Eclipse does by default). Set the JAR file: field to
<project-name>/jarfile-name.jar and click Finish.

The new JAR file should show up in your project, at the root.
Double-click it and you should see:

com
other stuff...
properties
still other stuff...

Is this not the case?
Re: How to include properties file into resulting jar [message #879975 is a reply to message #879671] Fri, 01 June 2012 08:15 Go to previous message
Flavio Palumbo is currently offline Flavio Palumbo
Messages: 3
Registered: May 2012
Junior Member
Sorry,
I forgot an important particular, this is a axis2 project and the target is an .aar file.
To get the resulting .aar file I do :
right click on build.xml -> run as -> ant build.
The structure of the .aar file is quite the same of a .jar file but :
- it doesn't include lib
- it doesn't include propeties files
- it puts in the meta-inf folder the service.xml and .wsdl files
Previous Topic:BIRT Drill Down
Next Topic:Mac Downloads Wrong JUnit in Tutorial
Goto Forum:
  


Current Time: Sat Oct 25 17:44:13 GMT 2014

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

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