java - The system cannot find the path while createTempFile -
i exception saying 'the system cannot find path specified' while calling java function createtempfile("test", "test"). tried googling no luck. know java gets default temp path , how can not found? windows variables seem correct , changing them not affect java.
does know java gets default temp path
it read java.io.tmpdir property.
files.createtempfile("test", "test"); essentially calls java.nio.file.tempfilehelper.createtempfile(null, prefix, suffix, attrs); again calls java.nio.file.tempfilehelper.create(dir, prefix, suffix, false, attrs);. there, if dir null, set tmpdir declared follows:
private static final path tmpdir = paths.get(doprivileged(new getpropertyaction("java.io.tmpdir"))); you can set property explicitly shown in answer @joni. if not set explicitly, jvm initializes platform specific default value @ startup - see environment variable control java.io.tmpdir?
and how can not found?
if property java.io.tmpdir points invalid directory, temporary file can not created.
Comments
Post a Comment