Hello Everyone ,
This is my code snippet
<code>
public void executeJavaFile() {
String ts = testCaseName + ".java";
System.out.println("testcasename" + testCaseName);
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
String fr = "D:\\QA\\src\\com\\QAAutomation\\";
String sf = fr+testSuiteName;
System.setProperty("user.dir",sf);
System.out.println(sf);
String f = ts;
String gs = System.getProperty("user.dir");
System.out.println("present dir" +gs);
int result = compiler.run(null, null, null,f );
System.out.println("Compile result code = " + result);
</code>
out put :
javac: file not found: gooast.java
Usage: javac <options> <source files>
use -help for a list of possible options
Compile result code = 2
I am passing the .java file which is there in the user.dir location .But still I am unable to compile the the program . every time it is throwing file not found .
Can any one please have a look into my code and suggest me ,what required to be add into the existing code .
Thanks,
ksk