This is the Eclipse workspace that is to be used for CS106, CS165, and CS180. It includes:
- Eclipse preferences set to support easier coding in Java.
- The JavaCoreTemplate project: make a copy of this project when starting each assignment. The JavaCoreTemplate project supports the following goodies:
Includes Main.java, with a main() function that is ready to go, and has useful classes statically imported.
Eliminate the EVIL System.out. and just use:
println("Hello");Read a line of text from the console:
String s = readLine();Read a whole file into a String with one line of code:
String quakeText = readFile("4.5_week.atom");Read a file into a list of Strings:
List<String> words = readFileAsLines("dict.txt");Write a string to a file:
writeFile("file.txt", str);Write a list of strings to a file:
writeFileAsLines("lines.txt", list);printf w/o requiring System.out. in front:
printf("%d words in %s\n", words.size(), path);
print("Hello");Parse ints, floats, etc w/o having to put Integer. in front:
int age = parseInt(text);var list = asList("This", "That", "And the other");Use range() to loop in a pythonic manner:
for (var x : range(10))
println("Hello " + x);JavaCoreTemplate includes the wonderful StringUtils, which has join, substringsBetween, reverse, etc. For example:
String[] titles = substringsBetween(quakesXml, "<title>", "</title>");PMD support, including a tailored set of rules (cs106.ruleset).
JavaCoreTemplate's Main class already has the Core functionality statically imported. To add Core functionality to other classes, add the following static import at the top of the .java file:
import static sbcc.Core.*;
-
If you are using the SBCC Student Desktop VDI:
- Download workspace-cs106-v5.zip
- In Windows Explorer, copy the .zip file to the N:\ drive (CSnebula).
- Right-click the .zip file, select 7-zip | Extract Here. If asked about overwriting files, click Yes to All.
- Double-click the N:\CompSci\launchers\Eclipse CS106 shortcut. This will launch Eclipse and point it at N:\workspace-cs106_v5.
- If you get an "older version warning", check the "Do not warn again..." box and click Continue.
-
If you are on your own computer:
- Download workspace-cs106-v5.zip
- Unzip the workspace where you like.
- File | Switch Workspace | Other...
- Navigate to where you unzipped workspace-cs106-v5. ** NOTE: By default, Windows extracts and extra level of folder. I.e. your_folder/workspace-cs106-v5/workspace-cs106-v5. Double check this. If you have the "extra level", be sure to navigate to the inner level: your_folder/workspace-cs106-v5/workspace-cs106-v5.
- Click OK, then click OK again.
-
If you haven't already done so, check out the time-saving features that the workspace offers