• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modifying the bytecode of compiled application w/o the original source code

 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to preface this...I sort of do have the original source code as I used JD-gui to decompile the current WebObjects application I'm attempting to edit/upgrade. However I'm forced to use javaassist in order to make the changes I need as the code I ended up with had quite a few errors. The main file I need to change I do believe did decompile sufficiently so I'm going to attempt to swap out .class files to see if my changes can be made that way. However if that doesn't work I would like to know how I can incorporate javaassist into the application since the examples seem to point only to command line examples and I'm working with a full blown application.


Thanks for any help you can provide.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While it's hard to give definite advice w/o knowing what, exactly, you need to change about the class file, Javassist has an extensive Java API that you can use to make changes to classes programmatically. Whatever is done in the command line examples is ultimately done through Java code, so it can be incorporated into any kind of application.

While Javassist also has a low-level API for working with bytecode directly, you could also have a look at BCEL. But Javassist would be my first choice, because it also a high-level API, and BCEL is no longer being developed.
 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:While it's hard to give definite advice w/o knowing what, exactly, you need to change about the class file, Javassist has an extensive Java API that you can use to make changes to classes programmatically. Whatever is done in the command line examples is ultimately done through Java code, so it can be incorporated into any kind of application.

While Javassist also has a low-level API for working with bytecode directly, you could also have a look at BCEL. But Javassist would be my first choice, because it also a high-level API, and BCEL is no longer being developed.



In short, i need to create a new method to do what an existing method is already doing because the current interface, a java applet, is being replaced with a high tranfer protocol solution that is not natively built into the current version of the application, but of course is in the next version but that costs too much to currently upgrade too.



so yeah, replace a current functioning method with a direct action to do the same thing but the files it is working with are located somewhere else. I have most of the logic from a jd-gui decompile it's just the integrating into the existing application that is the problem.

so while I should be like for the oppurtunity it's led me to for several hours resulting in senile delusions walking in uncharted territory that I may not get out of.

yes I like emoticons.
reply
    Bookmark Topic Watch Topic
  • New Topic