It's not a secret anymore!
The moose likes Websphere and the fly likes Classpath and folders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Classpath and folders" Watch "Classpath and folders" New topic

Classpath and folders

David Edds

Joined: Dec 06, 2004
Posts: 20

I would like it so that when I go to run a Java application (or unit test) from within WebSphere, the directory MyProject/lib is already (by default) on the classpath. This lib directory contains properties files (for log4j) that the applications require to run succesfully.

Now I can achieve this by going into the Run... dialog, selecting the Classpath tag, unchecking "Use default class path" and adding the lib folder. But since this is required for a medium sized development team involving, it would be much more convenient if the lib directory was there by default. Also by unticking the "Use default class path" check-box, any further changes that are made to the project are not picked up when the Run configuration is re-invoked.

The classpath that is specified by default, is I assume, derived from the build-path of the project. However I see no way to add a non Java source folder to the build path (indeed, why would a java compiler require this!). Does anyone know how websphere derives the default class-path and if a non java source folder can be added?

There is also a tag on the Run... dialog which specifies the "bootstrap classes". Does anyone know how this can be modified so I could add the folder?

Thanks in advance,
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33106

We work around this by putting our property files in a separate java project that is just for resources and not code. In WSAD 4, you were able to refer to a non-java project. Hopefully, they will put this functionality back in RAD 6.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
David Edds

Joined: Dec 06, 2004
Posts: 20

Yes that has worked for me. I created a Java WSAD project (a simple project seemed not to work) called "Resources" and put my .proeprties file in there. Putting a dependency on the other projects so they referred to the "Resources" project puts the project on the classpath by default and the .properties file is picked up by default.

I also put all of the dependant .jar files in "Resources" too, so it's starting to become a little large, but at least everything is located in one central location.

Thanks for the advice. It's worked in exactly the way I wanted.
I agree. Here's the link:
subject: Classpath and folders
It's not a secret anymore!