IntelliJ Notes
Tips for IntelliJ users:
- To read from a file rather than the console (especially when
debugging on a given input): Edit the run configuration, select *Modify
options*, and select *Redirect input*. This will add a new input box,
*Redirect input from*. Click on that box and browse to the file that you
want to use as input to your code.
- Visit File | Settings | Editor | Code Style
and set Visual guides to 90. This will draw a line at the 90th
column so you can see when your lines are getting too long.
- To get rid of hard tabs in source files:
Visit File | Settings | Editor | Code Style
| Java, select the Tabs and Indents item at the top,
and clear Use tab character.
- If you have
- Open your code in NotePad to check if your files contain tabs.
- If you accidentally add some tab characters, see below for a fix.
- You might consider moving to a more modern indentation style and
setting Tab size to 2, Indent to 2,
and Continuation indent to 4.
- If you change the formatting, right click on the src folder and
select Reformat Code.
- For a larger font, select File | Settings | Editor
| Font and set Size appropriately.
- Instructors sometimes ask students to create a package within a project
for each phase. To set that up,
- Open the project in Intellij
- Right click on the
src folder, select New and
then Package. Set the package name as directed by the instructor.
- In Windows File Explorer (not in Intellij), select
all of the files that are in the package.
Shift-select
is a helpful tool here.
- Go back to IntelliJ and select the destination package.
- Paste to copy the files in. IntelliJ will rename the links
from the old package name to the new name.
- If your project controlled with
git, be sure to add the
new files to the project, commit and push. Have a partner confirm they
can build after pulling the changes.