Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {

    public static void main(String[] args) {

        Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp");
        String tmp_file_prefix = "Swing_";
        String tmp_file_sufix = ".txt";

        //get the default temporary folders path
        String default_tmp = System.getProperty("java.io.tmpdir");
        System.out.println(default_tmp);

        try {
            //set a prefix and a sufix
            Path tmp_2 = Files.createTempFile(tmp_file_prefix, tmp_file_sufix);
            System.out.println("TMP: " + tmp_2.toString());

        } catch (IOException e) {
            System.err.println(e);
        }

    }
}