In general, what does Java mean when it returns “incorrect parameters”
•
Java
I am creating such a file
try { File file = new File(workingDir,obj.getName() + ".xls"); outputStream = new FileOutputStream(file); } catch (FileNotFoundException ex) { ex.printStackTrace(); }
I'm accepting
java.io.FileNotFoundException: ..\a\relative\path\obj_name.xls (The parameter is incorrect) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(UnkNown Source) at java.io.FileOutputStream.<init>(UnkNown Source)
What does "incorrect parameter" mean? The path name I verified exists; Shouldn't you just create file names? This is on a Windows machine The code does not have this error on UNIX based systems
to update
Verify that the file the output stream is trying to write to exists It is also verified that the file is writable After many fusses, I deleted the actual path and just passed in the file name (not required), which is valid So the problem is related to the path Do I need to escape the role in the path?
Solution
This looks like a reported bug on a Windows machine
Under normal circumstances, a path like a path with a colon (:) but no reference to a drive letter causes this message
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码