setting classpath dynamically at run time

Hi all,I want to add some path to system class path property.how? it will be great, if there is a sample code.and how far changing classpath can affected by the user privilegs(limited user, admin, root, and so....)Thanks.Ahmad Elsafty
[276 byte] By [NourElsaftya] at [2007-11-26 20:55:14]
# 1
You can use the snippet below. the classPathName parameter is the fully qualified file name of the jar you want to add to your runtimeSystem.setProperty("java.class.path", classPathName);
javafricaa at 2007-7-10 2:22:46 > top of Java-index,Desktop,Runtime Environment...
# 2

The above solution appears to not work:

http://onesearch.sun.com/search/highlight/index.jsp?url=http%3A%2F%2Fforum.java.sun.com%2Fthread.jspa%3FforumID%3D32%26threadID%3D186372&qt=classpath&qt=System.setProperty&cs=false

Here http://forum.java.sun.com/thread.jspa?forumID=32&threadID=300557 is a technique that works, but has potential problems.

Do you have to set classpath after Java has started, from within Java? If not, the best way is to use a batch file that first sets the classpath for the program and then starts the program.

ChuckBinga at 2007-7-10 2:22:46 > top of Java-index,Desktop,Runtime Environment...