I have an application which inspects JAR files and performs some action afterwards. The JAR file needs to be choosen via a JFileChoser dialog. How can I add this choosen JAR file to the CLASSPATH automatically after it has been chosen?
I tried to use
Properties props = System.getProperties();
String cp = props.getProperty("java.class.path");
but the CLASSPATH doesn't seem to be changed although using System.out.println( System.getProperties("java.class.path")); shows, that the JAR has been appended to the CLASSPATH (at least to System.properties). Do I need to explicitely flush the Proeprties to be set effectively in th eenvironment?