Setup MOOC OOP Java Development Environment

MOOC by University of Helsinki was said to be good and was actually very good. If you are a Java beginner who is searching for well-organized exercises, it won’t disappoint you. Object-Oriented Programming with Java Part I and Part II. Register an account at Test My Code. Set up the development environment. Finish all the exercises there. That’s all.

However, many beginners would have difficulty in setting up development environment, and there are also some things you need to pay attention to.

IDE Selection

I would highly recommend you install NetBeans 8.2 Java SE with TMC plugin for Part I exercises. You may also install TMC-Bundle version. For Part II exercises I suggest you using Intellij IDEA Community Edition.

You need to install JDK first before NetBeans, it’s recommended to choose JDK8 or lower version for NetBeans installation. For IDEA, it’s not needed for installation but needed for development.

For IDEA, remember to set language level to 1.6 or lower in project structure settings, as the TMC server side compile your code as 1.6. Without doing so you would pass all unit tests locally but failed at server side if you use some features not available in 1.6.

Check the NetBeans project file and you would know why.

Anytime you failed at server side, remember to check error details in submission page.

Using Chocalatery

Run cmd.exe as administrator and copy paste commands in the below, it will automatically install NetBeans 8.2 Java SE and IDEA Community edition. It’s much faster, but if you don’t feel comfortable with command line, then simply download, and click, click, and click.

1
2
3
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

cinst netbeans-jse intellijidea-community -y

Follow instructions of plugin install would do the job.

Since package netbeans-jse is dependent on jdk8, it will also install jdk8 automatically if it’s not available.

Attention!

Your NetBeans might not work as expected due to the selection of JDK version not supported. In that case, you need to edit the configuration file and change JDK home for NetBeans manually.

You can access all projects in NetBeans at the same time and work on multiple projects easily, however in IDEA you can do one exercise at one time, and need to switch project then, as Part I exercise are usually small, it’s really a little bit painful to switch projects too frequently, you know, IDEA is awesome but a little bit slow and heavyweight.

Make sure you pass all local tests first, but this doesn’t mean you will pass server-side tests. For example, if you use System.exit(0) in your main method, you would fail at Server side - one of my students uses this and is very confusing why server-side failed.

Make sure your output is exactly the same as expected, it’s very strict, even some words are very simple, don’t type them directly, always Copy+Paste them to avoid spelling mistakes.

You can Click Run -> Test Project, or right-click the project and choose Test, or click the TMC button Run tests locally to perform local tests.

I experienced Copy+Paste issue in NetBeans sometimes, the quickest workaround to resolve it is restarting NetBeans, you may find it’s necessary sometimes.