title: Java JAR protection
body: <p>I've coded a Java app and I plan to distribute it online. Each release will be locked with a secret serial key I made.</p>
  
  <p>I need to secure my jar file from decompiler etc.  Here is what I've done so far:</p>
  
  <ol>
  <li>User enters his serial key into a form</li>
  <li>The serial is sent to my dev server through a php script</li>
  <li>The script generates a new jar bin file which is encrypted in AES 128</li>
  <li>My "loader" downloads the jar file as bytes and decrypts it.</li>
  <li>It invokes the main method.</li>
  <li>User can use the app as he like to</li>
  <li>User close the app</li>
  <li>The cache is cleared and everything returns to step 1 or before.</li>
  </ol>
  
  <p>I've made the steps 1 to 3, but I need to know if it is possible to make a custom classloader that grabs bytes from HTTP, decrypts them and invokes the main method. As the file is fully crypted (saved as bin on the PHP server), I can't use a basic class loader.  About step 8, is it possible to unload content from the computer's memory?</p>