Sometimes you may wish to change the default validity of a JDK keytool generated self signed certificate in your development environment. Use the argument validity to control the validity period. In the below example the validity is 10 years.
keytool -genkey -keystore yourname.keys -alias somealias -validity 3650