java - Creating a text file and making it appear on desktop -


I've used this code to create an empty Tekstfail but it is only stored in the project folder I want to know How do I show the text file on the desktop?

  public void Nyafail Creator (string filename) {file OB = name of the new file (file + ".txt"); Boolean filecreated = false; Try {filecreated = ob.createNewFile (); } Hold (IOException e) {System.out.println ("error" + e); } If (filecreated = true) {System.out.println ("create an empty file" + ob.getPath ()); } Else {System.out.println ("Failed to create empty file" + ob.getPath ()); }}    

If you provide it to the directory path to the desktop, but also on the Depending on the system. For example, on my Linux machine, I ~ / Desktop can I when you do this, the / Do not forget to use // to avoid

Comments

Popular posts from this blog

Out of index C/C++ -

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

java - Projects which are accessed via multiple (different) IDEs: Ant or Maven? -