Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post

    Java Decompiler (edit .jar files)

    I've been through Google and back. What's a good editor in which I can edit .jar files (decompiler) of Java?

    Thanks.

    (free to download, please)
    Formerly MysticScript

    6+ years club

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    There is a difference between decompiling and editing a jar content.

    A jar (java archive) as its name says is an archive or collection of java classes that are ready to be executed.

    A java decompiler is a tool that makes a reverse engineering from .class extension to .java extension.

    I do not know what is your need, anyway check how we solve both issues.

    For editing the content of the jar file (adding, removing, decompiling) you can go to the command prompt (or shell terminal for linux or unix based os) and on which you have installed the JDK not the JRE and you can write the following command:

    \etc\jdk\bin> jar

    and it will scroll down in front of you all the possible combinations of options on how to use jar (for example to explode the content of a jar you can write: jar -xvf (full path to jar file)

    On the other hand if you want to decompile a class file into a java file, you can download the jad (java decompiler) from the following url:

    http://www.softpedia.com/progDownloa...oad-85911.html

  • #3
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    I'm using Windows Vista 64-bit and that program you linked me too doesn't work. The screen flashes (cmd) for 1 sec and closes.
    Formerly MysticScript

    6+ years club

  • #4
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    It is an exe file that should be called from command prompt.

    After you explode your jar file into the following folder for example:
    com/test/MyClass.class

    you type:
    cd com
    cd test
    jad MyClass.class

    You need to make sure that jad.exe is in your classpath or in the same folder.

    Hope this helps

    besides you can simply go the command prompt and type jad
    and you will see a help how to use it

  • #5
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    But I have the .jar file. Inside it is a library of folders and iwant to edit Minecraft.class. How do i do that?
    Formerly MysticScript

    6+ years club

  • #6
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    I already told you how.
    Anyway

    you type jar -xvf jarfile.jar (make sure you are in the same folder where the jar file is)

    After that you search for your class in the hierarchy of folders and you into that folder and write:
    jad Minecraft.class

    You will have in the same folder now a file named: Minercraft.jad (simply rename it to Minercraft.java)

  • #7
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    I get:
    -xvf is not a recognizable interneral or external command .. blah blah

    I had jad.exe in the same folder as minecraft-server.jar... :S
    Formerly MysticScript

    6+ years club

  • #8
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    the command is:
    Code:
    jar -xvf jarfile.jar
    By the way I have two questions:
    1. Did you extract the files from the jar.
    2. Do you have jdk installed or only jre.


    Another thing the command jar -xvf is to UNZIP the jar file.

    Please post here the command you are using as is to see what's wrong in it.

  • #9
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    I have both jdk 6 and jre 6 installed.

    I have the .jar file on my folder. I don't know what you mean, though..

    mkay i just got some folders with classes in 'em. We're off to a good start.
    How do I recompile them back to the .jar file

    edit: dangit, i just tried editing a .class file and all i got was random symbols.
    Formerly MysticScript

    6+ years club

  • #10
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    Code:
    jar -cvf fileName.jar -C srcfolder/
    if you type simply the word jar on the command prompt you will get this result ( a full help on the usage of the command jar)
    Code:
    Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] fil
    es ...
    Options:
        -c  create new archive
        -t  list table of contents for archive
        -x  extract named (or all) files from archive
        -u  update existing archive
        -v  generate verbose output on standard output
        -f  specify archive file name
        -m  include manifest information from specified manifest file
        -e  specify application entry point for stand-alone application
            bundled into an executable jar file
        -0  store only; use no ZIP compression
        -M  do not create a manifest file for the entries
        -i  generate index information for the specified jar files
        -C  change to the specified directory and include the following file
    If any file is a directory then it is processed recursively.
    The manifest file name, the archive file name and the entry point name are
    specified in the same order as the 'm', 'f' and 'e' flags.
    
    Example 1: to archive two class files into an archive called classes.jar:
           jar cvf classes.jar Foo.class Bar.class
    Example 2: use an existing manifest file 'mymanifest' and archive all the
               files in the foo/ directory into 'classes.jar':
           jar cvfm classes.jar mymanifest -C foo/ .
    Last edited by ckeyrouz; 08-26-2009 at 04:12 AM. Reason: Additional information

  • #11
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    Right o. What's a good free .class editor?
    Formerly MysticScript

    6+ years club

  • #12
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    Personally I use Eclipse Galileo, it is not only a java text editor but an IDE oriented software (project based) so I think it will be complex for you.

    If you want something simpler try this one:
    http://sourceforge.net/projects/eje/

    It is built with Java I used to work on it a bit, but ideally Eclipse Galileo.

  • #13
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    I want to open .class files, not .java files. I tried opening .class files and I got:


    Help?
    Formerly MysticScript

    6+ years club

  • #14
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    A class file is a compiled file so you cannot read its content.

    By the way do you know java?
    Sorry for asking that but the minimum thing to know is that a java file compiles to .class file then the JRE transforms it into machine language and this is the property of java that makes it platform independant.

  • #15
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    I suggest that you start with this tutorial:

    Code:
    http://www.freejavaguide.com/corejava.htm


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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