Home>

When specified as File.exist ("C: \ tmp \ test") in Windows (local), the directory exists properly (true is returned)
Why is there a directory that does not exist (False) if I specify File.exist ("/ opt/test") in Centos?
Both should have directories ...
I would like to know if you know anything.

Applicable source code
File dir = new File ("/ opt/test");
// File dir = new File ("C: \\ tmp \\ test");
    If (! Dir.exists ()) {
        return "Dir Not Exist";
    }
Supplemental information (FW/tool version etc.)

Java Windows10 Centos7

Append

I'm not sure how to paste the image.
The actual source and the one presented here were slightly different.
I'm sorry that I put the full-width space in order to match the appearance.

The actual source is

It's like this, I didn't see it, but when I pasted it into a text editor

File dir = new File ("/ opt/scanup");
// File dir = new File ("C: \\ tmp \\ test \\ uptest");
        if (! dir.exists ()) {
            return "Dir Not Exist";
        }


It seems that tab is in the part that specifies the path like this.

Tabs deleted

File dir = new File ("/ opt/scanup");
// File dir = new File ("C: \\ tmp \\ test \\ uptest");
        if (! dir.exists ()) {
            return "Dir Not Exist";
        }


It worked as expected.

  • Answer # 1

    There are many possibilities.
    1. There is a mistake in the part that is not written here
    2. What is written here is different from what is executed
    3. Directory does not exist (typo, mistyping, etc.)

    Since there is a double-byte space, it's a compile error. In a program that is not running?