File Not found exception in opening a jar file after i make the jar file using command line arguments
The problem statement:
I have a J2ME app and i have a separate struts program running. The program automatically changes the source of the J2ME app an then builds it, pre-verify it, and then package it using command line arguments. To achieve all this i have used "Runtime.getRuntime().exec" in my program. Problem is that if i introduce a delay of one sec before the command for packaging is executed, the jar file is still formed BUT accessing the jar file using the command "DataInputStream in = new DataInputStream(new FileInputStream(f));" gives me File Not found exception. "f" is the path to the jar file and i have checked it using "f.getCanonicalPath()" that its t开发者_如何转开发he right path.
I don know what the problem is. Please help me. I thank you in advance.
Are you waiting for the Process spawned by Runtime.exec()
to complete before accessing the jar file? You can use Process.waitFor()
for instance to halt the execution of your thread.
精彩评论