Results 1 to 3 of 3
  1. #1
    otacon's Avatar
    otacon is offline Member
    Join Date
    Dec 2010
    Rep Power

    Default Protecting Source Code

    Hi guys,

    I'm trying to figure out a good way to release a preliminary version of the code I've been working on. Because its mostly supposed to serve as a demo/example, and contains ongoing and possibly sensitive research information, I only want to export a run-nable demo, without the ability to view the source code, and save the open source release for when its all set and done.

    I've been searching around for a standard/safe way to do it, but I seem to only find results on how to get to the source code from for example jar files (which seems easy enough)...but I'm looking for the opposite. Is there a simple way to generate a java executable file without making the source code easily accessible/extractable? I thought that maybe jarring does that, but apparently its very easy to extract source from jars.

    Somebody set up us the bomb.

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    The Netherlands
    Rep Power

    Default Re: Protecting Source Code

    Before you jar the code, you need to obfuscate your code. The purpose of obfuscation is to scramble your code with weird names, characters, (re)moving code so decompiling it will show only hard-to-read code.

    There are plenty tools around for obfuscation. I use yGuard (shameless plug: yGuard - Java Bytecode Obfuscator and Shrinker), which has the advantage that it fits nicely in our build with an Ant-task.

    Please note that, despite obfuscating, your code can still be read albeit very hard.
    Last edited by SurfMan; 06-08-2016 at 12:07 PM.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Protecting Source Code

    @OP: there doesn't need to be any source code in a jar file; are you afraid the class files are decompiled?

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Replies: 16
    Last Post: 01-31-2012, 08:36 PM
  2. Replies: 0
    Last Post: 08-07-2011, 08:32 PM
  3. Protecting a file
    By PrinceSendai in forum JDBC
    Replies: 1
    Last Post: 10-22-2010, 07:15 AM
  4. protecting and tracking
    By paul21 in forum Advanced Java
    Replies: 3
    Last Post: 12-18-2009, 11:36 AM
  5. Replies: 1
    Last Post: 11-28-2008, 06:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts