aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Opening and repackaging a Jar file in netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Opening and repackaging a Jar file in netbeans" Watch "Opening and repackaging a Jar file in netbeans" New topic
Author

Opening and repackaging a Jar file in netbeans

Nick de Waal
Ranch Hand

Joined: Feb 19, 2012
Posts: 42
Hi all,

I was hoping that someone would be able to point out a guide for me that will show/teach me how I can
  • open a Jar file with Netbeans
  • edit it
  • and then package it again


  • I tried opening it by making a new project and adding the Jar file to the library but my changes do not save.
    I realize I should know this and it may well be rather simple but for the likes of me I have not yet needed to do this
    (I am looking through my course materials and cannot find the answer, it does teach how to make a project in netbeans and then make that a jar file, but nothing about changing a Jar file in netbeans.

    any help or links would help me considerably
    Kemal Sokolovic
    Bartender

    Joined: Jun 19, 2010
    Posts: 825
        
        5

    The jar file is just another archive with .jar extension, so you can extract its content with any tool you use to open .zip or .rar files.

    But that edit part is not so clear to me. Jar file you have (probably) contains .class files, which are actually binary files and you will not find the source code in there you can edit. So what exactly you want to do with it?


    The quieter you are, the more you are able to hear.
    Nick de Waal
    Ranch Hand

    Joined: Feb 19, 2012
    Posts: 42
    Hi Kemal,

    Sorry I am finding it hard to explain this, I bought a small application off someone and he sent me it in jar file but he also sent me the source code.
    My idea was to replicate the program to see if I could do it.
    But now, I only want to change some parts to it so I was hoping there was a way I could open the program in netbeans and edit the source code and so on.
    So I guess I could just open all the source code in netbeans and then change that and save it as a new project.
    I just wanted to learn from it but because it has database as well it has now become a little daunting to me as it above my expertise.
    But I will try and dissect it.

    thank you
    Kemal Sokolovic
    Bartender

    Joined: Jun 19, 2010
    Posts: 825
        
        5

    Well, if you have a source code you can easily copy it into a new project of your own. Make sure you keep the package (folder) structure as it is in the original one you got. If you are not so familiar with building a jar from command line, once you change parts you want to change, doing Right Click (on the project in Project Explorer) -> Build, NetBeans will create a new .jar for your project.
    Nick de Waal
    Ranch Hand

    Joined: Feb 19, 2012
    Posts: 42
    Thanks Kemal,

    That's what I needed to know, I did not even realize the build command would create the jar file (oh man I have lots to learn)
    I don't have enough experience yet
    thanks for your help
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Opening and repackaging a Jar file in netbeans