0

I have java project with a PrintWriter class only

public class Main {

    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        PrintWriter writer = new PrintWriter("F:\\the-file-name.txt", "UTF-8");
        writer.println("The first line");
        writer.println("The second line");
        writer.close();
    }
}

whenever i run this script in IntelliJ IDEA 15.0.3 it creates a file in F:\ directory.Fine.

But if a build a .jar file in IntelliJ by Jar file Create Link

.It created .jar file but clicking it does not create text file in F:\ dir. I have tried in building it through Maven but does not create text file in F:\.I can not figure out why? help me please.

Community
  • 1
  • 1
Syed Mhamudul Hasan
  • 1,341
  • 2
  • 17
  • 45

0 Answers0