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
Ian Wilson - 06 Nov 2006 14:38 GMT
> Hello,
>
[quoted text clipped - 3 lines]
> 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.
LaieTechie - 08 Nov 2006 08:42 GMT
> 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