Creating a new custom Java class template option in BlueJ
So, I'm in this CS1410 class and we write a lot of simple Java apps, but we always have to have a certain structure to them when handing them in. Well, by default, the "New Class" template had a lot of extra crap so I went in and figured out how to create a new custom class option. Here are the steps I took:
Apple OS X
- Navigate to your BlueJ.app
- ctrl+click on it and choose "Show Package Contents" from the contextual menu.
- Navigate to "Contents/Resources/Java/english/templates/newclass".
- Duplicate the file "stdclass.tmpl" and name it "customclass.tmpl".
- Open this file with a text editor and put in what you want to show up in your new custom class. Note that the variable "$CLASSNAME" will dynamically put in the name of the new class that you type in the dialog box so you may want to keep that in when declaring your class.
- Now, go up two directories to the "english" directory and look for a file called "labels". Open this with a text editor and look for the line "pkgmgr.newClass.stdclass=Class". Create a new line after this line and type the following "pkgmgr.newClass.customclass=Custom Class".
- Save your files, close them up and restart BlueJ. You will notice that when you go to create a new class you will have the option to check "Custom Class" now. Enjoy. :]
Windows XP
- Navigate to where you installed BlueJ (in my case it was C:\BlueJ)
- go into lib\english\templates\newclass
- Duplicate the file "stdclass.tmpl" and name it "customclass.tmpl".
- Open this file with a text editor and put in what you want to show up in your new custom class. Note that the variable "$CLASSNAME" will dynamically put in the name of the new class that you type in the dialog box so you may want to keep that in when declaring your class.
- Now, go up two directories to the "english" directory and look for a file called "labels". Open this with a text editor and look for the line "pkgmgr.newClass.stdclass=Class". Create a new line after this line and type the following "pkgmgr.newClass.customclass=Custom Class".
- Save your files, close them up and restart BlueJ. You will notice that when you go to create a new class you will have the option to check "Custom Class" now. Enjoy. :]
Hopefully this helps some other students. :]