Issue of Security about Java Source Code

At most time Java compiler compiles the *.java source code into *.class files and then pack them in *.jar files running in the Java VM or as applet running on web pages.
Recently I find a tool named cavaj that can decompile *.class files into *.java files. I tried it to decompile my *.class files and unvealed that the decompiled *.java files are the same of my source code!
How to protect the source code not to be pirated? This is a big problem about the mechanism of Java. Is there any tool to compile *.java to *.exe files? Or is there any tool that can decompile *.exe to *.java in the future?

This is a common question. If you do a search you will find many answers/solutions.
But can it affect the performance of the program? Your program mayload slight faster, but the runtime performance is the same. It may effect your performance as it takes some time to get the obsufaction right, especially if you are using reflection.

Similar Messages

  • Protecting java source code

    I heard about the possibilty of decompiling the java code and getting back the source code, is this flaw specific to java or is it common among all programming langauges?
    how is it possible to protect the source code? and how expensive is the solution?
    thank you

    Back to poster: To my knowledge, the ability tode-compile back to valid source code is unique to
    Java.
    No it's not. Any program files can be decompiledback
    to source code.
    If not their original C or C++ code, then at least
    assembly code.You cannot decompile C or C++ code to anything but
    assembler language. Which even when written by a good
    programmer is considered obfuscated by others. I
    doubt that anyone has lifted C or C++ code from
    another application using a decompiler.yes you can, all binaries can be reverse compiled, logically speaking they have to be!
    However, the readability of the output is not going to be as high as that obtained from decompiled java.
    >
    I would say that de-compilation is not a flaw in Javawhen compared to
    powerful features it has to offer. Of course it's a flaw (so I disagree with you here).
    People don't want this behavior, but it exists. As I
    stated earlier (and I'm agreeing with you on this
    one), it was an issue of priorites, and the
    developers of Java decided that it was OK because it
    allowed "powerful features"...it is a feature - whether it is a desirable feature is another argument entirely.
    >
    Here's a list of projects where the developers arenot interested in
    hiding the source code from you, in fact they let youhave it for free:
    Notice the words developers, not software companies.
    I believe in open source and participate in it when
    not bound by non-disclosure which is 99% of the time.
    But I would stand by my statement that there are no
    o software companies selling retail software that
    believe the ability to decompile Java back to Java
    source code is OK or good for them in anyway. I would
    gently suggest that providing open source code, and
    providing the ability to decompile to source code
    really don't belong in the same discussion...Protecting code is not the job of programmers, it is the job of the Law.
    rob,

  • How to read the Java source code (in Netbeans)

    I use OS X10.5.5, NetBeans 6.1 and JSE 6 on a 64 bit mac.
    When I downloaded NB6.1 it had JSE 5 as it's default (and only) java platform. I ran Software Update to get Java 6 from Apple, used the Java Prefrences utitlity to set JSE6 as default. In NB I added the JDK6 platform, registered the JDK6 javadocs and noticed that I also have the option of registering the Java source code.
    I have three questions:
    1) How do I make JDK6 the default in NetBeans. The JDK5 keeps being default after I did the steps above and I don't see anywhere to change that.
    2) How do I read the Java 6 source code? I can see sun provides [source code| http://download.java.net/jdk6/] for their supported platforms. I dont see Apple doing the same for its JDK port. What would I need to do to get to read the java SE6 sources? or is it actually hiding somewhere in the /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home hierarchy?
    3) Where does the JVM look for the binary code to run when I make a call to, say java.util.ArrayList or any other library. In my naivety I would have assumed it would be a .class file somewhere in the java Home folder, but I don't see anything like it.
    thanks in advance,
    chris

    This is taken from the help included with netbeans. In response to question 1.
    By default, the IDE uses the version of the Java SE platform (JDK) with which the IDE runs as the default Java platform
    for compilation, execution, and debugging. You can view your IDE's JDK version by choosing Help > About and clicking the
    Detail tab. The JDK version is listed in the Java field.
    You can run the IDE with a different JDK version by starting the IDE with the --jdkhome jdk-home-dir switch on the command line
    or in your IDE-HOME/etc/netbeans.conf file. For more information, see IDE Startup Parameters.
    In the IDE, you can register multiple Java platforms and attach Javadoc and source code to each platform. For example, if you
    want to work with the new features introduced in JDK 5.0, you would either run the IDE on JDK 5.0 or register JDK 5.0 as a
    platform and attach the source code and Javadoc to the platform.
    In  , you can switch the target JDK in the Project Properties dialog box. In  , you have to set the target JDK in the Ant script itself,
    then specify the source/binary format in the Project Properties dialog box.
    To register a new Java platform:
    Choose Tools > Java Platforms from the main window.
    Click New Platform and select the directory that contains the Java platform. Java platform directories are marked with a  
    in the file chooser.
    Use the Sources and Javadoc tabs to attach Javadoc documentation and source code for debugging to the platform.
    Click Close.
    To set the default Java platform for a standard project:
    Right-click the project's root node in the Projects window and choose Properties.
    In the Project Properties dialog box, select the Libraries node in the left pane.
    Choose the desired Java platform in the Java Platform combo box.
    Switching the target JDK for a standard project does the following:
    Offers the new target JDK's classes for code completion.
    If available, displays the target JDK's source code and Javadoc documentation.
    Uses the target JDK's executables (javac and java) to compile and execute your application.
    Compiles your source code against the target JDK's libraries.
    If you want to register additional Java platforms with the IDE, you can do so by clicking the Manage Platforms button.
    Then click the Add Platform button and navigate to the desired platform.
    To set the target Java platform for a free-form project:
    In your Ant script, set the target JDK as desired in the javac, java, and javadoc tasks.
    Right-click the project's root node in the Projects window and choose Properties.
    In the Sources panel, set the level of JDK you want your application to be run on in the Source/Binary Format combo box.
    When you access Javadoc or source code for JDK classes, the IDE searches the Java platforms registered in the
    Java Platform Manager for a platform with a matching version number. If no matching platform is found, the IDE's default platform is used instead.
    See Also
    Managing the Classpath
    Declaring the Classpath in a Free-Form Project
    Stepping Through Your Program
    Legal Notices

  • Missing setup statements when exporting to java source code

    We are moving from Toplink 9i to Toplink 10g. (I know, we're a little behind the times). I saved the project in 10g checked to make sure all the settings were the same as in the 9i project. When I export the project to java source code, we're missing the following configuration setup statements.
    Has anyone else run in to this issue? (login is a DatabaseLogin object)
         // Configuration properties.
         login.setUsesNativeSequencing(false);
         login.setSequencePreallocationSize(50);
         login.setSequenceTableName("SEQUENCE");
         login.setSequenceNameFieldName("SEQ_NAME");
         login.setSequenceCounterFieldName("SEQ_COUNT");
         login.setShouldBindAllParameters(false);
         login.setShouldCacheAllStatements(false);
         login.setUsesByteArrayBinding(true);
         login.setUsesStringBinding(false);
         if (login.shouldUseByteArrayBinding()) {
              login.setUsesStreamsForBinding(false);
         login.setShouldForceFieldNamesToUpperCase(false);
         login.setShouldOptimizeDataConversion(true);
         login.setShouldTrimStrings(true);
         login.setUsesBatchWriting(false);
         if (login.shouldUseBatchWriting()) {
              login.setUsesJDBCBatchWriting(true);
         login.setUsesExternalConnectionPooling(false);
         login.setUsesExternalTransactionController(false);

    These settings are all the defaults, so not required. The project code generation no longer includes defaults.
    -- James : http://www.eclipselink.org

  • Java Source Code to UML Class Diagram

    Can anyone tell me exactly which kinds of relationships may be identified for a UML CLass diagram, directly from 'static' source code..
    Note that I am developing my own case tool which will convert from java to uml..
    At the moment, I have only managed to get Inheritance and Association relationships..
    Where Association is identified by looking at the types of all variables belonging to a class (excluding method variables etc) and if the type of the variable is non-primitive, than I have deduced it is an association relationship with that class.
    Would this be the right approach?
    Secondly I have noticed in JBuilder, it models dependency relationships by getting all the Imports at the top of the java source file, is this right?? also I have read that a dependency can be modelled by the variable types in operation arguments (paremeterS ?)..
    I would also appreciate if someone could clarify the difference betweeen Composition and Aggregation for me and explain if it is possible to identify the two relationships directly from java source code..
    Last but not least, what about multiplicity ? am I right in thinking that an instance variable is 0-1, an array declaration is seen as 0-n (fixed number) and a Vector/ data collection.. is seen as 0 - * (any number)..
    Thanks for any help,
    Regards
    Tony.

    although this post is way old it could do with a decent answer.
    some guidance can be taken from JSR26: UML Mapping for EJB
    find it a www.jcp.org
    also this research paper on consistency of reverse engineering between uml tools
    http://citeseer.nj.nec.com/545406.html
    Where Association is identified by looking at the types of all variables belonging >to a class (excluding method variables etc) and if the type of the variable is >non-primitive, than I have deduced it is an association relationship with that >class.
    Would this be the right approach?Yes. You could also say that if it is a java.* type then it would also be an attribute.
    Secondly I have noticed in JBuilder, it models dependency relationships by getting >all the Imports at the top of the java source file, is this right?? also I have >read that a dependency can be modelled by the variable types in operation >arguments (paremeterS ?)..JBuilder would be consistent with JSR26, and that's how i intend to implement in ArgoUml.
    I would also appreciate if someone could clarify the difference betweeen >Composition and Aggregation for me and explain if it is possible to identify the >two relationships directly from java source code..Composition is a stronger form of ownership. the composed class is owned only by 1 class. Its lifetime is strongly linked to its owner - ie. it is not created before its owner and it is destroyed before its owner is.
    eg. leg of a table.
    Agregation is weak ownership. the owned class may be owned by several classes.
    eg. a company is owned by many shareholders.
    Last but not least, what about multiplicity ? am I right in thinking that an >instance variable is 0-1, an array declaration is seen as 0-n (fixed number) and a >Vector/ data collection.. is seen as 0 - * (any number)..sound right.
    Alex

  • APT and Java source code generation

    Hi all,
    In many articles about APT tool, I read that it is possible to generate Java source code from annotations read by AnnotationProcessorFactory.
    I am very interesting by this possibility but I can't find an exemple (all exemples I found display informations only).
    Where can I find a concrete exemple of this functionnality ?
    Thanks
    Micka�l

    Micka�l
    I have a project on java.net that has several examples of code generation.
    Go to the project source code here.
    https://rapt.dev.java.net/source/browse/rapt/
    The ones here are quite simple
    https://rapt.dev.java.net/source/browse/rapt/src/net/java/dev/rapt/proposed/generators/
    and these packages are more complex
    https://rapt.dev.java.net/source/browse/rapt/src/net/java/dev/rapt/exploratory/#dirlist
    Check out the javadoc to see how they should be used.
    One pointer is, work out exactly what you want to generate first. Then code an example by hand, then make sure it compiles and does what you want it to do. That way you know exactly what you need to generate. It is much quicker to fix compiler and functional errors in your hand coded example, than to change the generator, recompile that, then run it to generate and compile the code.
    If you do find errors in your generated code, tweak the generated code by hand till it works, then go back and change the generator to do the right thing.
    A second point is: generate nicely formatted code, indented etc, then when it doesn't work, or doesn't even compile, you can at least read the generated code to debug it.
    Bruce

  • Error in compiling java source code in a package

    hi all...
    am having a problem in compiling a java source code:
    i have a class named 'Test' in the package 'packone'....
    i have another class named 'getTest' in the same package....
    in the class getTest i am taking a reference to Test class...
    on compiling i am getting the following error....
    cannot resolve symbol
    symbol : class Test
    The source code for the two classes are :
    package packone;
    public class Test{
    and
    package packone;
    public class getTest{
    public void me(){
         Test t = new Test();
    i have included the directory path in the classpath....
    still its not compiling .....
    please help
    thanks....

    Assume the current directory structure:
    C:\
    C:\packone...and that your classes are named Test & GetTest.
    My guess is that you're compiling within the directory C:\packone using the command "javac GetTest.java", which is wrong; You must use a path corresponding to the package-name.
    Move your command-line cursor to C:\ and type "javac packone\GetTest.java" and you'll be fine...
    Regards,
      /Håkan

  • Converting class files into java source codes

    Dear Friends,
    It is true that conversion of class files to its java source codes is possible through some software. I want to know, is there any way to protect my java source codes from viewing or copying illegally by other persons ?
    If I create JAR file from java files, can it be also convertible back to source codes ?
    Avi

    You can use code obfuscators in order to protect your code. And yes a jar file can also be decompiled.
    http://www.retrologic.com/
    http://www.2lkit.com/products/2LKitObf/
    http://www.codingart.com/codeshield.html
    http://www.drjava.de/obfuscator/

  • Java source code to compare XML based on ExamXML XML diff tool

    I’m working on a project that includes comparing XML files and I need a source code on Java to compare XML fragments.
    I’m using ExamXML from http://www.a7soft.com to compare XML files but I need the Java source code.
    Can anybody help me.

    You didn't notice there's a "Support" link on that page you referred to? Ask them for the source code. If they won't give it to you, then you are effectively asking us to give you a stolen copy of it. Don't ask for such things on this site.

  • How to beautify Java source code

    Hello!
    I'm mostly a Java developer, and I recently moved my projects to XCode. I was using jEdit previously, with a lot of plugins. I specially miss:
    * the ability to do vertical selections (jEdit, TextMate)
    * Gruntspud CVS plugin - but this can be run standalone, and I configured the default action to be /usr/bin/open so it opens the source and project files in Xcode.
    * and JavaStyle !!! This plugin "beautifies" Java source code. Sometimes, tabs are messed up and I want to clean up the code.
    Is there any JavaStyle-like plugin for XCode?

    * the ability to do vertical selections (jEdit,
    TextMate)
    Supposedly you can install 3rd party editors in Xcode. I have never done it though.
    * Gruntspud CVS plugin - but this can be run
    standalone, and I configured the default action to be
    /usr/bin/open so it opens the source and project
    files in Xcode.
    Xcode comes with a CVS plug in. Have you tried turning on SCM for your project?
    * and JavaStyle !!! This plugin "beautifies" Java
    source code. Sometimes, tabs are messed up and I want
    to clean up the code.
    I expect that a Java tool like JavaStyle would run from the command line. If so, you can probably wrap it in a script and install it in Xcode's script menu.

  • Where to download Java Source Code of Libraries?

    Hi Sir/Madam,
    Would you please tell me where can I get the Java source code of Libraries?
    Specifically for package sap.comcrmtcuserassembly.jar?
    I tried to look on to Downloads and Search but can't find it.
    Thank you very much in advance.
    -jemaru

    I've found it, the source codes are downloaded at:
    C:\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\

  • Where to find java source code on tiger?

    I'm taking a class on java, and i need to open up some of the java source code for classes like Abstractcollections and Abstractlist to see how their implementations work. Does anyone know where the java folder is located and how to open up the source on a mac? I've seen it done on windows( applications-java-java-sdk - unzip, or something like that), but it is not in the same place place on mac.
    I've searched through the folders named java but could not figure out which folder to open and how.

    Hmmm, are you trying to view the Source Code for Abstractcollections and Abstractlist, or find it, or compile it, or what exactly?
    Source code can be viewed in any text editor, but BBEdit, TextWrangler, & jEdit are really good...
    http://www.barebones.com/products/bbedit/threeway.html
    http://www.barebones.com/products/textwrangler/index.html
    http://www.jedit.org/index.php?page=download

  • How to save the user-defined Java source code

    Would you please tell me how to download all of the java source code in one software component.

    UDFs can be exported one by one as a .mte file...not at one go...

  • Generate java source cod/ contect menu

    I am new to JDeveloper, so please excuse the ignorance. I am using JDeveloper 9.0.3.10.35 and UML modelers 9.0.3.9.4. I am going through the JDeveloper tutorial( Modeling Java Classes tutorial). I design a Class model and i try to generate java source code for some of the java interfaces in the design. The tutorial sates: Choose Generate|Java from the contect menu.
    Any idea where is this mysterious conext menu? There is a generate option under model but every thing is grayed out...Any help would be appriciated.

    Thanks Lisa. The problem really was with the poor instructions provided and a tired mind. There is no "context menu" ala right click on something BTW, right clicking on the main design page does not do any thing and right clicking a class only gives the properties. Anyway, what was meant, i think is to select Java from the main menu "model" and then select Generate/Java. Now since the code is "automatically generated", the Java option was grayed out and that threw me off.
    To descover all this i re-did the whole tutorial with only one class and viola, the code was there.

  • Access Java Proposals for a java source code programmatically

    Hi,
    Problem
    Programmatically get java proposals for a java source code (not byte code) via eclipse bundle
    Description
    I am developing one eclipse osgi bundle to correct java source code automatically. I am running osgi bundle inside eclipse itself [Version: Mars Release (4.5.0)]. I am able to get java project object and a class object inside it which I want to correct. Every time I try to collect java code proposals as I put one test file which can be corrected (like duplicate imports), I receive below error:
    Java code line
    JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { problem }, proposals);
    Error description
    !ENTRY org.eclipse.jdt.ui 4 2 2015-07-27 18:57:09.196
    !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui".
    !STACK 0
    java.lang.IllegalStateException: Workbench has not been created yet.
    at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.install(ASTProvider.java:236)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.<init>(ASTProvider.java:227)
    at org.eclipse.jdt.internal.ui.JavaPlugin.getASTProvider(JavaPlugin.java:741)
    at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
    at org.eclipse.jdt.internal.ui.text.correction.AssistContext.getASTRoot(AssistContext.java:119)
    at org.eclipse.jdt.internal.ui.text.correction.LocalCorrectionsSubProcessor.addUnusedMemberProposal(LocalCorrectionsSubProcessor.java:669)
    at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:530)
    at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:316)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:378)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:339)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:335)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:468)

    Any code from org.eclipse.jdt.ui (or the non-API code in org.eclipse.jdt.internal.ui) is likely to require a running workbench. Only the code from org.eclipse.jdt.core is guaranteed to work headlessly.

Maybe you are looking for

  • Product Costing using Moving Average Price of FERT & HALB

    Dear Experts, My client wants to use Product Costing functionality by using Moving Average Price instead of Standard Price on Finished Goods & Semi Finished Goods and as per my understanding, SAP recommends to use Standard Price on FERT &  HALB. I kn

  • Can anyone tell me how to make a video clip in color transition?

    Can anyone tell me how to make a video clip in color transition like the opening of "Oh Brother where art though" ? You know the scene at the start where it starts off Black and White then as we move down the timeline it transitions to a rusty brown

  • IR Subscription - Multiple Email Address

    Hi, I need to email an interactive report to multiple email address. Is there a format to follow in entering multiple email address in the "Email Address" field if I want to add Subscription? Is it even allowed to enter multiple email address? Thanks

  • How to Run scenario from the web using HTTP web page?

    Hi guys Please let me know How to Run scenario from the web using HTTP web page? Regards Janakiram

  • Reader 9 view

    Hi, In Adobe Reader 9 how do I set the option to open all documents in "height" mode only?  I need to view the whole document not just the width.   Any advice is greatly appreciated (psychiatric advice as well!). = :-)-P(+++)===|   find a cure