dcsimg
 

Submitted by: M S Sridhar(sridhar.ms@gmail.com)

Friday Feb 9th 2018 by M S Sridhar

Language: Java, Level: Intermediate: - Learn how to find 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 KnowTempLocation
Your TEMP location is /var/tmp/

*/
Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved