Session getProperty Example

Session class getProperty example. This example shows you how to use getProperty method.


Session class getProperty example. public String getProperty(String name) Returns the value of the specified property. Returns null if this property does not exist.

Here is the code
/*
 * @ # GetProperty.java
 * A class repersenting use to GetProperty method 
 * of Session class in javax.mail package
 * version 07 July 2008
 * author Rose India 
 */
package session;

import java.util.*;
import javax.mail.*;

public class GetProperty {

    public static void main(String args[]) throws Exception {

        Properties properties = System.getProperties();

        Session session = Session.getDefaultInstance(properties, null);

        String pro = session.getProperty("java.runtime.name");
        System.out.println("java.runtime.name : "+pro);
    }
}

Output
java.runtime.name : Java(TM) SE Runtime Environment

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US