<![CDATA[
final Project project = ...//you should have it
final ModuleManager mgr = ModuleManager.getInstance(project);
final Module[] modules = mgr.getModules();
final Module module = modules[0]; //or choose the one you want
final ModuleRootManager mrm = ModuleRootManager.getInstance(module);
final VirtualFile[] files = mrm.getFiles(OrderRootType.CLASSES);
//now you have a set of VirtualFiles that you need to convert to Files
final ArrayList paths = new ArrayList(files.length); //we will add them here
for (int i = 0; i < files.length; i++) {
final VirtualFile virtualFile = files+;
final FileType fileType = ftmgr.getFileTypeByFile(virtualFile);
if (!virtualFile.isValid())
continue;
if (!virtualFile.isDirectory() && !fileType.equals(FileType.ARCHIVE))
continue;
final File file;
final VirtualFileSystem fileSystem = virtualFile.getFileSystem();
if (fileSystem instanceof LocalFileSystem)
file = new File(virtualFile.getPath().replace('/', File.separatorChar));
else if (fileSystem instanceof JarFileSystem) {
final JarFileSystem jarFileSystem = (JarFileSystem) fileSystem;
try {
final ZipFile jarFile = jarFileSystem.getJarFile(virtualFile);
file = new File(jarFile.getName());
} catch (IOException e) {
LOG.info("error getting jar file: " + e);
continue;
}
} else
continue;
if (fileIsValid(file))
continue;
paths.add(file);
}
]]>
Thanks for reply.
This code gives list of all packages. I need "Path Variable". It is a new feature in 4.0.3 IntelliJ keeps it in .../config/options/path.macros.xml
Yuriy.
Sorry, I thought you mean classpath.
BTW in my 4.5 RC III this file is almost empty: