Folder in the Classpath

174 views
Skip to first unread message

Slippy

unread,
Aug 9, 2011, 4:17:24 AM8/9/11
to OOO Libs
Hello,

is it possible to put a folder in the classpath by the "code"-
property? I get an error if i want to calculate the digest.txt.
We have a properties-file in a folder which must be in the classpath
of our application.

Greetings,
Slippy

Mat Broughton

unread,
Jun 28, 2013, 6:03:12 AM6/28/13
to ooo-...@googlegroups.com, slipp...@googlemail.com
I have the same question.

You can't seem to enter a folder.  I have a config folder with a log4j file and a .properties file that I need to be on the classpath.

getDown overrides the jar manifest with the classpath command so I need to re-set the classpath manually to include my config folder.  However I can't seem to include the config folder as a "code = config" attribute. 

The option would seem to be to include it as a jvm argument.  But including  jvmarg = -Djava.class.path=config causes the main entry point (the main class) to not be found.

Does anyone know the best way to fiddle around with the classpath for non jar resources using getDown?

I may well be doing something stupid as classpath stuff always causes me angst!

getDown is great btw.  Have been using and getting angrier with JWS for a little while now so getDown could be my saviour!



Michael Bayne

unread,
Jun 28, 2013, 10:44:59 AM6/28/13
to ooo-...@googlegroups.com, slipp...@googlemail.com
Just put your config files in a jar and add that to getdown.

-- m...@samskivert.com
--
You received this message because you are subscribed to the Google Groups "OOO Libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ooo-libs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Michael Bayne

unread,
Jun 28, 2013, 10:46:37 AM6/28/13
to ooo-...@googlegroups.com, slipp...@googlemail.com
Or you can add individual files to the getdown.txt, you just can't add a folder and expect it to magically figure out what's inside and magically download it. Http does not include a "download everything in this folder" command.

-- m...@samskivert.com

On Jun 28, 2013, at 3:03 AM, Mat Broughton <m...@broughty.com> wrote:

Stephen Neal

unread,
Jun 10, 2015, 9:34:27 PM6/10/15
to ooo-...@googlegroups.com, slipp...@googlemail.com
Sorry to necro the thread...

I am converting an app to use getdown and am stuck on the resources part.

Currently the application has a resources folder in the root of the application client folder structure. The root is prepended to the classpath which ensures the resources folder and its contents are added to the classpath. The application loads the resources files from the classpath. If they are not on the classpath it does not work.

I am trying to decide the best bay to replicate this with getdown.

The first option is to create a resources jar and add it to getdown.txt.
Pros - it works :)
Cons - any time I change a single resource file the entire jar must be fetched

Another option is to specify the resources in getdown and modify the application code to load them from the system rather than the classpath.
Pros - updating/modifying individual resource files
Cons - high risk. The app is large and has a number of nooks and cranny's, stuff could break.

A third option would be to modify the classpath to prepend %APPDIR%, I haven't yet worked out how I can do this.
Pros - replicates what is happening pre-getdown so it will work
Cons - not sure if it can be done with the current getdown implementation...

I am left wondering why getdown does not have a way to add resources to the classpath. What is the rationale?

WCN

unread,
Jan 6, 2020, 4:00:45 PM1/6/20
to OOO Libs
Reviving this thread again - specifically, I'd like to implement Stephen's third option, but haven't found a way to do that.

Is there a way to add a directory to the classpath of the launched application?

Thanks,
-WCN

Michael Bayne

unread,
Jan 6, 2020, 5:23:15 PM1/6/20
to ooo-...@googlegroups.com
I just added a way to do that, a new `classpath` directive. You can now do something like:

resource = extras/a.properties
resource = extras/b.properties
classpath = extras

and the `extras` directory will be added to the classpath so that the files in it can be loaded via ClassLoader.getResourceAsStream or whatever other classpath-based loading mechanism is in use.

This is not part of any published Getdown release, so you'll have to use the snapshot version to try it. I tested it in the testapp and it seems to work as intended, but it would be great if anyone who really wanted to use this feature could confirm that it works as desired before I ship a new Getdown release.



--

WCN

unread,
Jan 7, 2020, 10:12:31 AM1/7/20
to OOO Libs
I just tried it - works great; just what I needed.

Thank You!
-C


Reply all
Reply to author
Forward
0 new messages