I have java aplication that in some point it uses javac to compile some java files Then I use reflection and .class dont exist is there a way to make the process wait until files are created in my hard disk
Sorry about my pure English
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I have java aplication that in some point it uses javac to compile some java files Then I use reflection and .class dont exist is there a way to make the process wait until files are created in my hard disk
Sorry about my pure English
Can you post the code that shows how you are calling javac?
If you don't understand my answer, don't ignore it, ask a question.
here is the code
public static void compileFiles(String path)
{
System.out.println("Class Creation Started");
try
{
Process rt =Runtime.getRuntime().exec("cmd /c start /min javac "+ path +"\\*.java");
rt.waitFor();
System.out.println("exitvalue:" +rt.exitValue());
}
catch (Exception e) {System.out.println("Unexpected exception Trying to Execute Job: " +e);}
System.out.println("Class Creation Ended");
}
Have you tried executing javac directly instead of using cmd?
Also there is a class that will do a compile via method calls.
See the API doc for the JavaCompiler interface.
If you don't understand my answer, don't ignore it, ask a question.
you need to specify the full path, not just the directory and the file name to create a file or even check it's existence. I am sure they helps you.