These are a few instructions to install @Java on Microsoft Windows.
In order to get the package works, you need to have the following packages properly installed and configured.
You also have to make sure that your JAVA_HOME environment variable is set.
Download the @Java archive at the following link:
and unzip it in the location where you want to install it. It will create three directories:
It may be useful to add the bin directory to your PATH environment variable.
In order to patch the Java class library file, you need to logon with an user that have administrative permissions.
Since @Java alters some reflective mechanism of the language, we need to modify some standard classes contained in the rt.jar file. The rt.jar file is located in the $JAVA_HOME\jre\lib\ directory. It is suggested to make a copy of the original file before proceeding.
Go to an empty directory and copy the rt.jar there.
copy %JAVA_HOME%\jre\lib\rt.jar .
Extract the Field.class, Method.class, Method.class files with the following command:
- jar xf rt.jar java\lang\reflect\Method.class
- java\lang\reflect\Constructor.class java\lang\reflect\Field.class
Extract the content of the atjavac.jar and the atjava.jar library file in the current directory
jar xf ATJAVA_INSTALLATION_DIR\atjava.jar
jar xf ATJAVA_INSTALLATION_DIR\atjavac.jar
Extract the content of the bcel.jar library file in the current directory
jar xf BCEL_INSTALLATION_DIR\bcel-5.2.jar
Apply the aspects:
ajc -inpath java -aspectpath atjava\lang\annotation -d .
Update the rt.jar archive
jar uf rt.jar java atjava atjavac org
Move the rt.jar in its original location
move rt.jar %JAVA_HOME%\jre\lib
If everything went fine, you can now compile @Java enhanched programs with the atjavac compiler, and execute them with the usual java invocation.