Compiled File Gets Duplicated In Source Folder [message #886105] |
Thu, 14 June 2012 04:56  |
Eclipse User |
|
|
|
I am currently doing some research into whether JDT Compiling can work in compiling Java classes in external folders (folders outside an RCP-app projects). After parsing a file, I have written a method using the BatchCompiler class.
private static void testJDTCompile(String commandLine, String destination){
CompilationProgress progress = null;
BatchCompiler.compile(commandLine, new PrintWriter(System.out), new PrintWriter(System.err), progress);
try {
//FileOutputStream fos = new FileOutputStream("C:\\testing_compile\\bin\\com\\test\\InvoiceClass.class");
System.out.println("destination: " + destination);
FileOutputStream fos = new FileOutputStream(destination);
fos.write(System.out.toString().getBytes());
fos.flush();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
The CommandLine parameter includes -classPath, source location of the class file etc.. The destination is the bin path where the compiled class would be placed.
The process was executed successfully but a copy of the compiled file appears inside the source folder.
One more thing is that the compiled directories and folders aren't intended to appear in the RCP-application.
The only question is whether there is a way to prevent duplicates?
Thanks,
|
|
|
|
Powered by
FUDForum. Page generated in 0.04376 seconds