
When we sell a system or application sometimes customer asks for the trial version for limited days. Then we should make our application to expire when passing trial days. In this tutorial show, you to create a trial version of java product using a simple method.
Do you need help to remotely set up my any project on your machine or customize any project with your requirement please contact syntech1994@gmail.com
Here compare two dates. First set expire date using a simple date format. After comparing that date with the current date. When current date pass expires date the system display message and dies the running process. These codes should put inside the main method of the project. Follow video tutorial and bellow codes.
Video tutorial to create a trial version of java product
Put this code inside the main method of project.
Calendar expireDate = Calendar.getInstance();
// when identify month January take as 0 (y, m, d)
expireDate.set(2025, 9, 26); // set expire date you need
// Get current date and compare
if (Calendar.getInstance().after(expireDate))
{
// Die
JOptionPane.showMessageDialog(rootPane, "Sorry Your Froduct Is Expired");// Add any message to display
System.exit(0);
}
Leave a Reply