Results 1 to 3 of 3
  1. #1
    tgoossens is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Lightbulb Best choice? Edit bytecode (asm) or edit java file before compiling

    Goal

    Detecting where comparisons between and copies of variables are made
    Inject code near the line where the operation has happened
    The purpose of the code: everytime the class is ran make a counter increase
    General purpose: count the amount of comparisons and copies made after execution with certain parameters

    2 options

    Note: I always have a .java file to begin with

    1) Edit java file

    Find comparisons with regex and inject pieces of code near the line And then compile the class (My application uses JavaCompiler)

    2)Use ASM Bytecode engineering

    Also detecting where the events i want to track and inject pieces into the bytecode And then use the (already compiled but modified) class

    My Question

    What is the best/cleanest way? Is there a better way to do this?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,585
    Rep Power
    25

    Default Re: Best choice? Edit bytecode (asm) or edit java file before compiling

    Can you explain what you are trying to do?
    And why changing the source and recompiling is a problem.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Best choice? Edit bytecode (asm) or edit java file before compiling

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

Similar Threads

  1. Edit conf file
    By bikashlama in forum New To Java
    Replies: 1
    Last Post: 12-29-2011, 01:02 PM
  2. Delete and edit data in xml file using JSP
    By gurpreet.singh in forum JavaServer Pages (JSP) and JSTL
    Replies: 6
    Last Post: 03-10-2011, 08:07 AM
  3. Read and edit text file
    By VinTiger in forum New To Java
    Replies: 5
    Last Post: 05-14-2009, 01:18 AM
  4. Manually edit volume of MIDI file in Java
    By Ravaa in forum New To Java
    Replies: 1
    Last Post: 03-04-2009, 05:57 PM
  5. Replies: 1
    Last Post: 11-10-2008, 09:49 AM

Tags for this Thread

Posting Permissions

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