Wednesday, July 14, 2010

Runtime Classpath

What if you need to set all the jars placed in a folder in the classpath?

You will have to copy the names of all the jars in the folder.

Then you would open a command prompt and say

Set classpath=%CLASSPATH%;C:\opt\bea\logs\wloracle.jar;C:\opt\bea\logs\wlspy.jar;C:\opt\bea\logs\wlsqlserver.jar;C:\opt\bea\logs\wlsybase.jar;C:\opt\bea\logs\wlutil.jar;

C:\opt\bea\logs\wsclient81.jar;C:\opt\bea\logs\wsse.jar;C:\opt\bea\logs\xmlstream.jar;C:\opt\bea\logs\xmlx.jar;.;

What is you have 75 jars in a folder that oyu need to set in the classpath?

Well, here's the solution.

Simply unzip / extract this ZIP (com.zip) to any folder say "/opt/myfolder/" or "C:/test/"

open a command prompt and set the environment.

move the directory where you have extrated the zip.

Then say

java com.Classpath C:\opt\bea\logs\

Here "C:\opt\bea\logs\" is the path of the folder that contains all the jar files you need to set in the classpath.

A new command window will open with the current classpath appended with all the jars you wanted in the classpath.





Hozzat ? :D

1 comment:

  1. You know, this is pretty pointless. Starting with JDK 1.6, Java has classpath wildcards, so you can just put (for example) lib/* on the classpath.

    ReplyDelete