• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Date Problem in Trail version of my Java application

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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";

}
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
aditya mrigank
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
*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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic