Can I read the source code of a Jar file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Can I read the source code of a Jar file

  1. #1
    Lo Guest

    Can I read the source code of a Jar file


    Hi folks,

    It's me again, I've managed to open the jar file with winzip but still cannot
    read the code from the class file. Any way to do that ? By the way, how to
    extract the jar file using the jar.exe, is it "jar fx source.jar target.txt"
    ? Thanks.


    Lo

  2. #2
    jayaramreddy Guest

    Re: Can I read the source code of a Jar file


    "Lo" <harry@startechmm.com> wrote:
    >
    >Hi folks,
    >
    >It's me again, I've managed to open the jar file with winzip but still cannot
    >read the code from the class file. Any way to do that ? By the way, how

    to
    >extract the jar file using the jar.exe, is it "jar fx source.jar target.txt"
    >? Thanks.
    >
    >
    >Lo



    You have to convert .class to .java file using tool like jad. U can even
    use javap command to view this.

    The basic command to use for extracting the contents of a JAR file is:

    jar xf jar-file [archived-file(s)]

    Let's look at the options and arguments in this command:

    The x option indicates that you want to extract files from the JAR archive.

    The f options indicates that the JAR file from which files are to be extracted
    is specified on the command line, rather than through stdin.
    The jar-file argument is the filename (or path and filename) of the JAR file
    from which to extract files.
    archived-file(s) is an optional argument consisting of a space-delimited
    list of the files to be extracted from the archive. If this argument is not
    present, the Jar tool will extract all the files in the archive.


  3. #3
    Paul Clapham Guest

    Re: Can I read the source code of a Jar file

    You can't read the code from the class files because they are binary code to
    be read by computers. They are not source code, that's in files called
    something.java. As somebody else wrote, there are tools that will convert
    class files back into an approximation of the original source, but many
    people think that doing this is stealing their intellectual property. So
    there are also tools that twist the class files so they can't be converted
    back to source as easily...

    PC2

    Lo <harry@startechmm.com> wrote in message news:39ebcf02$1@news.devx.com...
    >
    > Hi folks,
    >
    > It's me again, I've managed to open the jar file with winzip but still

    cannot
    > read the code from the class file. Any way to do that ? By the way, how to
    > extract the jar file using the jar.exe, is it "jar fx source.jar

    target.txt"
    > ? Thanks.
    >
    >
    > Lo




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center