Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Javassist problem
#1
Hello.
I'm trying to replace a class method's code by some other code that requires more bytes.
I couldn't find any simple way to do that and investigation led me to Javassist that allows it and looks pretty simple to implement. (Or maybe not).

The system is Win 7 SP1 x64.
It has the latest x64 JDK 8 installed (u45) and Java works fine. I kept the x86 version off the system to avoid any conflicts for this exercise).
I copied the Javassist.jar into <java-home>/jre/lib/ext (one of their suggestions other than modifying the CLASSPATH).

Then I tried one of the Javassist samples (they all gave similar errors).
e.g.

javac sample/Test.java
(this one run without errors and created a Test.class in the \Sample folder)

java sample.Test
(this one gave the errors):

C:\Tools\Javassist>java sample.Test
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: javassist/NotFoundExc
eption
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javassist.NotFoundException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more

----
Is it a matter of incompatibility between Javassist and the x64 version of JDK or have I missed something important?
Has anybody tried Javassist in a similar environment without problems?
Is there some other easier way to add code to some method at the bytecode level?

Thanks in advance for any pointers.
Reply
 


Messages In This Thread
Javassist problem - by roocoon - 05-24-2015, 10:03 PM
RE: Javassist problem - by Bibl - 05-25-2015, 10:32 AM
RE: Javassist problem - by roocoon - 05-25-2015, 02:58 PM
RE: Javassist problem - by Bibl - 05-25-2015, 09:47 PM
RE: Javassist problem - by roocoon - 05-25-2015, 11:11 PM
RE: Javassist problem - by Bibl - 05-26-2015, 08:20 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)

About The Bytecode Club

We're a community focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website