Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Getting "java.lang.NoClassDefFoundError" on running with javaagent -BCEL(instrumenting using external jar file)
icon4.gif  Getting "java.lang.NoClassDefFoundError" on running with javaagent -BCEL [message #1694250] Sun, 03 May 2015 19:39 Go to next message
rahul kumar is currently offline rahul kumarFriend
Messages: 1
Registered: May 2015
Junior Member
I am trying to instrument a jar file (main.jar) with javaagent.jar using BCEL. basically where ever I find any aload in bytecode, I m trying to insert a function call to a static function called Fun() in class "someclass" using

if (opcode instanceof aload) {
iFactory.createInvoke("someclass", "fun", Type.VOID, new Type[]{}, Constants.INVOKESTATIC);
my "someclass" class reside in javaagent.jar

on executing

java -javaagent:javaagent.jar -jar main.jar
or

java -javaagent:javaagent.jar -jar main.jar javaagent.jar
or (I created a separate jar for my "someclass" called someclasscontained.jar)

java -cp someclasscontained.jar -javaagent:javaagent.jar -jar main.jar
I am getting

Exception in thread "main" java.lang.NoClassDefFoundError: someclass
error. i tried with -bootclasspath/p option but still not working. does anyone has any clue?

(1) all jar resides in same folder 2) checked all silly mistakes 3) used fully qualified class name
Re: Getting "java.lang.NoClassDefFoundError" on running with javaagent -BCEL [message #1694338 is a reply to message #1694250] Mon, 04 May 2015 14:57 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3840
Registered: July 2009
Senior Member

This may be a question for javaranch.com or Stack Overflow; it doesn't seem to have anything to do with Eclipse.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Getting "java.lang.NoClassDefFoundError" on running with javaagent -BCEL [message #1694379 is a reply to message #1694338] Tue, 05 May 2015 02:10 Go to previous message
Merry Bentham is currently offline Merry BenthamFriend
Messages: 1
Registered: May 2015
Junior Member
correct,you should adjust stack to solve this problem.
Previous Topic:To use for Java and PHP
Next Topic:Eclipse not running anymore
Goto Forum:
  


Current Time: Thu Sep 24 11:29:43 GMT 2020

Powered by FUDForum. Page generated in 0.03502 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top