| | |
adding further functionality to a java program
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
•
•
I have a .jar file; in this .jar file I have many .class files but no .java files for these class files. Is it possible to add functionality to the program? If so how?
if you did write the code, you could try to decompile it, and 'add' code, but if it isn't yours, I would just write some extra classes that use the methods you want to 'improve' and that fix your problem. or, you can write some new classes that extend the older ones, and overwrite the methods you want to see executed otherwise
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 138
Agree with stultuske. You need to create something like a "wrapper" class. Lets say for example the jar file will load an employee, but you want to add a check if the employee is still active.
Create a method in your wrapper class to call the jar and load the employee, then add in your check for active into your wrapper class as well.
Create a method in your wrapper class to call the jar and load the employee, then add in your check for active into your wrapper class as well.
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
>The problem is, I am not the author of the original and as such have not clue as to what
> methods the classes have and in which class.
Then how do you propose on adding additional functionality as mentioned in your first post?
> methods the classes have and in which class.
Then how do you propose on adding additional functionality as mentioned in your first post?
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
•
•
Join Date: Oct 2007
Posts: 60
Reputation:
Solved Threads: 0
The question was is it possible? I never once implied I intended to do so. Is it possible to add functionality, if so under waht circumstance and how.
From what I can deduce from the replies, there is the suggestion that yes, if I know the classes and the methods and no if you do not know anything about them. Am I right in drawing to this conclusion?
Many thanks
From what I can deduce from the replies, there is the suggestion that yes, if I know the classes and the methods and no if you do not know anything about them. Am I right in drawing to this conclusion?
Many thanks
Yes, it's possible to "add further functionality" by composing new classes of your own that use those classes internally to extend or alter the functionality (assuming there are not licensing issues). Of course, you do need to understand the API of the other classes if you expect to do much with them, which was s.o.s's point.
If you stop to think on it a moment, you do this any time you write a program with the JDK. You utilize the existing classes in the API to build new ones of your own that offer some intended functionality.
If you stop to think on it a moment, you do this any time you write a program with the JDK. You utilize the existing classes in the API to build new ones of your own that offer some intended functionality.
Last edited by Ezzaral; Oct 27th, 2008 at 8:05 pm.
![]() |
Similar Threads
Other Threads in the Java Forum
- Previous Thread: Tabula framework : REST Server & REST Editor alpha version 0.50
- Next Thread: while loop
Views: 596 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for Java
6 android api apple applet application arguments array arrays automation binary bluetooth bold byte c++ chat class classes client code component coordinates database datagram doctype draw eclipse educational error event exception file fractal froglogic game givemetehcodez graphics gui helpwithhomework html ide ideas image ingres input integer internet intersect ip j2me java javaexcel javaprojects jmf jni jpanel jtextarea julia linux list loop map method methods mobile netbeans newbie nextline number object oracle pong print problem program programming project recursion recursive reflection scanner screen sell server set size sms socket sort sql string swing test threads time transfer tree user websites windows






