How to shorten classpath?

Dear Experts,

My app requires more and more jars in it's classpath.  Is there a way to either:

1.  Put all the jars in one jar?

or

2.  Use relative instead of absolute paths?

If neither, how do you folks handle it?

Thanks!
BrianMc1958
BrianMc1958Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_eeCommented:
You could edit the classpath inside your environment to always include certain jars.  On linux the file is /etc/environment.  If this is the classpath you're talking about, then if there is a way to shorten it, I don't know how =).
0
cmalakarCommented:
In jdk 1.6, you can use "*" in a classpath to denote all the jar files inside a directory..

java.exe -classpath C:\dir\*
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

cmalakarCommented:
0
ksivananthCommented:
>>Use relative instead of absolute paths?

Yes!
0
ysnkyCommented:
to merge jar files, uncompress the JAR files and then compress again.
0
BrianMc1958Author Commented:
To cmalakar:

Your solution looks like what I've been looking for for years.  I don't use the JDK, though.  Just the JRE.  Does your solution work just with JRE6?
0
cmalakarCommented:
It is supported only in jdk 1.6

You can check out the explanation of classpath option here..

1.6 :-- http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html

1.5:-- http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html
0
cmalakarCommented:
>> It is supported only in jdk 1.6

I mean java 1.6, (both jdk1.6 and jre 1.6)
0
BrianMc1958Author Commented:
Great.  Thanks a lot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.