Please note: this article refers to the 2019-20 version of this course. It will be retired on September 1, 2020.
Firstly, we recommend using laptop or desktop computers. Tablets are not recommended for this course.
However, there are ways to work around the technical limitations of using tablets and Chromebooks. Schools have used Chromebooks and, although they are not perfect, they are workable.
Though you may use any web-based IDE, we highly recommend using Repl.it. Please follow these instructions to code Java on a Chromebook using Repl.it.
GETTING STARTED WITH REPL.IT
2. Click "Start Coding Now"
3. From the next screen, click the listing for Java in the menu shown.
4. The screen will now look like the following and you are ready to create your first file!
CREATING YOUR FIRST JAVA FILE IN REPL.IT
1. Start by naming your project as shown in the previous section above.
Note: By default, the first text edit area will be named “Main.java” file. This code editor requires that your main program always be named “Main.java” and the main class always be called “Main”. When submitting to the Edhesive Code Runner, the class will need to be changed to match the activity.
2. Get started by copying and pasting code from the Edhesive starter file from the applicable lesson. To open coding templates on a Chromebook:
- Download the starter files and upload them to Google Drive.
- Click the magnifying glass in the bottom left corner of the Chromebook.
- If "Files" does not show in the menu as shown below, click "All Apps" to locate.
Select the files you want to open and drag them to "Google Drive" on the far left, then click on Drive to open this folder and view files.
Right-click the starter file you want to use and click "Drive Notepad" to open, then copy and paste the code from Drive Notepad into Repl.it.
NOTE: Many of the Edhesive starter files do not include the “public” keyword in the class header. Repl.it will throw an error if this keyword is missing. To fix this, add the word “public” to the header in the starter code before running your program. Additionally, make sure that the class is called “Main” when running it on Repl.it, and to change it back to the original name when submitting it on Edhesive.
RUNNING YOUR CODE ON REPL.IT
1. Copy or type code into the left half of the screen, and click the arrow button above the text editor to run the code.
2. The output will be displayed in the right-hand console. Any necessary input for programs need to be executed through this console. To use, click in the proper area, type the input, and press Enter.
OPTIONAL: ADDING MULTIPLE CLASSES TO A JAVA PROGRAM IN REPL.IT
(This section is optional if students are just starting the course.)
The Repl.It environment supports multiple classes when the following criteria is met:
- Each class is in a separate file
- Each file is named after the class that is in that file
ADDING A NEW CLASS
1. Click “Add New File”at the top left of the text editor to auto-generate a new file next to the existing files.
2. Rename the new file to match the new class (example used: “OtherClass.java”) by clicking the Options button (three vertical dots) and clicking “Rename” from the drop-down menu.
3. This class is now accessible by your Main class in the other tab, as well as in any other classes in your project, as long as the class has the right access keyword (i.e., public, protected, etc.).
TRANSFERRING CODE FROM REPL.IT TO THE EDHESIVE CODE RUNNER
1. Once a program is ready to submit, highlight all code text and copy to the clipboard.
2. From the Edhesive site, paste the code into the appropriate text box for the current activity.
NOTE: The code runner may give errors if the class name does not match the activity being completed. Using the templates provided by Edhesive can help avoid errors like these. You do not need to remove the keyword public that was added to the templates for running them in Repl.It.
3. Click “Run” below the text box to run your code.
4. Click “Check Answer” or “Submit” to complete the activity or assignment.