0

Im using Java eclipse and I wanted to know how I can have a java program create a folder with a text file inside of it so I can print data into it.

I need my java program to create a folder in the C Drive called test with a text file inside - thanks if you can help!

2
  • No worries I figured it out - I just needed to create them separately! Commented Sep 9, 2015 at 18:34
  • there is lot of questions related to this.plz search first Commented Sep 9, 2015 at 18:36

1 Answer 1

0
String path = "C:\\test\\text.txt"; File f = new File(path); f.getParentFile().mkdirs(); try { f.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.