This week's book giveaway is in the Design forum.
We're giving away four copies of Mastering Non-Functional Requirements and have Sameer Paradkar on-line!
See this thread for details.
Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Execute some byte code ?  RSS feed

 
Cedric Bosch
Ranch Hand
Posts: 99
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've logged the byte code from a simple class into the command prompt via the command javap. It looks like that:




I'd like to change the instructions a bit and execute it the new byte code. However I don't know how to do that, if I open the .class file in notepad, it doesn't look anything like this.

Any help ?
 
Tim Moores
Saloon Keeper
Posts: 3648
78
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bytecode is a binary file format, not text - you need special tools to work with it. jclasslib, for example, contains a bytecode viewer, but I don't think it lets you edit the class file. Not a big surprise, as that would be similar to compilation, which involves a lot more than changing the bytecode.

You could check out Jasmine, which can create class files from a textual description, basically a bytecode assembler.
 
Cedric Bosch
Ranch Hand
Posts: 99
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh thanks, I guess it's not worth it, I just wanted to see if I could make something run that doesn't compile but I think should.

But if I have to download libs and such it's not worth it (yeah I'm lazy like that). Thanks anyway.
 
Campbell Ritchie
Sheriff
Posts: 54466
150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cedric Bosch wrote:. . . see if I could make something run that doesn't compile but I think should.  . . .
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15931
86
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cedric Bosch wrote:I just wanted to see if I could make something run that doesn't compile but I think should.

Now I'm curious about that code that doesn't compile but which you think should. Can you show us that code? And explain why you think it should compile?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!