Resources


Resources

Setting up Java and Eclipse

For those cases, our CS2110 consultants can help.

In CS 2110, you'll be using an integrated development environment (IDE) called Eclipse to develop and debug your applications, which will be coded in the Java Standard Edition (Java SE 7) platform, as released by Oracle and downloadable from Java.Oracle.com. Java SE 7 includes a

Java Runtime Environment (JRE). This includes everything needed to run Java programs, including an interpreter for its machine language and the libraries of codes of classes that come with Java.

A Java Development Kit (JDK). This includes the compiler, which translates Java programs into the Java virtual machine language. It includes a debugger, as well as lots of other pieces, which help Java work smoothly.

We recommend that you start by installing Java on your computer (if the right version is not there) and then Eclipse. Alternatively, you may be able to find an install package that does everything at once, but Eclipse appears to be phasing that out.

The IDE we use in CS2110 is Eclipse, and we use this even though Oracle has its own IDE for Java. The version of Eclipse we work with is the "Luna" release.

Find out which JRE you have on your computer. Open a command window (in Windows, Start > Run... and type cmd; in Mac OS X, Applications > Utilities > Terminal) and type java -version at the command prompt:

C:\>java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

This says I have version 6 installed (6 and 1.6 are synonymous). If this command had failed (meaning Java isn't installed at all), that would mean Java was not installed on your machine.

If Java 1.7 is not installed on your computer, you need to upgrade to it (see later).

Which JDK do you have? If you are on a PC running Windows and have never installed a version of the Java Development Kit (JDK) on your machine, you probably don't have it. If you are on a Mac, you probably do. To find out, type javac -version:

C:\>javac -version
javac 1.6.0_0

If you get an error message or the version is earlier than 1.7, you MUST (re)install the JDK.

Installing the JDK

The easiest way to install the JDK is to jump down to the link for installing Eclipse, below, and follow that.  Then select the option for installing the JDK and JDE as part of the Eclipse install. In one easy (but slow) download, you'll have everything you need. But if you can't find a combined package for your machine, which is an issue lately, you may need to first install the JDK by itself and then install Eclipse by itself. In what follows we'll explain how to do this.

The JDK is already installed in CIT and ACCEL labs. However, installing it on your own machine will greatly facilitate your work. Please note that you should double check your work in a public lab, since privately owned machines occasionally exhibit different behaviors.

Windows and Unix

To download the JDK, visit Oracle's Java web site and download and install JDK 7. You may run into mention of "Sun", that's just the name of the company that created Java. Sun was eventually acquired by Oracle, and, Oracle now runs the Java development effort.

Mac

If you have a 64-bit Intel-based Mac running Mac OS X 10.5 (Leopard), there is a version of Java SE 7 available from Apple. If you wish to upgrade, visit Apple's Java web site and download and install Java for Mac OS X 10.5, Update 1. After installing, run Applications > Utilities > Java > Java Preferences. Drag the newly installed version of Java to the top of the list under Java Application Runtime Settings. Click Save.

Installing Eclipse

We assume the JDK has been installed.

Visit www.eclipse.org/downloads/ and download the appropriate "Eclipse IDE for Java Developers" for you computer. Follow the instructions and install it. In principle, if you installed Java correctly, the Luna release of Eclipse will find it. If not, you may need to create a shortcut to the version of "javaw" Eclipse should use when it needs to launch the Java system. Our consultants can help if you get into this situation, which occurs mostly if you do things in the wrong order or if you had an old copy of Java on your machine and Eclipse became confused..

Compiling and Running from the Command Line

We don't use of this feature in CS2110, but sometimes it is useful to run a Java program without launching it from Eclipse. You can easily do this; Eclipse and Java are really two different systems that talk to each other in a friendly way, but they can also be used independently. The notes that follow explain how you would run your Java program all by itself, if you wanted to do so.

Compiling

Say your main class is MyProgram and it is contained in the source file MyProgram.java. If it is not in a package, navigate to the folder containing MyProgram.java and type javac MyProgram.java.

If it is in a package (say myPackage), the source should be in a folder called myPackage. Navigate to the folder containing myPackage and type javac myPackage/MyProgram.java.

Running

From the same folder you compiled from, type java MyProgram <program arguments> if it is not in a package, and java myPackage.MyProgram <program arguments> if it is.

Specifying a Classpath

Sometimes you may need to inform Java where to find auxiliary classes. You can do this with the -cp option to the java command. Supply a sequence of folders telling Java where to look for classes, separated by : (Mac) or ; (Windows).

Brushing Up

For students with limited Java experience, we recommend the online notes from CS 1130 (formerly 101J), Transition to Object-oriented Programming as a refresher. This is a self-paced course consisting of several modules that you can go through at your leisure.

More Ways To Catch Up


Piazza

CS2110 uses Piazza: a public forum for discussing questions about the assignments. The course staff monitors this group regularly, so this is a great way of getting help and interacting with the course staff. An extra advantage of using the group is that everyone else can benefit from your question as well. Anyone can visit the group and read previous questions here .

If you know the answer to a question, feel free to post a reply yourself, but please avoid giving away any hints on the homework or posting any part of a solution. This will be considered a violation of Academic Integrity. Generally, rough algorithms or non-solution-specific code fragments are OK if you need them to illustrate a point.

CS2111

In fall 2013, 60% of the incoming students won't have Java experience, and many have relatively little prior  OO experience (everyone is expected to have some programming experience, and some prior exposure to OO concepts, but the level of prior experience varies widely). To help out we've created an enrichment course that runs for 1 credit, S/U, and provides a bit of extra exposure to the same ideas we'll cover in class. CS2111 is totally optional but could be very helpful to anyone nervous about their background. It is taught by Professor Gries. You would normally take CS2111 in addition to CS2110 and the CS2110 recitation, so CS2111 does involve extra time -- one hour per week. But with this extra help, even people very nervous about programming should be able to keep up with CS2110.

Academic Excellence Workshops

The Academic Excellence Workshops (AEW) offer an opportunity for students to gain additional experience with course concepts in a cooperative learning environment. Research has shown that cooperative and collaborative methods promote higher grades, greater persistence, and deeper comprehension. The material presented in the workshop is at or above the level of the regular course. We do not require joining the AEW program, but do encourage students to join if they are seeking an exciting and fun way to learn. The AEW carries one S/U credit based on participation and attendance. The time commitment is two hours per week in the lab. No homework will be given. This is a wonderful opportunity for students to seek extra help on course topics in a small group setting.

Your fellow undergraduate students, who are familiar with the course material, teach the sessions with material that they prepare. The course staff provides guidance and support but do not actually teach the AEW course content or any session. A representative from the AEW program will be speaking about the program and registration procedures in lecture.

See the AEW webpage for further information.

JavaSummary

We have produced over 70 powerpoint slides that give a brief introduction to just about every part of OO in Java. The slides give examples, rather than formal definitions. The first two pages contain an extensive index, so you can easily get to the slides that you want.

We give it in two forms: a pdf file and the source pptx slides. The latter is the best to use so that you can make use of the animations on the slides. It took us a long time to make this up; we did it to help you. Use this resource!

CodingBat: website to practice small Java programs

codingbat.com is a website for practicing writing Java code segments to learn about and practice various Java features, from boolean expressions, strings, loops with strings, recursion, and more. Try it out!