Adding All Subfolders of a Folder to the Classpath

Is there a way to specify a folder and have all the class files in that folder's subfolders loaded?
[114 byte] By [TuringPesta] at [2007-10-3 4:55:53]
# 1

I don't understand the question. If I add the folder /java/classes/ to the classpath then everything under there is on the classpath. If you had /java/classes/my/package/A.class and looked for my.package.A you'd find it. If you just looked for A then you wouldn't. What am I not understanding?

kablaira at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 2

sorry. youre right about packages (like in jars).

what if you arent using packages?

root

root/1/a.class

root/1/b.class

root/2/c.class

root/2/d.class

root/3/e.class

root/3/f.class

instead of doing

java -cp root;root/1;root/2;root/3 Program

is there a

java -cp (everything in root) Program

TuringPesta at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 3
> sorry. youre right about packages (like in jars).> what if you arent using packages?> Then you're outta luck. Why are you not using packages?
cotton.ma at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 4

> Then you're outta luck. Why are you not using packages?

eh. its not a big deal. im just prototyping this idea (a home project) and whipping something up that will be in flux for a while.

anyway, itll require a bunch of folders (the number of which will change a lot). so instead of jarring the project every night or having some obnoxious list of classpaths i was hoping there was a lazy option ; )

java -cp (oh hell just grab everything) Program

TuringPesta at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 5
Well if you need alazy option. You can write a program to traverse through the folder structure and generate a batch script which set the class path and execute your classAnd then you can execute that batch script using the Runtime.exec
LRMKa at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 6
> Well if you need alazy option. You can write a> program to traverse through the folder structure and> generate a batch script which set the class path and> execute your classI suggest calling this program ANT.:)
cotton.ma at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 7
Haha, not a totally bad idea actually.But if i went that route couldnt I just use a URLClassloader to load the classes directly rather than create the BAT and all that.
TuringPesta at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...
# 8

> Haha, not a totally bad idea actually.

> But if i went that route couldnt I just use a

> URLClassloader to load the classes directly rather

> than create the BAT and all that.

Yes you could. Why do you want to add the classes to the classpath? What's the design? Is it a plugin type of thing?

I think it will be hard to implement if you allow several "roots" at different depths. How will you know if a folder is a root, or part of a package name?

Kaj

kajbja at 2007-7-14 23:01:05 > top of Java-index,Java Essentials,Java Programming...