Results 1 to 13 of 13
  1. #1
    marmara95 is offline Member
    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0

    Default converting jar to .class or .java

    is it possible converting jar to .class or .java? can anyone help me about this please?

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default


    First of all, welcome to Java Forum community.

    Yes you can. Used winrar and extract your jar file. You can get collection of class files.

    If you want to take Java files, use a decompiler to do it.

    By the way, why do you want to do this.... :)

    Eranga.

  3. #3
    marmara95 is offline Member
    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0

    Default

    thank you for your cooperation

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  5. #5
    Rajesh is offline Member
    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0

    Default

    go to command prompt


    Now check with src.jar file which is by default present in all jdks
    After doing this you can able to see folder with same name as jar
    file and navigate through folder you can able to see list of .java and .class files. Simillarly you can derive lot of .class and .java from jar.


    c:\>cd jdk1.6\bin

    c:\jdk1.6\bin> jar -xvf src.jar


    or use Winrar or winzip software to extract .java and .class file from .jar file

  6. #6
    marmara95 is offline Member
    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0

    Default

    yes it works. thank you very much again :) i'm beginner so i understand step by step.

  7. #7
    ram035 is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: converting jar to .class or .java

    hello guys,
    i am just started working in java,
    i had a question how can we extract the .class files from jar file ?....
    can any one explain it in detail !....

  8. #8
    ram035 is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: converting jar to .class or .java

    hello guys,
    i am just started working in java,
    i had a question how can we extract the .java files from jar file ?....
    can any one explain it in detail !....

  9. #9
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default Re: converting jar to .class or .java

    Quote Originally Posted by ram035 View Post
    hello guys,
    i am just started working in java,
    i had a question how can we extract the .class files from jar file ?....
    can any one explain it in detail !....
    Type "jar -help" and see all the details; oh, and please don't resurrect old threads for this completely unrelated question; new threads are free.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    ram035 is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: converting jar to .class or .java

    hello eranga ,

    i first extracted the jar file i got bunch of class files with help of winrar , but i want java files.

    classe files are generated by compiler ?..

    what should i have to do for .java files?....

  11. #11
    AeneasTroy is offline Arma virumque cano
    Join Date
    Oct 2012
    Location
    Indianapolis
    Posts
    20
    Rep Power
    0

    Default Re: converting jar to .class or .java

    1. You write java code in a .java file. These files are referred to as the "Source Code".

    2. The java compiler javac compiles it into a class. These aren't readable in a text editor.

    3. The class files get packed into a .jar file for distribution. These .jar files are either executable
    or they are library packages. They can be unjarred with the same file that jarred it (jar.exe)
    or another decompressor.

    4. In order to change a .class file back into a .java file, you need to decompile it. This is the opposite
    of compiling it(see step 2)

    I have never used a java decompiler before. But here is an example: JD-Eclipse | Java Decompiler

    This is a plugin for the Eclipse IDE.

  12. #12
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: converting jar to .class or .java

    Why don't you ask the author for the source?

    Do you have the author's permission to reverse engineer his work?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  13. #13
    ram035 is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: converting jar to .class or .java

    thanks Aeneas Troy ,

    i have to appreciative for your answer ,,
    i also found the de compiler "cavaj"..

Similar Threads

  1. Converting an Array to a Vector
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 08:44 PM
  2. Converting URL to URI
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 10:15 AM
  3. Converting String to Double
    By srini in forum New To Java
    Replies: 1
    Last Post: 12-24-2007, 08:03 PM
  4. Converting text file(.txt) to JPG file(.jpg) in java
    By javadeveloper in forum Advanced Java
    Replies: 0
    Last Post: 11-09-2007, 04:22 PM
  5. help with converting to JApplet
    By Simmy in forum AWT / Swing
    Replies: 2
    Last Post: 08-09-2007, 08:45 AM

Posting Permissions

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