Thanks Tommy - I was searching all over for that java property. I thought you
had to specify each and every jar file on the classpath.
For the record, I found a workaround. I was having Spring pick up my
properties files from the classpath via :
<bean id="myPropsConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:fileOne.properties</value>
<value>classpath:fileTwo.properties</value>
</list>
</property>
</bean>
That's why I wanted to manipulate the classpath. I found another approach
that allows me to pull the properties files from the filesystem, and
configure where to pull them from in an environment variable. Like so:
<bean id="myPropsConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:${config.path}/fileOne.properties</value>
<value>file:${config.path}/fileTwo.properties</value>
</list>
</property>
</bean>
now, when I execute my jar I just have to specify "-Dconfig.path=./x/y/z" on
the java command line and it will be substituted in the Spring
applicationConext.xml
Thanks for your help on this!
Alex
tadamski wrote:
>
> Alex,
>
> I too went through this problem and hopefully I can be of some assistance
> to you. It seems you are close to a solution, but I would like to offer a
> different approach from the executable jar.
>
> Within your assembly descriptor, you can output your dependent jars into a
> desired folder
>
> <dependencySets>
> <dependencySet>
> <scope>compile</scope>
> <outputDirectory>lib</outputDirectory>
> </dependencySet>
> </dependencySets>
>
> this puts the needed jars into a lib directory in the root of your zip
> structure, provided your project modules dependencies are configured
> properly.
>
> In order to get java to use your jars, you must tell it to look for the
> specific lib directory: -Djava.ext.dirs="/path/to/lib"
>
> In order to get java to pick up properties files, they need to be located
> in the java/lib/ext directory, then append that location to the above
> perhaps like this.
> -Djava.ext.dirs="/path/to/lib";"$MY_JAVA_HOME/lib/ext"
>
> Instead of creating an executable jar, you can call your main class with
> the java command from within the script.
> java -Djava.ext.dirs="/path/to/lib";"$MY_JAVA_HOME/lib/ext"
> foo.bar.MyMainClass
>
> Hopefully this will help!
>
> ~Tommy
>
>
> alexworden wrote:
>>
>> My problem is that I need to specify an additional path to my classpath
>> that contains some properties files for the target platform. If I use the
>> -classpath, I can no-longer invoke my executable jar. I've tried just
>> setting CLASSPATH but this has no effect.
>>
>
>
--
View this message in context:
http://www.nabble.com/Packaging-an-application-that-can-be-run-tp20016263p20017365.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]