2017-07-13 40 views

回答

0

它可能會幫助你。因爲每個模塊都有自己的獨立類路徑。您可以合併項目中所有模塊的類路徑,這就是該方法所做的,但嘗試使用該類路徑不太可能導致多模塊項目中的正確行爲。

public static String getFullClassPath(Module m){ 
String cp = ""; 
cp += CompilerPaths.getModuleOutputPath(m,false); 

for(VirtualFile vf : OrderEnumerator.orderEntries(m).recursively().getClassesRoots()){ 
    String entry = new File(vf.getPath()).getAbsolutePath(); 
    if(entry.endsWith("!/")){ //not sure why it happens in the returned paths 
     entry = entry.substring(0,entry.length()-2); 
    } 
    if(entry.endsWith("!")){ 
     entry = entry.substring(0,entry.length()-1); 
    } 
    cp += File.pathSeparator + entry; 
} 
return cp; 

}