Hi all!
Need some pointers here...
I'm basically still very new in this Java programming thing and is a bit confused in the usage of packages and stuffs like that.
I've downloaded this JFreeChart thing but realised that I'll need to make small alterations to it to customise to what I want it to do...however, I'm now sure how to then put back the changed class into the JAR file package to replace the existing one.
Grateful for advices of any sort! Thanks in advance!
Best Regards,
YJ
Replacing a class in the JAR package
Re: Replacing a class in the JAR package
Generally you shouldn't. Just extend the class you need to modify and override the methods you need to alter.
But if u really need to put the class back to the jar file, then:
1. use the jar utility in your java/bin dir
2. Jar is simply a zip archive with a manifest file (it's simply a text file with some meta information). So, use your favourite zip archiver to repackage the dir. You can omit the manifest file, but generally that't not a good style
Cheers
But if u really need to put the class back to the jar file, then:
1. use the jar utility in your java/bin dir
2. Jar is simply a zip archive with a manifest file (it's simply a text file with some meta information). So, use your favourite zip archiver to repackage the dir. You can omit the manifest file, but generally that't not a good style
Cheers
Re: Replacing a class in the JAR package
BTW, if smth in my previous post doesn't make sense to u, try java.sun.com/tutorial
Re: Replacing a class in the JAR package
Thanks for the info!
think you're pretty right about not changing the package...am now trying to work another way around it....
anyway, found another method to unpack and repack the Jar files if anyone's interested:
you can open the whole thing up as a directory tree by:
jar xf xxx.jar
and make whatever alteration you want..and then wrap it up again in a new jar by:
jar cf yyy.jar
Thanks again!
think you're pretty right about not changing the package...am now trying to work another way around it....
anyway, found another method to unpack and repack the Jar files if anyone's interested:
you can open the whole thing up as a directory tree by:
jar xf xxx.jar
and make whatever alteration you want..and then wrap it up again in a new jar by:
jar cf yyy.jar
Thanks again!