Sample VM Arguments Examples

Sample VM Arguments Examples

While working with Java with any IDE you should have VM arguments handy so that If you need to take reference how to pass during program run. Please have some sample VM parameters:

-Denvironment.target=DEV
-Dwells.ccu.clientconfig=extend-access.xml
-Dwells.ccu.url=http://techiworks.com/
-Dwells.cluster.extend.access=true
-Dwells.ccu.serializer.config=http://techiworks.com/
-Dtangosol.pof.enabled=true
-Dtangosol.pof.config=custom-types-pof-config.xml
-Dlogging.dir=./
  • To use VM parameter in Java run time or in IDE please user prefix “-D” then key value pair. Now lets suppose you want to use VM argument inside java. Please use below:
import java.util.Properties;


public class VMProperties{
	
	public static void main(String[] args) {		
		
		System.setProperty("wells.ccu.clientconfig", "extend-access.xml");
		System.setProperty("wells.ccu.url", "http://techiworks.com/");
		System.setProperty("wells.cluster.extend.access", "true");
		System.setProperty("wells.ccu.serializer.config", "http://techiworks.com/");
		System.setProperty("tangosol.pof.enabled", "true");
		System.setProperty("tangosol.pof.config", "custom-types-pof-config.xml");
		System.setProperty("logging.dir", "./");
				
		//Print properties:		
		Properties properties = System.getProperties();		
		properties.list(System.out);
		
	}

}

Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *