Licence code storing for java app

M

mark

Hello,

I want to create a app which will have something similar to licence
(i.e. user have to enter licence code to run the app). The problem
arises when I want to make it that user have to specify it only once.
So I need to store somewhere the information, that the app has already
been activated. I am thinking about main jar file (as something which
can work ,although it is nothing sophisticated), but when I add extra
characters at the end then my jar was corrupted :(. Do you know any
nice way to do this:)? Thank you!

Regards, mark
 
I

Ian Wilson

mark said:
Hello,

I want to create a app which will have something similar to licence
(i.e. user have to enter licence code to run the app). The problem
arises when I want to make it that user have to specify it only once.
So I need to store somewhere the information, that the app has already
been activated.

I'd store it in a java.util.Properties file in the user directory
appropriate for the platform.

On *nix that might be ~username/.appname.properties

On Windows that might be C:\Documents and Settings\username\Application
Data\YourCo\YourApp\appname.properties


See also java.util.prefs.Preferences.
I am thinking about main jar file (as something which
can work ,although it is nothing sophisticated), but when I add extra
characters at the end then my jar was corrupted :(. Do you know any
nice way to do this:)? Thank you!

I'm pretty sure Application jar files are not intended to be used for
storing volatile data like user preferences.
 
L

LaieTechie

when I add extra characters at the end then my jar was corrupted :(. Do
you know any nice way to do this:)? Thank you!

You cannot just add raw characters to the end of a JAR - they must be
contained in a file within that JAR. This is a hassle to do inside Java,
so follow the advice of others by creating an extra file.

One software that I use creates a text file in my home directory with a
license code (this also contains expiration information, and whether it is
a trial or purchased version). Upon invocation, this software does a
checksum on that license code (make sure it wasn't tampered with) and
extracts the other encoded information. It also sends out a broadcast
message to make sure no other copies with that same license code are
currently in use on the network.

HTH,
La`ie Techie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top