You can do it:
File f = new File(NetSimView.filename);
f.delete();
Edit regarding your comment:
The parameter NetSimView.filenameis represented File, not the Stringone that contains the file path. So simple:
NetSimView.filename.delete();
source
share