java - Create a file in tomcat -


I delete a Tomato Java web application. I want to create a file to store some JSN data in it. How do I create this file and how will this file be created?

  Enter the public Zero (User Profile profile) {JSONObject jsUser = profile.asJSONObject (); {String path = profile.getUsername () + ".json"; Flamewriter filewriter = new fir (path); FileWriter.write (jsUser.toJSONString ()); FileWriter.flush (); FileWriter.close (); } Hold (IOException e) {e.printStackTrace (); }}    

How do I create this file ...

Use standard Java I / O library to create and write files; Just like you can use a FileWriter.

... and how will this file be created?

To decide where you want the file to be.

However, you have to beware of the possibility that someone may delete your web service due to filling the file system or typing stuff on top of some (important) existing file these concerns You need a good strategy to deal with, but it will depend on the purpose of these files and the circumstances under which they are written.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -