public class test {
public test() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
String path = "test\\template.txt"
FileOutputStream fileOut = new FileOutputStream(path);
}
}
我只想更改我的String“path”形式的ant任务。 我能这样做吗?如果是,请告诉我如何。
答案 0 :(得分:0)
建议
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class Application {
public Application() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) throws FileNotFoundException {
if (args.length < 1) {
System.out.println("Usage " + Application.class.getSimpleName() + " template-file");
}
String pathStr = args[0];
File path = new File(pathStr);
if (path.exists()) {
System.err.println("Already a file exists at location '" + path + "'");
}
FileOutputStream fileOut = new FileOutputStream(path);
}
}