.Jar to Java code

Hello,
I've recently found out some old jar files that i had created and i need to reverse them to get the (well, almost) original java code that i had wrote.
Is there any way to do this?
Thanks in advance

Google java decompiler
http://www.google.com/search?hl=en&q=java+decompiler&btnG=Google+Search

Similar Messages

  • Verifying signed Jar using Java code

    Hi,
    I have been looking for a way to verify signed or unsigned jar from java code.
    I have to use the jar name and from here, I have to verify the digital signature. For this goal I have found some Java classes which can be useful for me. These classes would be JarEntry class, from which I could get the certificates. Signature class, whose methods let me verify the digital signatures, and Certificate class. I also found a class called SignedObject from I could get the signature data which the method getSignature (), but the problem here it is that I need a private key in the SignedObject constructor, which is not possible since I want to verify a signed jar which I am not able to know the private key, just public key. So, could anybody tell me how I could solve this problem?
    My code would be some as shown below:
    jar = new JarEntry (location);
              jarcertificates = jar.getCertificates();
              /* We should check all the certificates
              if (jarcertificates != null){
                   for (int i=0;i<jarcertificates.length;i++){
                        sig.initVerify(jarcertificates);
                        sig.update(jar.getExtra());
                        sig.verify( DIGITAL SIGNATURE FROM JAR SHOULD BE HERE);
    I guess that I have to use jar.getExtra () in order to get the data to put in Signature.update() method but I am not sure, am I wrong?
    Thanks in advance

    Here is some sample code to verify a jar file:
            JarFile jf = new JarFile(args[0], true);
            byte[] buffer = new byte[8192];
            Enumeration e = jf.entries();
            ArrayList entries = new ArrayList();
            while (e.hasMoreElements()) {
                JarEntry je = (JarEntry) e.nextElement();
                entries.add(je);
                InputStream is = jf.getInputStream(je);
                while (is.read(buffer, 0, buffer.length) != -1) {
                    // we just read. this will throw a SecurityException
                    // if  a signature/digest check fails.
                is.close();
            }To validate the certificate chain, you can call JarEntry.getCertificates(), create a CertPath from the array of Certificates (using a CertificateFactory), and then use the CertPathValidator APIs. For more information, see the PKI Programmer's guide: http://java.sun.com/javase/6/docs/technotes/guides/security/certpath/CertPathProgGuide.html

  • Executing jar from java code, then kill parent java code

    Please suggest if there is any best way around on executing jar from java code then killing parent java code.
    a) I have desktop based java application say "Monitor.java" which runs every 5 minutes.
    b) How can I START external java application say "execute.jar" from Monitor.java THEN EXIT Monitor.java
    I tried various options using "ProcessBuilder" and calling bat file but I need Monitor (parent application to EXIT, immediately after calling child (execute.jar)
    Try1) ProcessBuilder builder = new ProcessBuilder("java -jar execute.jar");          
    Process process = builder.start();
    Try2) Runtime r = Runtime.getRuntime();
    Process p = null;
    p = r.exec(new String[] { "cmd", "/c", "start C:/temp/Test.bat" });

    I have a requirement to transfer data from one db to another db from Java Application Layer.Maybe, maye not. We get all sorts of weird "requirements" - which are nothing but thoughts or proposed solutions.
    But,
    Did the "requirement" mention whether the table existed already or not in the target database? - If not, did it tell you to create it - drop/create it?
    Did the "requirement" deliver some explanation to why this copying was neeeded? - Are we talking replication? - Or a one time cloning?
    Etc, etc,
    Personally I would always argue against a "reuirement" like that. - It just isn't the way to do it. Period.
    Regards
    Peter
    P.S: If you are satisfied with what COPY does, then you could let Java make an OS call and do it from there?

  • Is it possible to open a Jar within Java code

    Hey
    I am just wondering if it is at all possible to get java to run a Jar within the code. So the Jar is my update to my program and I have got it downloading from my site using the java code but now i want the code to open it for the user so they don't have to double click in on. Is this possible?
    Thanks

    Sure. The java.util.jar package.
    You might want to take a look at service providers:
    http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider

  • Static initialization of java code included in the Imported Archives jars?

    Hi
    Does SAP PI 7.0 support static initialization of java code included in the Imported Archives jars?
    Static block of a java class included in the Imported Archive jars throws a Runtime Exception called ExceptionInInitializationError while trying to run.
    Regards,
    RDS

    Have you tested the code outside PI?

  • Invoke jar main method in java code

    hi
    i have a jar that has a usage like this
    java -jar helper.jar arg1 arg2 etc...i want to invoke this helper main method in my java code.i've tried using reflection but it didn't quite work...
    String[] args = new String[]{"arg1","arg2"};
    Class c = Class.forName("com.helper.MainClass");
    Method mainMethod = c.getMethod("main", args.getClass());
    int mods = mainMethod.getModifiers();
    if(mainMethod.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) {
         throw new NoSuchMethodException("main");
    mainMethod.invoke(null, args);
    Exception in thread "main" java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at Test.callJarMain(Test.java:50)
    at Test2.main(Test.java:34)thoughts???

    phychem wrote:
    i want to use this jar in a non-static way.
    public void useJar(String args[]){
    //somehow invoke jar method here...
    Sorry, I still don't get it. I don't know what you mean by a non-static way of using jars. The main method for launching an application is static so if you call that method, you will be using a static method. I don't know what you mean by a "jar method" either. Methods are inside classes. So far, all I can guess is you want to invoke a method in a class that happens to be inside a jar. Since people do this all the time without reflection, I don't see the problem.

  • Running .jar files from Java code

    Hi.
    I am designing a sort of platform to run some games which are saved in .jar files. Basically this platform is a menu from which the user can select the game which he/she wants to run. It also has the feature of adding new games.
    Is is possible to run the .jar file from within java code?
    Thanks for any help!
    Krt_malta

    Just list the jar in the classpath list and call the class in the jar.

  • Can I change the Jar contents trough Java code ?

    It may seems a little bit wierd, but it could solve a lot of acessibility problms....
    Can I change/set the jar contents using java code ?
    My real problem: I'm creating a EDI Client and using a XML file as configuration file. It's running well but this XML is much exposed to unauthorized users....
    Can I set a value in this XML file if it is inside a jar file ??

    you can look at class JarOutputStream . You could also use class RunTime to just create a new jar with the proper files via the normal jar command.

  • How can i rename a jar file using only java code

    i have tried everything i can think of to accomplish this but nothing works.

    ghostbust555 wrote:
    In case you geniuses haven't realized I said I tried everything I can think of not that I tried everything. So help or shut up I realize that I didn't try everything but if you can't figure it out either DO NOT POST.
    And the question is how can i rename a jar file using java code? As it says in the title. Read.I would tell you to use the File.renameTo method, but surely that would have been obvious, and you would have tried it already? But maybe you didn't. You were kind of lacking in details in what you tried.
    And yes, I am a genius. Just don't confuse "genius" with "mind-reader".

  • Signing Jars from within Java Code

    Hi,
    I would like to sign a jar file from within my Java code. Reason for this is that I wish to update a jar file at runtime, throw away the class loader that loaded the jar, and load the updated code inside a new classloader.
    One problem, however: The jar file has to be signed before loading it. How can I do this from my Java program? Or do I need to have the jarsigner tool available at the location where I resign the jar?
    Thanks in advance,
    Ronald.

    Hi,
    In the meantime I found an answer to my problem. In rt.jar there exists a class sun.security.tools.JarSigner, which can be used for exactly this purpose. Not completely portable, but it'll do the trick.
    Ronald.

  • Execute jar from my java code

    Hi,
    My CDC application run in Windows Mobile, with Creme JVM.
    I need from my java code, run other .jar. and later, finish may application atual.
    I try like this:
    Runtime.getRuntime().exec("\\Windows\\CrEme\\bin\\CrEme.exe -jar \\Windows\\sample\\cube.jar");
    System.exit(0);
    But my second jar its not started. Anybody can help me?
    Other question, If I getRuntime(), am I using the atual instance of my JVM. If I exec other JAR, and later exit() my atual, the second jar its exit too?
    I'm building a automatic upgrade module in my application. With Hessian (Web Service), I download my new jar. But, I need have other jar, start it and close my jar atual. My second jar showld be delete my atual, rename the new jar downloaded for the standard name, and later start the jar download, how new version.
    thanks,
    Fabio
    Edited by: FabioPinheiro on Mar 28, 2008 4:41 AM

    Hi all,
    The Mr. Rene (from NSIcom) answer my question
    Just
    Add flag -mi.
    (multiple instance)
    I try and work fine.
    thanks Rene..
    Fabio

  • How to launch Jar file in Mac Os using java code??

    can anyone tell me how can i launch another jar file in my apllication using java code.

    define "launch".
    - You want to run a new java program in a separate process? (see Runtime.exec())
    - You want to run a method in a specific class in the jar? (add jar to application classpath and then simply instantiate the class and call the method)

  • OpenScript/How to add .jar file to Java Code in relative path

    Hi all,
    I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
    Things I did are as followed:
    1.Execute my .jar file in OpenScript Java code with absolute path like this:
    String cmd = "C:\Users\A.jar";
    Runtime.getRuntime().exec(cmd);
    This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
    2.Try to get its current path with following codes:
    File directory = new File(".");
    String currentPath=directory.getCanonicalPath();
    However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
    I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
    I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
    *getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
    *or getScript("ScriptName").run();*
    *Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
    Thank you very much!
    Regards,
    Angyoung

    Hi DM,
    Thanks for your reply!
    I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
    And this workaround can still work even though the script is run on other machine.
    Sorry to reply you so late!
    Regards,
    Angyoung

  • Some java code returns a null resultset from 10.2.0.1 DB, but works w/ 9.2

    I am a Java noob guys, but we have java code the calls an Oracle Function. This code is unchanged from what successfully runs against an Oracle 9.2 database returning, in this case, one row from the database. A ref cursor is used. When the same Java code calls the same ref cursor function from a 10.2.0.1 database, a null resultset occurs. The function correctly returns a single row when executed by the same database user via sql-plus. So it must be a java thing. Does the jdbc driver need to be upgraded to correctly run against a 10.2 database? And is this null resultset type of anomaly a potential result of having a wrong version of ojdbc14.jar? Nothing else has changed except pointing the code to the same package and tables in a 10.2 database.
    Thanks in advance for your comments.
    Phil McDermott

    I realize now that this is the wrong forum to post in, but I was linked here from a google search on the issue.
    I downloaded the 10.2.0.1 ojdbc14.jar from oracle, but the problem persists.
    yeesh! now what?

  • How to use Java code signing certificate in oracle 11i

    Hello,
    I am try to configure java code signing certificate in 11.5.10.2 application. we got java sign certificate from verisgin. SA's imported the certificate and created alias XXX_XXX with password and passphrase.
    I am able to see the my certificate. keytool -list -v -keystore xxx_xxxx.jks -storepass Password.
    how do I use it. I am using Enhance Jar Signing for EBS DOC ID 1591073.1.
    could you please give me some advice on it?
    Thanks
    Prince

    Hussien,
    I find out apps keystore keypassword and storepassword, I imported the java code sign certificate. I generated Jar files through adadmin, but I am getting  warning error
    adogif() unable to generate Jar Filers under JAVA_TOP.
    executing /usr/jdk/jdk1.6.0_45/bin/java sun.security.tools.JarSigner keysotre **** -sigfile CUST Signer /apps/......
    Error JarSigner subcommand Exited With status 1.
    No standard output from jarsigner JarSigner error output: Exception in thread "main" java.lang.NoClassDefFoundError: sun/security/tools/JarSigner Caused by: java.lang.ClassNotFoundException: sun.security.tools.JarSigner         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)         at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: sun.security.tools.JarSigner.  Program will exit. WARNING: The following path(s), defined in /apps2/property/product/tst/appl/cz/11.5.0/java/make/czjar.dep as elements of the output:   oracle/apps/cz/runtime/tag WARNING: Copying cztag.lst from the old fndlist.jar ...   About to Analyze flmkbn.jar : Fri Nov 22 2013 10:45:51
    Please let me know if you have any idea. Thanks Prince

Maybe you are looking for