finding classpath from within Java program

I am generating a java file, that I want to compile using

1. com.sun.tools.javac.Main 's compile api

2. the classpath that the program which generated the java file was started with.

The compile api takes a classpath argument, which I cannot hard code but is the same as the classpath of the code which is calling the compile api. How do I figure out what classpath argument the java code, which calls javac.Main.compile, was started with?

Thanks

[479 byte] By [rahulbiswasa] at [2007-10-3 1:02:34]
# 1

In case anyone else is wondering how to do this --

there's a very simple way, thanks to my esteemed colleagues :)

System.getProperty("java.class.path")

This returns the classpath that the java program was started with. The only catch is that if you are using ant, make sure you fork. Although forking is not very advisable when you are starting a number of java processes, as that will introduce additional startup time (twice what you would have w/o ant). But in my case, I was starting only one process so this works.

rahulbiswasa at 2007-7-14 17:58:43 > top of Java-index,Developer Tools,Java Compiler...