running with aj instead of java?
IntelliJ has made great progress in supporting aspectJ and I am really getting a productivity boost because of it.
ONe thing i can't figure out how to do is use aj instead of java to invoke a PSVM in a jar.
Perhaps not everyone is familiar with this part of AspectJ ut basically AspectJ will let you hold off the decision to apply aspects to a jar until the classes are loaded into the VM..
So the aspects get woven into the classes at runtime and the AspectJ compiler never alters the classes as they are on disk at all.
But to do this you have to run the PSVM in the jar using "aj" instead of the usual "java" at the command line.
Any help here? It's *entirely* possible I am overlooking something painfully obvious , and if so, please be gentle :)
Please sign in to leave a comment.
Hello Java Developer
I am not familiar with PSVM AspectJ notion (and I played a little bit a few month ago while I was developing a simple AspectJ-based cache support).
Does it stand for Load-time Weaving (LTW)?
http://www.eclipse.org/aspectj/doc/next/devguide/ltw.html
Thank you.
PSVM is just a shorthand for Public Static Void Main the point of entry for every java program.
Yes this is about runtime weaving.
Instead of executing using java (which IntelliJ does behind the covers.. somewhere somehow!) you execute using aspectJ's aj command and it will weave the classes when they are loaded.
So basically I am looking around for how and where IntelliJ actually invokes a program using the "java" command and if this is tweakable or replaceable by "aj"
There are no special run configuration, but you can imitate it easily by adding aspectjweaver.jar to a project depencies and "-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader" to a VM options.
Thanks Roman!