CSCI0200
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
2
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags: resources --- # IntelliJ Setup Guide ## Introduction **Note:** If you already have IntelliJ installed (because you've taken CS0150 or for any other reason), please follow the "Java" and "Changing your SDK" portions of the [Installing](#Installing) section ONLY. IntelliJ is an IDE (Integrated Development Environment) for Java, one of the two languages we will be using in CS200. Similar to DrRacket in CS17, code.pyret.org in CS19, or PyCharm in CS111, IntelliJ is an incredibly useful tool that does syntax highlighting, error-checking, and much more. It is very highly recommended that you install IntelliJ and use it throughout CS200, as this will be the IDE that the TAs have practice with. In this document, you will find a step-by-step guide for installing and setting up IntelliJ on your local machine and on a department machine (if you chose to use a department machine). Note that you only need do this a single time on each machine. *You may use a different Java IDE if you wish, but note that our staff will only support/help with IntelliJ.* ## Installing First, go to https://www.jetbrains.com/idea/ and click “Download.” Make sure to select your operating system (“Mac”, “Windows”, or “Linux”), and then click the “Download” button under “Ultimate” (make sure you select the Apple Silicon option if you have an M1 Mac). Once the application has downloaded, open it. A window might pop up asking if you want to import any settings. If you have not used IntelliJ before, select **“Do not import settings.”** Accept any other defaults while installing. If you have used IntelliJ in the past and would like to import settings, you can choose to do so. **Note:** You can get a free student license for the Ultimate edition of IntelliJ (as well as all other JetBrains products) at https://www.jetbrains.com/student/. ### Java IntelliJ is only an IDE for Java; it is not Java itself. To actually run Java programs, you need to make sure that you have the Java 17 SDK installed. To do this perform the following the steps: With IntelliJ open, go to `File > Project Structure` in your tool bar (Mac Users can do `⌘;` as a shortcut). <img src="https://i.imgur.com/O2vXytK.png" width="70%"> If you do not see version 17 as an option, go to the SDKs tab under "Platform Settings", click the plus button, select "Download JDK...", and select Oracle OpenJDK 17.0.x: <img src="https://i.imgur.com/hyViURC.png" width="70%"> Then change the the project language level to be either on "SDK default" or 17. <img src="https://i.imgur.com/8CPa3l5.png" width="70%"> With this done, make sure to click the apply button **before** hitting ok to save your changes! <img src="https://i.imgur.com/b3zT7zJ.png" width="70%"> <!-- ## Local Setup Now that you have IntelliJ and Java installed, you’ll need to add some packages that we’ll be using throughout the course. --> ## Configuring IntelliJ Settings Now that you have IntelliJ and Java installed we are going to edit a few IntelliJ settings to make your life a little easier and to maintain consistency with the courses style guide. With IntelliJ open go to ``IntelliJ IDEA -> Preferences -> Editor -> Inspections`` on the menu bar. (``File -> Settings -> Editor -> Inspections`` on Windows). Under the ``Profile`` dropdown menu, select ``Default`` (Stored in IDE). Then, copy and paste the following text into the search bar ``Instance Field access not qualified with 'this'`` and make sure to check the open box next to the field that comes up. After completing this your screen should look like this: ![](https://i.imgur.com/BuKVHYR.png) After completing this, please copy and paste ``Instance method call not qualified wi`` into the search bar and repeat the same process for the new field that pops up. ![](https://i.imgur.com/mUxsz6e.png) Make sure to press **apply** then ok and then you should be all set with this step! Lastly for this section we will be setting up autofill to make your life a little easier. To set up autofill do the following: - Go to “Preferences” (or “Settings” on Windows) -> Search for “code completion” -> check “Show suggestions as you type” -> press “Apply” then “OK”. Your screen should look like this after following this step: ![](https://i.imgur.com/XSA1VK8.png) ## Running Assignments ### Directory Structure Each assignment (hw, labs, and projects) will be packaged on GitHub as its own project. We recommend you have a 'cs200' folder stored in an accessible place on your computer with subfolders 'homeworks', 'labs', and 'projects', where you clone all of your git repositories into. ### Creating a Project Now that you have your development environment set up, it’s time to start coding! To pull code from GitHub, follow the [Github Guide](https://hackmd.io/YoK8zBN9Rkum1_rxlyBzPQ) to clone your projects. Then, you can open the project with IntelliJ with `File > Open`, and then select the folder that you downloaded. **Note:** If for whatever reason you need to create your own projects without our stencil code, go to `Projects > New Project`. You will have to select a Project SDK, which should be whichever version of Java you have (but at least Java 17). Give your project a convenient name and make sure to save it in the proper directory (our recommendation described above). ### Adding Jars/Dependencies In order to run your programs, you will need to configure Intellij to work with our support code. To do this, you must add our `.jar` files to your project. These files should be located in the `lib` folder in your cloned repository. - After you’ve cloned the GitHub repo into your workspace, you’ll have to tell IntelliJ to include the dependencies. Open the project window and select `File > Project Structure > Modules > Dependencies`. - Next, select the plus (+) button, select “JARs or directories”, then locate and select the `.jar` files from the `lib` folder. Make sure under “Scope” that “Compile” is selected, then click “Apply” and “OK”. (It should look similar to the screenshot below). ![](https://i.imgur.com/Awr7jvQ.png) - Now, IntelliJ is set up to use the proper dependencies. ***Note:** You will have to repeat these steps for each project.* ### Configurations, Compiling, and Running Java programs in CS200 tend to use multiple files that will interact with eachother (with containment/association, for example). While this makes organizing your code much easier, IntelliJ won’t know which file you want to run when you press the primary play button until you tell it. The easy way of doing this is by pressing the green play button to the left of the line of code in a file you want to run (for instance, to the left of the main method), or right clicking on the file name in the file structure and clicking "Run '\<filename\>'". The primary play button will compile and run this file and associated files until you run a different main file. ![](https://i.imgur.com/7aHqp3M.png) **Note:** In CS15, we started you off with the terminal commands "javac \*.java" and "java \<filename\>" to compile and run. THIS WILL NOT WORK because you are now using a different version of java and it got wonky, so please stick to the IntelliJ compiling/running process outlined in this section. **Note:** When running more complicated projects, instead of using the inline play button, you might need to input arguments. If this is the case, go to Edit/Add configurations, which can be done by selecting the ‘Add/Edit Configurations’ button at the top right of your window to the left of the green run arrow and selecting the appropriate SDK (Java 17) and telling IntelliJ where your ‘main’ function is. More information can be found [here](https://www.jetbrains.com/help/idea/running-applications.html). - Assignments that require you to do this will have more detailed instructions on what configuration you should be adding. ## Department Machine Setup For some students, connecting to the department machines (which use Linux) will be a better option than working on your personal computer. You can connect to the machines using [this guide](https://cs.brown.edu/about/system/connecting/net_remote/), or use one of the computers in person at the CIT. For working on a department machine, you can launch IntelliJ from a terminal by typing "intellij &". Once you do that, all you need to do is specify Java 17 for your project SDK. Go to File > Project Structure > SDKs, and click the "+" icon. ![](https://i.imgur.com/8o5rL6K.png)![](https://i.imgur.com/KdJFOIj.png) From there, you want to add the JDK at /usr/lib/jvm/java-17-openjdk-amd64. ![](https://i.imgur.com/ITAhoYc.png) Once you do this, you should be all set! If you want to verify your setup, you can create a project and run this program and see if the output version is 17.0.x. (you may need to change com.company if it errors). ``` package com.company; public class Main { public static void main(String[] args) { // write your code here System.out.println(System.getProperty("java.version")); } } ``` ## Common Bugs/FAQ We will try to update this with bugs that we encounter during the semester! * If you have previously installed IntelliJ, make sure that you have updated to the most recent version. See directly below for instructions on how to do this! * **I'm getting an error like: "Cannot determine path to 'tools.jar' library."** Follow [these steps](https://www.jetbrains.com/help/idea/update.html#update-settings) to update your IntelliJ. ![](https://i.imgur.com/Crl7vC2.png) *Above: To update IntelliJ go to File > Settings > Appearance & Behavior > System Settings > Updates and click Check for Updates. You may have to complete this step twice depending on when you first installed IntelliJ* * **Support code is showing up as red or raises errors after cloning it from Github.** Double check that you have correctly added all the .jar files from the lib folder as dependencies. * **IntelliJ is saying that there is an error with the sol package.** To solve this, go to `File > Invalidate Caches/Restart`, and if prompted click "Invalidate and Restart" * **IntelliJ is confused about package names and/or imports.** Always check to make sure that the top folder in your IntelliJ project is the name of the GitHub assignment, and that it says `sources root`: <img src="https://i.imgur.com/pKrrnq8.png" width="70%"> *Above: correct project structure* <img src="https://i.imgur.com/17DPVYN.png" width="70%"> *Above: incorrect project structure (no `sources root` tag on top folder). Note the different icons on the .java files* If you are missing the `sources root` tag, right click on the top folder, and then select `Mark Directory As > Sources Root`: <img src="https://i.imgur.com/Ev7s1us.png" width="60%"> * **I'm getting an error that says "Project JDK is not defined".** Click on "Setup SDK" and follow the prompts to select the Java SDK. <img src="https://i.imgur.com/p10aNOH.png" width="60%"> ## More Information IntelliJ might look complicated at first, but it is an incredibly powerful tool once you get to know it. You can find more information with these helpful links: * https://www.tutorialspoint.com/intellij_idea/intellij_idea_getting_familiar.htm * https://blog.jetbrains.com/idea/2020/05/debugger-basics-in-intellij-idea/ * https://www.jetbrains.com/help/idea/running-applications.html --- *Please let us know if you find any mistakes, inconsistencies, or confusing language in this or any other CS200 document by filling out the [anonymous feedback form](https://forms.gle/JipS5Y32eRUdZcSZ6)!* *(you do have to sign in but we don't see it)*

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully