• Post Reply Bookmark Topic Watch Topic
  • New Topic

Execute some byte code ?  RSS feed

 
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 ?
 
Saloon Keeper
Posts: 4423
108
  • 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.
 
Marshal
Posts: 58831
179
  • 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.  . . .

 
Java Cowboy
Sheriff
Posts: 16083
88
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!