Hi, This is from the Java SE 6 documentation. It explains "all": Command-Line Interface
On implementations with a command-line interface, an agent is started by adding this option to the command-line:
-javaagent:jarpath[=options]jarpath is the path to the agent JAR file. options is the agent options. This switch may be used multiple times on the same command- line, thus creating multiple agents. More than one agent may use the same jarpath. An agent JAR file must conform to the JAR file specification. The manifest of the agent JAR file must contain the attribute Premain- Class. The value of this attribute is the name of the agent class. The agent class must implement a public static premain method similar in principle to the main application entry point. After the Java Virtual Machine (JVM) has initialized, each premain method will be called in the order the agents were specified, then the real application main method will be called. Each premain method must return in order for the startup sequence to proceed. The premain method has one of two possible signatures. The JVM first attempts to invoke the following method on the agent class:
public static void premain(String agentArgs, Instrumentation inst);If the agent class does not implement this method then the JVM will attempt to invoke:
public static void premain(String agentArgs);The agent class may also have an agentmain method for use when the agent is started after VM startup. When the agent is started using a command-line option, the agentmain method is not invoked.
The agent class will be loaded by the system class loader (see ClassLoader.getSystemClassLoader). This is the class loader which typically loads the class containing the application main method. The premain methods will be run under the same security and classloader rules as the application main method. There are no modeling restrictions on what the agent premain method may do. Anything application main can do, including creating threads, is legal from premain.
Each agent is passed its agent options via the agentArgs parameter. The agent options are passed as a single string, any additional parsing should be performed by the agent itself.
If the agent cannot be resolved (for example, because the agent class cannot be loaded, or because the agent class does not have an appropriate premain method), the JVM will abort. If a premain method throws an uncaught exception, the JVM will abort.
Craig On Jul 9, 2007, at 8:51 AM, Janap wrote:
Well..was just testing incase the newer version had some undiscovered bugs.2 more small things ...if I have read it correct syntax for javaagent is...-javaagent myPackage.myClass Do i need any more arguments like path to persistence .xml or stuff, thx for the attention, best wishes Patrick Linskey-2 wrote:Not from me -- I'm not much of a javaagent expert. However, why are you moving backwards in time, rather than forwards, with the version change? -Patrick On 7/9/07, Janap <[EMAIL PROTECTED]> wrote:Hi,Thx for the tip. I added all the libraries to the classpath as well andalso replaced with 0.9.7 with 0.9.6 incubating libraries. Now the problem is : Error occurred during initialization of VM agent library failed to init: instrument Error opening zip file:C:\Programme\Eclipse\workspace\OpenJPATest\web\WEB-INF\lib \openjpa-all-0.9.6-incubating.jarIt seems that it cannot detect the jar file at all..i cross checked spellings and file location..any more suggestions? Patrick Linskey-2 wrote:-javaagent:C:\Programme\Eclipse\workspace\OpenJPATest\web\WEB-INF \lib\openjpa-0.9.7-incubating.jarHi, You need to put OpenJPA's dependencies into the classpath as well. -Patrick On 7/9/07, Janap <[EMAIL PROTECTED]> wrote:Hello all,I am trying to run a simple Hello World OpenJPA application and needenhancing to my classes. My application is now a dynamic web project in Eclipse.I want to add enhancing ability through the java agent.For this in theTomcat cofiguration i added..mypackage.myclass I get the following exception : Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeExceptionException in thread "main" FATAL ERROR in native method: processing of-javaagent failed Do I need to pass my persistent class as parameter or not...Cansomeonehttp://www.nabble.com/Runtime-Enhancement-in-Eclipse- tf4049770.html#a11503057please point out my mistake. best wishes Jan -- View this message in context:Sent from the OpenJPA Users mailing list archive at Nabble.com.-- Patrick Linskey 202 669 5907-- View this message in context:http://www.nabble.com/Runtime-Enhancement-in-Eclipse- tf4049770.html#a11504139Sent from the OpenJPA Users mailing list archive at Nabble.com.-- Patrick Linskey 202 669 5907--View this message in context: http://www.nabble.com/Runtime- Enhancement-in-Eclipse-tf4049770.html#a11504394Sent from the OpenJPA Users mailing list archive at Nabble.com.
Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
