简体   繁体   English

我想使用java SE7中的java SE6来使用这段代码

[英]I want to use this piece of code using java SE6 from java SE7

I want to use this piece of code using java SE6 "Path fileName=Paths.get(filepath+filename)" which is supported in java SE 7. Tried a lot, didn't find any solution. 我想使用java SE6“Path fileName = Paths.get(filepath + filename)”在java SE 7中支持使用这段代码。试了很多,没找到任何解决方案。 Could any one suggest me in regarding. 任何人都可以建议我。

Here are the piece of code which am using, 以下是我正在使用的代码段,

Path fileName=Paths.get(file +"\\"+ repName+"_"+tdate+".PDF");
...
private static void checkFileExist(Path filePath) {
    if (Files.exists(filePath)) {
        System.out.println("Filename: " + filePath.toString());
        System.out.println("Exist in location!");
    } else {
        System.out.println("Filename: " + filePath.toString());
        System.out.println("Does not exist in location!");
    }
}

How about this which works in Java 6 and 7 这在Java 6和7中是如何工作的

File file = new File(dir, repName+"_"+tdate+".PDF");
...
private static void checkFileExist(File file) {
    System.out.println("Filename: " + file);
    if (file.exists()) {
        System.out.println("Exist in location!");
    } else {
        System.out.println("Does not exist in location!");
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM