Jar file locking, hiding source files in .jar file

I am currently working with a Java service wrapper. It works fine, I can use my executable jar to install it as a service, even go through the VM arguments when installing it as a service.

But since it will be deployed here and there, I was wondering how I can prevent people from extracting the source files found in the Jar file. Is it possible? I thought about converting the jar file to a .exe file and installed it as a service since I found several tools capable of this. But they do not seem to allow me to pass VM arguments.

Does anyone have an idea how I should go about this?

+4
source share
1 answer

Your users should be able to run your .jar file. Thus, you cannot stop them from knowing that the code is running, and it also allows you to run your code. You can only make efforts to make life difficult for the most common decompilation and reverse engineering strategies.

If you need to hide your code, here are a few options:

  • .jar files already prevent viewing of the source. Take a look in .jar and you should not see the source .java files (unless you specifically decide to include them). The .class files must be included and can be decompiled into the machine-readable equivalent of your program, but it will not be easy to read them.

  • Rewrite the program in C, and then use the confusing program at the source and compile it. It is about as locked and hidden as you can do it. Anyone who looks at your code will see a completely human-incomprehensible gibberish, which is so difficult to change to be understandable, it is much easier to just observe the behavior of the program and write a new program that simulates it.

  • Convert jar file to .exe for windows: How to convert my Java program to .exe file?

Nuclear option:

If you have the source code for an alien ship / iron man ship, and you must hide this code at all costs, you will need to remove the rights and freedoms of the user using it while using your program. No user should be able to observe or understand your program close enough to understand how it does what it does. Third parties should be involved in randomizing and confusing not only the code itself, but also understanding how the user understands the tasks. A hired goon or mal-ware can control users' use of the program and disconnect the user from the mains or destroy it themselves if they find a hint that they are trying to understand or build on your code. The source code should become self-aware and delete itself in case of suspicious behavior.

Microsoft and XBox use these strategies, eliminating the rights and freedoms of users, creating hardware and software that block themselves if you annoy motherhood. Take what a citizen can. Do not make me torment you.

+3
source

Source: https://habr.com/ru/post/1501463/


All Articles