File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Date Problem in Trail version of my Java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Date Problem in Trail version of my Java application" Watch "Date Problem in Trail version of my Java application" New topic
Author

Date Problem in Trail version of my Java application

aditya mrigank
Greenhorn

Joined: Aug 27, 2009
Posts: 7
Dear Sir/mam,

I have designed the trial version for my standalone java application, i compared the system date with user's registration date when the user installs the software, the problem came in as the user changes the system date the expiry date of the software advances or can be said is affected,can any one help me in solving my problem,so that i can make my java application free of the changes made in the system date.My code goes like this , please check, exact solutions will be highly appreciated thank you.


// code for demo version to compare date
String dateQuery = "SELECT (TO_DAYS(SYSDATE())- TO_DAYS(regdate)) DATEDIFF FROM registration WHERE name='"
+ name + "' AND password='" + password + "' ";
// System.out.println(dateQuery);
st1 = (Statement) connection.createStatement();
rs1 = (ResultSet) st1.executeQuery(dateQuery);
if (rs1.next()) {
String diffdate = rs1.getString(1);

System.out.println(diffdate);

int i = Integer.valueOf(diffdate).intValue();
System.out.println(i);

if (i <= 15)

{
int j = 0;
// System.out.println(i);
// String strQuery1 =
// "select date from registration ";
// System.out.println("today's date");
String strQuery = "select * from registration where name='"
+ name
+ " 'AND password='"
+ password
+ "'";

st = (Statement) connection.createStatement();
rs = (ResultSet) st.executeQuery(strQuery);

if (rs.next()) {
if (rs.getString(1).equalsIgnoreCase(name)
&& rs.getString(9).equalsIgnoreCase(
password)) {
cst = rs.getString(13);
kst = rs.getString(14);
System.out.println("" + name);
System.out.println("" + cst);
System.out.println("" + kst);
session.put("username", name);
session.put("cst", cst);
session.put("kst", kst);
System.out.println(""
+ session.get("username"));
System.out.println("" + session.get("cst"));
System.out.println("" + session.get("kst"));
System.out.println("hello");
return "success";
}
}

}

else {
System.out.println("today's date else block");
request.setAttribute("message",
"Trial version expired");
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("C://Program Files/Apache Software Foundation/Tomcat 6.0/webapps/Pharma/batch.bat");



return "failure";

}

}

else {
request.setAttribute("message",
"username and password do not match");
return "failure";

}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
I wouldn't worry about people who change their system clock to get around trial version limitations. That's such an inconvenient thing to do, that I venture to guess that people who do that are not prepared to pay for the application no matter what. So it's not like you'd be losing a customer.

Have you looked at proper licensing solutions like the ones mentioned in http://faq.javaranch.com/java/JavaIntermediateFaq#licensing?


Ping & DNS - my free Android networking tools app
aditya mrigank
Greenhorn

Joined: Aug 27, 2009
Posts: 7
Thank You Sir for the link you sent, i went through both the resources and their source codes, please tell me how can i implement any of the two resources you have sent in my application, i am really finding it difficult to add to my code, kindly help.
Thank you
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Did you look at the TrueLicense documentation?

By the way, you could always get the actual time from a known-good resource, like a network time server, etc.
aditya mrigank
Greenhorn

Joined: Aug 27, 2009
Posts: 7
Dear Sir,

Its a standalone application so there is no question of server time to be taken, i went through the documentation of TLC, got few points and concepts from that , but was not able to add it to my application,i am still trying with license4j package, kindly help me with some other links or codes if you can either in jsp or in java, i will be very thankful to you.
Thank you
Mrigank aditya.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

*Any* application can get the time from a network time server if there's a connection to the internet. With no connection there's no way to ensure the "actual" time.

As far as TrueLicense goes: there's a tutorial PDF that seems to be pretty straight-forward; not sure what kind of info you're looking for.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Problem in Trail version of my Java application