Results 1 to 5 of 5
  1. #1
    jaydubeww is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default Edit Executable .jar files?

    So, I have a .jar executable file and I don't have the source code. As far as I know I can rename it with .zip, extract it, and modify the source. But, how do I make it a .jar executable with the modifications? Is it possible without the original source (Isn't all the source in the .jar executable?)

    Thanks for your help!

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Generally the source is not included in an executable. (It might be if the author intended that. Such files usually include "src" in their name).

    You don't need to rename anything. Any decent archive reader will read the jar file and extract stuff fine.

    If you don't have the source you have to decompile the class files. Google is your friend but note: this may be unfriendly towards the author of the software and it very probably *will* be no easy task (decompilers make mistakes, class and variable names are mangled, comments missing etc).

    Once you have the changed code you have to build the jar file again. If it doesn't have the build script (like it doesn't have the java source files) this is going to be more fun. There are lots of details on building executable jar files in the Packaging Programs in Jar Files section of Oracle's Tutorial.

    -----

    Basically if the code is of any complexity and it isn't yours or for any other reason you can't involve the author, my advice would be don't bother. You can post questions about it in forums like this but their nature is pretty obvious to everyone and there will be little positive response.

  3. #3
    jaydubeww is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default

    Actually, it was released under GNU Public License so I'm not doing anything illegal. Actually, all I was planning on doing was translating this program into english from german. I also looked and couldn't find any contact info for the author.

    [EDIT]
    Yeah, I looked through the jar, it's just a bunch of class files and some xml. I hope I can find a good decompiler =)
    Last edited by jaydubeww; 11-03-2010 at 03:46 AM.

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    I thought (but haven't read through the license) that availability of the source code was part of the GPL - I would dig around to see what's available on the web in case that lessens the pain of decompiling. I've had a little experience (with my own code!) of decompilers with mixed results.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,920
    Rep Power
    19

    Default

    Yes, if it's GPL then the source code must be somewhere or, well, it isn't valid GPL.

Similar Threads

  1. Replies: 1
    Last Post: 10-03-2010, 06:29 AM
  2. Packaging all files into a single executable .jar
    By ichwar in forum New To Java
    Replies: 5
    Last Post: 01-27-2010, 01:31 AM
  3. Problem Jar executable files
    By Manfizy in forum New To Java
    Replies: 6
    Last Post: 08-13-2009, 01:15 PM
  4. About Executable JAR files
    By paluee in forum New To Java
    Replies: 4
    Last Post: 03-31-2009, 07:03 PM
  5. executable files
    By akinpam in forum Advanced Java
    Replies: 10
    Last Post: 01-06-2009, 04:01 AM

Tags for this Thread

Posting Permissions

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