devxlogo

Knowing the Temp Location in Your Environment

Knowing the Temp Location in Your Environment

You may want to know the temp location in your environment to use it for some purpose during the execution of the program. Here is the code to help.

public class KnowTempLocation{   public static void main(String args[])   {      KnowTempLocation knowTempLocation = new KnowTempLocation();      knowTempLocation.proceed();   }      private void proceed()   {      System.out.println("Your TEMP location is " + System.getenv("TEMP"));   }}/*Expected output:[root@mypc]# java KnowTempLocationYour TEMP location is /var/tmp/*/

devx-admin

Share the Post: