How to protect the class files inside jar file.

Hi Group,
pls help me.
my need is i created a executable jar file with certain classes.
and i'm supposed to send it to my client.
but if the client needs he can extract the class files from the jar and with the
help of some decompilers he can convert class file to .java source code and read the whole
stuff.
how can i protect my jar file from these.
is there any security mechanism for that
pls help me.
Regards,
Ranjith.M

In order to protect my jar file I tried the jar signer technology but it only protects the jar from modification so I need to know how to protect jar file from decoding of the contents inside.

Similar Messages

  • How to combine the classes from 2 jar files into 1?

    Hi there
    I have got 2 jar files with the same name but the classes that they contain are different. So, I want to combine those 2 files into 1. Could anyone please tell me how to add the classes in a jar file to another jar file?
    Thanks for your help!
    From
    Edmund

    The jar utility allows you to extract files as well as put them into a jar. This is in the java docs.
    You might have to hand modify the manifest file if it was hand modified in the first place. All you should have to do is copy the text from one file to another. The manifest will have the same name so you will have to extract to different dirs so it isn't overwritten.
    Steps:
    -Create dir1 and dir2
    -Extract jar1 into dir1, Extract jar2 into dir2.
    -Manually examine manifests and combine if needed.
    -Copy files from one dir to another.
    -Use jar tool to create new jar.

  • Classnotfoundexception eventhough the class is inside jar

    Hi guys,
    I encountered weird problem where sometimes it throws classnotfoundexception eventhough the class is inside jar. I terminate the program and start it again then it works fine. I compiled the jar using ant
         <target name="compile" depends="clean" description="">
               <echo message="using java version    : ${java.version}"/>
               <echo message="using ant.java.version: ${ant.java.version}" />          
                 <javac srcdir="${src.dir}"
                        destdir="${build.dir}"
                        debug="on"
                        source="1.5"
                              excludes="com/csg/cs/mud/junit/*"
                 />
                <jar destfile="${mmd.jar}"
                     basedir="${build.dir}"
                     excludes="org/css/cs/mmd/juni*,org/css/cs/mmd/utility/MDDClient.class"
                />          
         </target> it shows :
    *[echo] using java version : 1.5.0_04*
    *[echo] using ant.java.version: 1.5*
    and I deployed this jar to sun solaris (SunOS sg123-456 5.8 Generic_117350-44 sun4u sparc SUNW,Ultra-80) and sun solaris box is using jre1.5.0_06.
    Appreciate any advice please. thanks in advance!
    Cheers,
    Mark
    Edited by: kmthien on Aug 2, 2010 3:05 AM

    Is it public?
    Is it spelt correctly, and the same, in the jar file and the code?
    Is it in its correct package in the jar file?
    Why are you excluding a class from the jar file?

  • How to load all the classes in a JAR file at runtime?

    Any clues o:
    "How can I force JVM to load all the classes in a specified JAR at once?"
    Thanx!
    -Rajeev

    Well I was thinking may be there exists an option with "java", when I
    am starting an application from a jar file, I could force it to load all
    the classes in the JAR. I don't want to do it programically. Is there such
    an option available?? Or in other words can I ask JVM to not do the dynamic
    loading for the JAR??
    Thanx.
    List all JarEntries and convert the paths to fully
    qualified class files
    e.g file in jar
    [1] /com/mycompany/proj/X.class
    should become
    [2] com.mycompany.proj.X
    then for each entry issue
    Class.forName( [2] );

  • How to access all the classes in a jar file

    hai
    i have a custom built JAR file which has many classes(Translets) in it . i want to access the classes inthe JAR file in a JSP page or an servlet. I have tried setting the classpaths etc , but nothing has happened.
    Where should the jar file be Palced - i am using Tomcat Server.
    How Can i Access the class files .. Very Urgent .. Please Help me ..
    Peter Iyer

    What is showing a file not found error? The web browser? if so, that's probably not a problem with the jar file.
    Also, have you expanded your jar file to make sure that you jarred it up correctly?

  • How to protect the .class files from decompilers

    Hi all,
    I have developeed an application and I want it to be protected from the decompilers. The problem that I am facing now is that the .class files can be ripped by using the decompiling softwares.
    It will be great if any body cvan bail me out of this.
    Thanks
    kvmp

    Obfuscating your files is your best bet. This has been discussed to death, both here and on every other Java-related discussion site and newsgroup since about 1996; a Google search on "Java obfuscation" should help.
    You can also look here for an overview:
    http://mindprod.com/jglossobfuscator.html#OBFUSCATOR
    Grant

  • How do I import classes in a jar file?

    I have the following directory structure, each directory is a seperate package of the same name as the directory
    RPGUniversal
    RPGMap
    RPGCharacter
    RPGCharacter is not done yet so I am ignoring that package for now.
    RPGCharacter and RPGMap both depends on classes inside the RPGUniversal Package, but are independant of eachother and RPGUniversal is completely independant.
    I want to place each package in it's own .jar file for use as a library in later programs.
    I placed all the compiled classes for RPGUniversal inside the proper directory structure, I then used this command to place it in a jar:
    jar -cf ./RPGUniversal.jar ./RPGUniversal/*
    I then tested the contents with this command:
    exodist@Abydos:/stuff/JProject/test$ jar -tf RPGUniversal.jar
    META-INF/
    META-INF/MANIFEST.MF
    RPGUniversal/ADTs/
    RPGUniversal/ADTs/t1.jpg
    RPGUniversal/ADTs/t2.jpg
    RPGUniversal/ADTs/t3.jpg
    RPGUniversal/ADTs/t4.jpg
    RPGUniversal/ADTs/Coordinates.class
    RPGUniversal/ADTs/RPGImage.class
    RPGUniversal/ADTs/FrameSet.class
    RPGUniversal/ADTs/ImageTester.class
    RPGUniversal/Exceptions/
    RPGUniversal/Interfaces/
    RPGUniversal/Interfaces/RPGCharacter.class
    RPGUniversal/Interfaces/RPGItem.class
    RPGUniversal/Interfaces/RPGObject.class
    RPGUniversal/Interfaces/Trackable.class
    RPGUniversal/Interfaces/Tracker.class
    RPGUniversal/Interfaces/RPGMapComponent.class
    RPGUniversal/Interfaces/RPGMap.class
    so far all good, next I delete the RPGUniversal directory leaving the only file in the current directory RPGUniversal.jar
    next I create the RPGMap directory and give it the proper .java files and directory tree.
    I then run a script to compile every .java file
    for i in `find ./ -name "*.java"`; do javac "$i"; done
    and I get a ton of dependancy errors:
    exodist@Abydos:/stuff/JProject/test$ for i in `find ./ -name "*.java"`; do javac "$i"; done
    ./RPGMap/BaseClasses/StaticMap.java:13: package RPGUniversal.Interfaces does not exist
    import RPGUniversal.Interfaces.*;
    ^
    ./RPGMap/BaseClasses/StaticMap.java:20: cannot resolve symbol
    symbol : class RPGMap
    location: class RPGMap.BaseClasses.StaticMap
    public abstract class StaticMap implements RPGMap
    ^
    ./RPGMap/ComponentClasses/MapTile.java:9: package RPGUniversal.Interfaces does not exist
    import RPGUniversal.Interfaces.*;
    ^
    ./RPGMap/ComponentClasses/MapTile.java:10: package RPGUniversal.ADTs does not exist
    import RPGUniversal.ADTs.*;
    ^
    ./RPGMap/ComponentClasses/MapTile.java:16: cannot resolve symbol
    symbol : class RPGObject
    location: class RPGMap.ComponentClasses.MapTile
    public class MapTile implements RPGObject
    ^
    ./RPGMap/ComponentClasses/MapTile.java:19: cannot resolve symbol
    symbol : class RPGImage
    location: class RPGMap.ComponentClasses.MapTile
    private RPGImage MyImage;
    ^
    ./RPGMap/ComponentClasses/MapTile.java:31: cannot resolve symbol
    symbol : class Coordinates
    location: class RPGMap.ComponentClasses.MapTile
    public boolean CheckForCollision(Coordinates C)
    ....the list goes on........
    how do I tell it to look inside the RPGUniversal.jar file to find the required classes?
    here is a directory tree so you can see how it is set up:
    ls -R1
    RPGMap/
    RPGUniversal.jar
    ./RPGMap:
    BaseClasses/
    ComponentClasses/
    ExternalInterfaces/
    HigherClasses/
    InternalInterfaces/
    ./RPGMap/BaseClasses:
    StaticMap.java
    ./RPGMap/ComponentClasses:
    MapTable.java
    MapTile.java
    TableList.java
    TileSet.java
    ./RPGMap/ExternalInterfaces:
    ./RPGMap/HigherClasses:
    DynamicMap.java
    ./RPGMap/InternalInterfaces:

    The JAR file needs to be in the compliers classpath : javac -classpath "$CLASSPATH:RPGUniversal.jar" "$i"

  • How to add my class into rt.jar file?

    Hi, everyone!
    I am using WinRAR to extract the package rt.jar and added
    my class file to javax folder. Then I use jar c0vf to create
    a package. After that, I restart my WSAD4.0.2. But it seems
    that WSAD4.0.2 can not be started. (It stops at the welcome
    screen for a long time.)
    Anything wrong I have made? How to resolved the reouble?
    Cheers,
    George Ma

    Thanks!
    Do you know how to add .class file to a project of WSAD4.0.2?
    I use CLASSPATH, but always failed in IDE. But it works in
    command line environment. I want to use some classes in a
    .class file.
    Can you help?
    Cheers,
    George

  • How to interpret the class tag in tld file( in jdeveloper)

    Hi,
    I am getting the following error in one of my sample jsp program :
    Error(23): Unable to instantiate tag: my:findBook (class: jsp2.examples.simpletag.FindBookSimpleTag) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.
    Error(23): Unable to find class for bean: null defined by tag with class: jsp2.examples.simpletag.FindBookSimpleTag
    when it runs the following line :
    <%@ taglib prefix="my" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
    actually jsp2-example-taglib.tld contains the following code :
    <tag>
         <description>Populates the page context with a BookBean</description>
    <name>findBook</name>
         <tag-class>jsp2.examples.simpletag.FindBookSimpleTag</tag-class>
         <body-content>empty</body-content>
         <attribute>
         <name>var</name>
         <required>true</required>
         <rtexprvalue>true</rtexprvalue>
         </attribute>
    </tag>
    I do not understand the meaning of jsp2.examples.simpletag.FindBookSimpleTag.
    can anyone explain this to me ?
    Thanks in Advance !!!
    BR
    Anurag

    Hi,
    Thanks !!
    How did you find that it is j2ee 1.4 ?
    can you comment why I am not able to see the data in the form . The following is thecomplete jsp file code :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"
    errorPage="/general_error_page.jsp"%>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib prefix="my" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    <title>JSP 2.0 Examples</title>
    </head>
    <body>
    <h1>JSP 2.0 Examples - Book SimpleTag Handler</h1>
    <hr>
    <p>Illustrates a semi-realistic use of SimpleTag and the Expression
    Language. First, a &lt;my:findBook&gt; tag is invoked to populate
    the page context with a BookBean. Then, the books fields are printed
    in all caps.</p>
    <br>
    <b><u>Result:</u></b><br>
    <my:findBook var="book"/>
    <table border="1">
    <thead>
         <td><b>Field</b></td>
         <td><b>Value</b></td>
         <td><b>Capitalized</b></td>
         </thead>
         <tr>
         <td>Title</td>
         <td>${book.title}</td>
         <td>${my:caps(book.title)}</td>
         </tr>
    </table>
    </body>
    </html>
    BR
    Anurag

  • How to set the classpath for external .jar files after importing?

    Hi techs,
    How to set the classpath in WSAD5.1.2 after importing the .jar file to the WEB-INF/lib folder.
    urgent

    I got it.
    after importing the jar file to the perspective,we need to right click on project name, go to proprties,
    goto java build path,
    there we need to include the external jar files.

  • How to know the class name in .ser file?

    Hi,
    I have a .ser file, could any expert help me to find out all the classes in the .ser file? Thanks!

    If you have written them as Object, then you can just read them one by one with an ObjectInputStream and when you have the object, you can print out the class name:
    Object o = in.readObject();
    if (o != null)
      System.out.println(o.getClass().getName());
    else
      System.out.println(null);

  • Validating xml-files inside jar-files  for JWS

    I want to use xml-files inside a jar-file and want to validate them with dtd-files,
    located in the same jar-file. This does work, but only as long as the dtd-file is
    in the same directory as the xml-file.
    For example, I have no problem, with a DOC Type-statement like
    <!DOCTYPE questestinterop SYSTEM "ims_qtiv1p1.dtd" >
    With this statement, however, one needs an approprate dtd in every directory containing an XML-file of that type.
    If however i want to gather the necessary dtd's in a directory one (or more) levels above with a DOCTYPE-statement of the form
    <!DOCTYPE questestinterop SYSTEM "../ims_qtiv1p1.dtd" >
    I get error messages of the form
    java.io.FileNotFoundException: JAR entry Mikro/Marshall/BookQuestions/../ims_qtiv1p1.dtd not found in C:\Dokumente und Einstellungen\wreiss\Anwendungsdaten\Sun\Java\Deployment\javaws\cache\http\Dwiwi.upb.de\P80\DM~vwl08\DMOViSS\DMoviss_current\RMMikro.jar
         at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
         at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Source)
         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Unknown Source)
         at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
         at org.apache.crimson.parser.Parser2.parse(Unknown Source)
         at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
         at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
         at oviss.competenceCenter.XMLExpert.setElements(XMLExpert.java:245)
    though the dtd-file is in the parent-directory (inside the jar) and the unpacked xml-file can be successfully validated.
    Why does this happen. How can one use a single dtd for multiple xml-files (of the same type) in different directories?.
    Thanks
    Winfried Reiss

    In reply to myself, replacing the HTMLBrowser constructor with this;
    public HTMLBrowser()
                  URL url;
                  try
                       // Construct the URL
                       url= this.getClass().getResource('/'+dir+'/'+startPage);
                       setPage(url);
                  catch (Exception e)
                  System.out.println( "Problem setting help homepage");
                 setEditable(false);
                 addHyperlinkListener(new LinkListener(this));
            }made it work. This is because seemingly you need '/' at the start of the resouce's path and '/' as the separator, regardless of platform.
    I hope this helps someone else.
    John

  • Accessing classes in external jar files

    I have a jar file called main. I want it to be able to acces the classes in another jar file say test.jar how do i do this.
    Thank you

    ok, if i have this right...
    you have 2 directories that hold 2 .jars, right?
    plugins/ -------- build/plugins .jar
    systemModuals/ ------- DiaryUI and Loader .jar
    Your main JAR is diary?
    Diary.jar
    you want Diary to run with the jars inside plugins and systemmoduals?
    you set the "class-path:" tag like this....
    write this manifest file. save it as Manifest.txt and put it in your home dir.
    Main-Class: YourMainClass
    Class-Path: Diary.jar plugins/this.jar systemmoduals/diaryui.jar
    <make sure to hit enter, go to the next line>
    command line to your parent directory.
    jar cmf Manifest.txt Diary.jar build/main/*.class
    you should be set to go.
    use
    jar xf META-INF/MANIFEST.MF
    to read the present manifest that netbeans has created
    if necessary

  • Is it possible to load classes from a jar file

    Using ClassLoader is it possible to load the classes from a jar file?

    URL[] u = new URL[1] ;
    u[0] = new URL( "file://" + jarLocation + jarFileName + "/" );
    URLClassLoader jLoader = new URLClassLoader( u );
    Object clsName = jLoader.loadClass( clsList.elementAt(i).toString() ).newInstance();
    I get this error message.
    java.lang.ClassNotFoundException: ExceptionTestCase
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
    // "file://" + fileLocation + fileName + "/" This works fine from a browser.
    Is there anything I am missing? Thanks for the reply.

  • How to get the class file of jar file

    hello all,
    is there any way to get the class file of jar file,as we have when we compile a java file we get class file
    same do we have any option to get the class file of jar file

    A jar file is a zip archive, so you can uznip it or extract the contents with the command "jar" - if it is what you need.

Maybe you are looking for