Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7812473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:31:04+00:00 2026-06-02T04:31:04+00:00

I have written a Java bytecode parser using Haskell, and it works just fine.

  • 0

I have written a Java bytecode parser using Haskell, and it works just fine. However the next step has me completely stumped.

My Haskell program needs to modify the .class file so that, when executed, the Java program prints:

“Entering [method name here]” before executing a method, and

“Exiting [method name here]” after executing a method.

All I know is that we will need to append the constant pool and method table with calls to System.out.println, but I feel I’m still missing something.

  • What is the best way to approach this problem?
  • How do you know how to call System.out.println in bytecode?
  • How do you store the string with the name of the method, to later be called as an argument of System.out.println?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:31:06+00:00Added an answer on June 2, 2026 at 4:31 am

    Well, this is what the various byte code engineering libraries give you. ASM, BCEL, etc. The specifics of your homework is an aspect, and AspectJ does precisely that.

    Sounds like the homework is to write a Haskell byte code engineering exercise, so you will need to mod the class file yourself. Suggestion above by @biziclop is correct. Do a before and after on a class file, note the delta, and do the same yourself from Haskell.

    [ps: of course, the above “short-cut” 😛 is if you don’t feel like reading the JVM Spec (as noted in comment to your q) and figuring out how to do it as if you would if writing a Java compiler. You basically call a method by using one of the various byte codes for invoke — here an interface method call –before which you need to have the receiver e.g. static field out of class System and the method name on the stack. Details in the spec.]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a java program that is actually works as a gui to
I have written a Java UI using the SWT UI library and the MigLayout
I have written a Java GUI using SWT. I package the application using an
I have written a Java app and an NSIS installer. Works great. The issue
I have written java code for generating json of my searched data from file.But
I have written a java applet which opens a JFrame (so when run in
Background: I have written a java swing based client server application. The server is
I have written a simple Java dispatcher with a daemon thread to handle the
I have written code in Java to access web cam,and to save image... I
I have written a simple Java class to generate the hash values of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.