Can anyone tell me how I can make a file recognised by my plug in project. I have one pom. xml file in my project path like "AA/pom.xml" and I was able to copy this file and make a new one in another location. But when I'm tying to do the same thing in my plug in project, I'm getting FileNotFoundException.
Below is the code which works in a simple java project but not in eclipse plug in project.
private void createPomFile(String location, String projectName, String string) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("\\pom.xml"), "UTF-8"));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(location + projectName + string), "UTF-8"));
String line = null;
while ((line = reader.readLine()) != null) {
writer.write(line);
writer.write("\n");
}
// Close to unlock.
reader.close();
// Close to unlock and flush to disk.
writer.close();
}
StackTrace:
java.io.FileNotFoundException: \pom.xml (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at createservicestemplate.wizards.SampleNewWizard.createPomFile(SampleNewWizard.java:320)
at createservicestemplate.wizards.SampleNewWizard.doFinish(SampleNewWizard.java:288)
at createservicestemplate.wizards.SampleNewWizard.access$0(SampleNewWizard.java:118)
at createservicestemplate.wizards.SampleNewWizard$1.run(SampleNewWizard.java:86)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)