-1

I need to make a program to run only on my pc. No one should be able to copy it and run it on their computer. Is there any way in java to accomplish that?

3 Answers3

0

You can try, but you can't come up with a surefire way to prevent for example me from running it. Any security checks and obfuscations you put in place can be removed given enough time, so the only way to prevent it from being run is not to distribute it.

Of course it's quite unlikely that I (for example) would even bother attempting to crack your program, since I'm almost positive that it would be a waste of my time.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
0

Supposing you have a network adapter on the computer you want to run your program on (you have it if you can connect to the internet) and :

  • that you won't change it
  • or that you'll adapt your program when you change it

you can test, when you start the program, that :

  • the computer running your program has a MAC address (the MAC address depends on your network adapter)
  • and that the MAC address that is loaded equals your MAC address (that you've written in your program as a constant ideally in a properties file)

You get the MAC address like this :

InetAddress localhost;
try
{
    localhost = InetAddress.getLocalHost();
    byte[] macAddress = NetworkInterface.getByInetAddress(localhost).getHardwareAddress();
}
catch (UnknownHostException e)
{
    e.printStackTrace();
}
catch (SocketException e)
{
    e.printStackTrace();
}

But it's a little bit time consuming.

0

From what you're saying, you don't seem to want it to run on only one computer, but instead you seems to want to be the only one to be able to run it.

In that case, what you can do is have a ciphered application.

You create your application as you please, you cipher it with a (strong) password and you wrap it into an uncipher + launcher application. Then you delete your original application.

A good way of implementing it requires advanced techniques such as cryptography and dynamic class loading (to avoid leaving traces on the disk), and I'm not even speaking about the building system.

Olivier Grégoire
  • 33,839
  • 23
  • 96
  • 137