Here you can find the source of deleteTempFiles()
public static void deleteTempFiles()
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { private static final String HOME = System.getProperty("user.home"); private static final String APP_DIR_NAME = ".OpenLaTeXStudio"; private static final String PREVIEW_SOURCE_FILENAME = "preview.tex"; private static final String PREVIEW_PDF_FILENAME = "preview.pdf"; public static void deleteTempFiles() { File source = new File(getTempSourceFile()); File tmpPdf = new File(getTempPDFFile()); if (source.exists()) { source.delete();/*w ww. j av a2 s.c o m*/ } if (tmpPdf.exists()) { tmpPdf.delete(); } } public static String getTempSourceFile() { return getAppDirectory().concat(File.separator).concat(PREVIEW_SOURCE_FILENAME); } public static String getTempPDFFile() { return getAppDirectory().concat(File.separator).concat(PREVIEW_PDF_FILENAME); } public static String getAppDirectory() { File tempDir = new File(HOME + File.separator + APP_DIR_NAME); if (!tempDir.exists()) { tempDir.mkdir(); } return tempDir.getAbsolutePath(); } }