Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Problems (bugs??) in building and running AspectJ programs using AJDT

Hi Stephen,

There is no special AspectJ launcher provided in AJDT since other than
needing asptecjrt.jar on the classpath there are no special runtime
requirements for AspectJ programs. However, in the case of
tracing.version3.TraceMyClasses the main method is inside an aspect which
fools the Java Launcher's search (it scans the project looking for
*classes* that have a main method). To run a program that defines main
inside an aspect, select "Run..." from the run icon. Create a new Java
Application configuration for your project, and then for the main class
enter "tracing.version3.TraceMyClasses" directly into the "Main Class"
entry field (the Search... button will not find it in this case). Now you
can save this as a named configuration and run the program.

I couldn't reproduce the problem you are seeing with the subproject build
files - I tested both with separate src and bin directories, and also with
all the source directly under the project directory, I deleted the .class
files in the "tjp" directory and rebuilt with tjp/files.lst which recreated
them correctly, I am using Eclipse 2.1 though. Eclipse can be sensitive
about operations to files under its control that happen outside of Eclipse
(like deleting class files) - you could try switching to the resource
perspective in order to delete the class files via Eclipse rather than
through the command line, I'd be surprised if that was the problem in this
case though, and certainly it isn't in the Eclipse 2.1 code stream. Which
subproject did you test with? Do you see messages like "wrote class file
bin/tjp/Demo.class" appearing in the progress monitor towards the end of
the compile?  Do you have the "examples" folder underneath your src folder?
(I have e.g. "bean" as a direct child of "src").

-- Adrian.
adrian_colyer@xxxxxxxxxx





28 March 2003 10:10
To: Ajdt-Dev <ajdt-dev@xxxxxxxxxxxxxxx>
cc:
From: Stephen Cheng <scheng@xxxxxxxxxxxx>
Subject: [ajdt-dev] Problems (bugs??) in building and running AspectJ
programs using AJDT




I have run into a problem executing the AspectJ programs inside Eclipse
AJDT 1.1.1, possibly due to my ignorance in AJDT. I have run into another
problem in AspectJ project build process, which is quite likely to be a
real AJDT bug.

Environment:
Eclipse 2.0.2
AJDT 1.1.1

Setup:
I am testing my Eclipse/AJDT setup using the aspectJ samples. I created a
directory called AspectJSample\src with all the source files. I then
created a AspectJ project with seperate src and bin directories. The
AspectJ project wizard picked up the source files and the .lst files
correctly.

I click on the AspectJ build button, selecting <all project files>.
AJDT compiles and weaves all the projects correctly. I have tested the
generated class files using command line JavaVM. They run correctly.

Possible bug in building single project:
I delete the generated class files for a single project, outside of
Eclipse. I then select a single project (.lst) again using the AspectJ
build button in the toolbar. The build popup window pops up for a short
while, and appears to the rebuild the project (.lst). However no class
files are actually generated.

However the AspectJ build button seems to work correctly if I choose <all
project files>. AJDT will pop up the build popup window, and actually
re-generates all the class files for all projects.

There appears to be an inconsistency in the behaviour for the AspectJ build
button.


Possible bug in running AspectJ applications:
I open tracing\version3\TraceMyClasses in eclipse. I then Run > Run As >
Java Application.
Eclipse/AJDT reports "Launch failed: no main type found"

This is very strange. I can run tracing.version3.TraceMyClasses directly
from the command line, using the class files generated by AJDT in the
build process. Am I making an obvious mistake? Is there a different way to
run AspectJ programs?

An examination of tracing.version.TraceMyClasses shows the main() embedded
within the aspect. TraceMyClasses is not a normal Java class, but an
aspect. This may be causing Eclipse/AJDT confusion.

Is there an workaround for this problem?



Thank you, all help is appreciated :-)

Regards,
Stephen



_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxxxxxx
 http://dev.eclipse.org/mailman/listinfo/ajdt-dev



Back to the top