Understanding how JAS3 loads classes

By default whenever JAS3 compiles new classes it puts the resulting .class files into the directory ~/.jas3/classes. This directory is included by default in the list of directories from which JAS3 loads classes, also known as the CLASSPATH.

These defaults were choosen to make things simple for beginners, they can open .java files from any directory, compile them, and load the resulting class without having to worry about setting CLASSPATH, or even knowing what it is. However these defaults are different from the Java compiller's normal default, which is to put compiled classes into the same directory as the source code. More advanced uessr are likely to want to restore the normal Jav acompiler behaviour, especially if editing classes using an external editor, or once the number of classes in use grows to big to comfortably keep them in a single dirtectory.

For more advanced users it is quite simple to restore the more usual Java behaviour. From the menu chooser View, Preferences, and click on the "Java, Compiler" item in the preferences tree, then turn off the "Redirect output to:" option. This will restore the Java compiler's default behaviour.

note JAS-150@BUGS prevents this option working when using the built-in compiler. The option does appear to work correctly when an external compiler has been selected.

Once you have done this then you will probably also have to set JAS3's buillt-in CLASSPATH This is also done from the preferences dialog, using the "Java, Classpath" option. You will need to set Classpath to include all the directories from which you want JAS3 to load classes. (More accurately if your .java code contains a package statement, putting your code into a package other than the default directory, you will need to put the directory representing the root of your package heirarchy into the CLASSPATH).

  • No labels