The tool that we use to compile a Java source file into a Java class file is called a compiler. Most programmers use an integrated development environment (IDE) that has the compiler built in and helps you write, compile, run, and debug programs.
You can learn Java by just using the interactive coding panels called Active Code in this e-book. If you are logged in, the Active Code will remember your changes and even show you a history of your changes to the code if you click on Load History.
However, itβs a good idea to also try a Java IDE to build code outside of this online book. There are many Java IDEs available. If you are enrolled in a course, your instructor will likely recommend one, so you should learn to use that one.
Before you can use any Java IDE or compile Java programs, you need to install the Java development kit (JDK) on your computer. The JDK includes the Java compiler, the Java runtime environment, and many essential tools for Java development. You can either download the latest version of the JDK from Oracleβs website (https://www.oracle.com/java/technologies/downloads/) or use OpenJDK, which is a free and open-source implementation available at https://openjdk.org/. Most IDEs will help you configure the JDK once itβs installed, but youβll need to have it on your system first. To verify your installation works, you can open a command prompt or terminal and type java -version - you should see version information displayed.
GitHub is the largest source code repository host in the world, with over 300 million repositories and a global community of more than 100 million developers. Github is widely used for both open-source and private projects, making it a versatile platform for various development needs, and a great place to learn about version control and collaboration in software development. Github provides many free opportunities for both students and teachers (https://docs.github.com/en/education/quickstart). Github Classroom (https://classroom.github.com/) allows teachers to set up a classroom based on Github repositories. Github and git are both very widely used in the computer industry, so learning to use them is great experience for students who want to showcase their skills. Github now has a cloud IDE called Codespaces (https://github.com/features/codespaces) which you can use for 60 hours a month for free or completely free if you join as a school or get approved as a teacher or student. In Codespaces, you can start from a blank template or repository, open a .java file in the VSCode editor, follow prompts to install the Extension Pack for Java, click on the Run and Debug (play button), follow the prompts to install the Java debugger, and see the output of your code in the terminal. You can also use Copilot (https://github.com/features/copilot), which is a coding AI based on GPT, for free if you are approved for educational use.
To use Github classroom, students need to sign up for a free Github account (https://github.com/signup) if they donβt already have one in order to use Codespaces.
To install Java software on your local computer, below are several popular Java IDEs and editors that you can download and install. Please be sure to use the one that is recommended by your instructor if you are enrolled in a course, as they may have specific preferences or requirements.
VSCode (https://code.visualstudio.com) is not an IDE per se, but it is a widely used coding editor which you can download on your local computer with many useful extensions like debugging tools that for all practical purposes make it behave like an IDE. It is frequently used in combination with Github Classroom. See https://code.visualstudio.com/docs/languages/java for Java support. Note that the VSCode editor is not the same as the Microsoft Visual Studio IDE which is a very large IDE that is not widely used for Java.
DrJava (http://DrJava.org) is a free, simple, easy to install and use development environment. One nice feature is the interactions pane at the bottom which lets you try out Java code without having to create a class first.
jGRASP (https://www.jgrasp.org/) is a free lightweight development environment, created specifically to provide automatic generation of software visualizations. jGRASP is implemented in Java, and runs on all platforms with a Java Virtual Machine (Java version 1.5 or higher). jGRASP produces Control Structure Diagrams (CSDs) for Java, C, C++, Objective-C, Python, Ada, and VHDL; Complexity Profile Graphs (CPGs) for Java and Ada; UML class diagrams for Java; and has dynamic object viewers and a viewer canvas that work in conjunction with an integrated debugger and workbench for Java. The site includes both intro video and PDF tutorials.
There are also a lot of online cloud IDEs where you can code online in many programming languages. Most are free to start, but offer different features for a price. These are great options if you are using a Chromebook or you cannot install software on your computer or you want an easy no-installation option.
CodeHS (https://codehs.com/) has a free Sandbox online IDE (https://codehs.com/app/sandbox) where you can run Java and Java Swing programs. Students can share the links to their code and the history of their code is saved. CodeHS has free and paid features. Grading features are in the paid version.
PickCode (https://pickcode.io/) is another online IDE that offers many free and paid features for setting up classrooms. In the free version, students can share links to their code and the history of their code is saved. Classroom features are in the paid version.
Replit (https://replit.com/) an online IDE which recently switched to only allowing 3 projects at a time for free. Be aware that Replit has turned on its AI feature for code completion for all accounts (https://replit.com/ai). Each user can turn the AI on and off at the bottom of the code window, and use an AI chat window to ask questions of the AI.
JuiceMind (https://juicemind.com/) is an online IDE that offers many free and paid features for teachers to set up classrooms like Coding Rooms. It has a built-in version of CSAwesome.