How to get the temporary file path in Java?

an Example for to get the temporary file path in Java

package com.nourit.javaIO;


public class GetTempFilePath {

  public static void main(String[] args) {
    try {
      // create a temp file
      File temp = File.createTempFile("nouritTemp-file-name", ".tmp");
      // Get tempropary file path
      String absolutePath = temp.getAbsolutePath();
      System.out.println("Temp file path : " + absolutePath);

    } catch (IOException e) {




Temp file : C:\Users\MOHAME~1.PRO\AppData\Local\Temp\nouritTemp-file-name7955618864583162693.tmp



IT Training Center for Java and Web technology. If you enjoy and like our tutorials and believe in our mission, Please Subscribe us on Youtube and follow us on Twitter, or befriend us on Facebook or Google Plus.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.