How to only open an existing file in java -
this question has answer here: how check if file exists in java? 19 answers i know how open file in java writing, want open if exists already. possible? i've searched around , found 2 suggestions far both don't meet needs. 1 open file appending. problem there if file doesn't exist create it. second use file.exists() first. of course not valid solution file may exist when call file.exists() not exist when go open file. want similar windows api openfile() in can pass open_existing flag such call fail file doesn't exists. exist in java? only editing question because marked duplicate. not sure why. thought pretty specific other answers , why not sufficient. so i'll restate, want open file writing. want open fail if file doesn't exist. exists() returns true if file path valid directory if file isn't there. can around usi...