Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Compiled File Gets Duplicated In Source Folder
Compiled File Gets Duplicated In Source Folder [message #886105] Thu, 14 June 2012 08:56 Go to next message
Melvin Mah is currently offline Melvin Mah
Messages: 24
Registered: July 2009
Junior Member
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,
Re: Compiled File Gets Duplicated In Source Folder [message #886110 is a reply to message #886105] Thu, 14 June 2012 09:13 Go to previous message
Melvin Mah is currently offline Melvin Mah
Messages: 24
Registered: July 2009
Junior Member
I think I got the answer. Sorry.
Previous Topic:Key bindings for up and down in content assist and other popups
Next Topic:Maven2 Eclipse Plugin
Goto Forum:
  


Current Time: Fri Sep 19 19:56:28 GMT 2014

Powered by FUDForum. Page generated in 0.01607 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software