Adding to the classpath

Discussions

EJB programming & troubleshooting: Adding to the classpath

  1. Adding to the classpath (2 messages)

    I cannot figure out how to add jar files the the classpath in Java. Can anyone help?
    Michael

    Threaded Messages (2)

  2. Adding to the classpath[ Go to top ]

    For example,

    if you wished to add ant.jar which is in the directory
    c:\ant\lib\ant.jar to the classpath,

    from a dos shell type
    c:> set classpath=%classpath%;c:\ant\lib\ant.jar

    Alternatively you can set it in your environment variables. this will save you having to set the classpath everytime you open a dos shell. Environment variables are set through the control panel -> system

    HTH,

    Brian
  3. Adding to the classpath[ Go to top ]

    Another way to add to your classpath is through the java command line.

    e.g. jar to add: c:\blah\blah.jar

    Command line:
    java -classpath %classpath%;c:\blah\blah.jar ClassToExecute

    In UNIX environments, replace %classpath% with $CLASSPATH, ';' with ':' and '\' with '/'.

    HTH

    Andy