Every time I start BLueJ up, create a new project, and create a class in the project, and open the editor, it defaults to some pre-written code, and I was wondering if I could change that so every time it starts up I could start with code that can help me and that sets me up for what I want to do.
Here is the default code that comes up that I would like to change.
I tried going through the preferences (I am on Mac), but could find anything that led me to the startup code.
Thanks!
For Windows and Linux systems, BlueJ Java templates are located at:
<BLUEJ_HOME>/lib/java/templates/newclass
where <BLUEJ_HOME>
is the directory where BlueJ was installed.
For MacOS, find the templates at:
MacintoshHD > Applications > BlueJ<version> > BlueJ > Contents > Resources > Java > english > templates > newclass
Navigate to that directory and you should see a number of documents with a .tmpl
extension. In your case, you want to use a different template whenever you create a standard Java class, so you want to edit (or replace) the file stdclass.tmpl
.
Whatever you choose to include in this template file becomes a literal part of and will appear in every new class, with the exception of the placeholders $CLASSNAME
and $PKGLINE
, which will be replaced with the name of your new class and the package to which it belongs, respectively.
Once you've made your edits, save the .tmpl
file and your changes will affect any standard Java classes you create subsequently with BlueJ.
Further details are available via the official documentation for BlueJ (see specifically page 39 as of the writing of this answer).