Last active
January 26, 2024 01:53
-
-
Save asdf913/96b0f4738b9669be2297aa3f43624cad to your computer and use it in GitHub Desktop.
How to detect current Operation System of by "java.nio.file.spi.FileSystemProvider" class and "java.nio.file.FileSystems.getDefault()" method in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.file.FileSystems; | |
import java.nio.file.spi.FileSystemProvider; | |
import java.nio.file.FileSystem; | |
public class HelloWorld { | |
public static void main(final String[] args) { | |
final FileSystem fs=FileSystems.getDefault(); | |
final FileSystemProvider fsp=fs!=null?fs.provider():null; | |
System.out.println(fsp!=null?fsp.getClass():null); | |
} | |
} |
Author
asdf913
commented
Apr 2, 2023
•
Operating System | java.nio.file.spi.FileSystemProvider implementation |
---|---|
Microsoft Windows | sun.nio.fs.WindowsFileSystemProvider |
Linux | sun.nio.fs.LinuxFileSystemProvider |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment