In Java standalone application, you can use -D option to pass in the system properties : $ java -Dgeoip.file="/home/mkyong/geoip/test.db" test.jar In Java web application, you can pass the system properties via context-param in web.xml : web.xml <web-app> <context-param> <param-name>geoip.file</param-name> <param-value>/home/mkyong/geoip/test.db</param-value> </context-param> </web-app>

Read more How to pass System Properties in web.xml

The web.xml is a configuration file to describe how a web application should be deployed. Here’re 5 web.xml examples, just for self-reference. 1. Servlet 3.1 deployment descriptor Java EE 7 XML schema, namespace is http://xmlns.jcp.org/xml/ns/javaee/ web.xml <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> </web-app> 2. Servlet 3.0 deployment descriptor Java EE 6 XML schema, namespace is […]

Read more web.xml deployment descriptor examples

My website’s images are kept directly link (hotlinking) by other websites, it’s a thief behavior and eating my bandwidth, why don’t they copy to their own server and display it? I decided to take action to stop this happened again, this so called “hotlinking” can be stopped by “.htaccess” access control. Case Study 1. Hotlinking […]

Read more How to prevent others steal your web image (hotlinking)

Latest Eclipse IDE is required to support the hibernate tools plug-in. However my “svn+ssh” is not working correctly after updated to the latest Eclipse IDE and Subeclipse version of 1.6.x. While i initial the “svn+ssh” access connection in Eclipse IDE, i had encountered the following error message. Network connection closed unexpectedly svn: Connection closed unexpectedly […]

Read more svn+ssh hit Connection closed unexpectedly error in Eclipse – (Solution)

The following code is a JQuery javascript which will refresh the captcha image automatically wherever user clicked on it. The code is working fine in FireFox. However, when i test it in Internet explorer 6 or 7, i hit the following Active X controls warning. Your security settings do not allow Web sites to use […]

Read more JQuery hit Internet Explorer ActiveX controls warning? – Solution

The “context-param” tag is define in “web.xml” file and it provides parameters to the entire web application. For example, store administrator’s email address in “context-param” parameter to send errors notification from our web application. web.xml <context-param> <param-name>AdministratorEmail</param-name> <param-value>[email protected]</param-value> </context-param> We can get the above “AdministratorEmail” context-param value with the following java code. String email= getServletContext().getInitParameter("AdministratorEmail"); […]

Read more How to get context-param value in java?