How can I set the DefaultFileSystemProvider
to use, for example, JimfsFileSystemProvider
? The javadoc for FileSystems.getDefault()
says I need to set a system property, but when I try to do that I get a NoSuchMethodException
:
System.setProperty("java.nio.file.spi.DefaultFileSystemProvider",
"com.google.common.jimfs.JimfsFileSystemProvider");
FileSystems.getDefault();
Stack Trace:
java.lang.Error: java.lang.NoSuchMethodException: com.google.common.jimfs.JimfsFileSystemProvider.<init>(java.nio.file.spi.FileSystemProvider)
at java.nio.file.FileSystems$DefaultFileSystemHolder.getDefaultProvider(FileSystems.java:128)
....
Do I need to set up something else or is this a bug in jimfs?