Week 01: Welcome - Introductory Programming in Java Skip navigation Introductory Programming in Java ANU College of Engineering & Computer Science Search query Search ANU web, staff & maps Search COMP6700 Lectures Labs Assignments menu Search query Search ANU web, staff & maps Search Search COMP6700 labs Week 01: Welcome Week 02: Lab 1 Week 03: Lab 2 and HW 1 Week 04: Lab 3 and HW 2 Week 05: Drop-in Lab, HW 3 Week 06: Lab 4 and HW 4 Week 07: Mid-sem Exam Week 08: Free (Anzac Day) Week 09: Lab 5 and HW 5 Week 10: Lab 6 and HW 6 Week 11: Lab 7 and HW 7 Week 12: Lab 8 and HW 8 related sites Wattle Piazza Week 01: Welcome The computing environment IMPORTANT: Editors (Atom, gedit and any other found on our lab computers), the command-line interface (Terminal), and the three IDEs mentioned earlier — all these tools will be available for your during mid-semester and final examinations. Before you start lab classes, you need to get prepared and learn basics of how to use our computer environment (Linux Ubuntu) and standard programming tools like editors, IDEs and the command-line interface. Logging in, taking a look around Find somewhere to sit in front of a computer screen! Hopefully the computer will be switched on, unlocked, and working! (Wave to a tutor if not.) Make sure that you’ve got an account on our (RSCS) computer lab systems (to be an ANU student is not enough!). If you do not have an account, register with the Streams System by logging in (using your personal laptop, or smartphone, or tablet) with your university ID and password, and registering for one of the lab groups (their list should be available – if you are enrolled into our course – once you successfully logged in). Now log on into your computer account – use your ANU UniID and password as the user name and the password. Ubuntu Linux is a version of the open-source Linux (a version of Unix) operating system. For first time users, it may look a little clunky and old fashioned in comparison with Windows 10 or Max OSX. We like using Linux for teaching in the School of Computer Science for a number of reasons. One of these is that (arguably) Linux exposes students to how computers work in a more seamless way than the other operating systems. If you would like to find out more about Ubuntu Linux then you can refer to the Ubuntu Documentation: This is very detailed, up to date and provides demos and videos. As a part of this lab, you might want to explore this documentation web site, particularly the Desktop, apps & windows. When you log in you will see a desktop. There should be a terminal icon there that you can then left-click on to open a command-line window; if the front panel doesn’t contain the terminal icon, then click on the Menu icon on the left, and choose System → Terminal
The command line window allows you to do all sorts of things to your computer (within your permissions). It is not the only way of using the labs, but we will teach you how to use it for a start. You can find a (very) small subset of useful command-line commands (also called system utilities) in the Basic Command-Line Commands guide. Using the command line you will soon be able to do things like: You can run java and compile one of your programs, eg: javac MyProgram.java You can run one of your compiled java program, eg: java MyProgram You can list your files (the command ls) You can list the contents of files (cat myfile.data) You can write scripts to automate your system administration. (But this is somewhat advanced.) Programming Editor: Atom If you prefer, you can skip this part, and go strait to using an IDE (namely IntelliJ IDEA) In order to create your first Java program you need to launch a text editor. We recommend that you launch the Atom text editor: Click on the Menu icon on the left, and choose Applications → Programming → Atom Note: As you will want to edit a lot of files in the future, you may want to provide a link to Atom from the desktop. Right-click on the front panel, choose “Add application” and follow the selection dialog to find the necessary application and add its icon to the desktop. (CHECK AGAIN? If confused, asked your tutor for help). Try using the short-cut tricks; their list can be found in Atom’s menu: Edit -> Preferences -> Packages -> language-java -> Settings in the section Snippets. Use them (or just by typing) to write or modify a text of a program like HelloWorld.java, then save it on the disk (choose the directory well, see below), compile and run the program. This can be done on the command line (you need to change into the directory where the program files are saved). When you launch Terminal, the command-line interface will be in your home directory. If you created the directory structure as advised below, and you saved your new program in comp6700/labs/lab1, you need to change into that directory: cd comp6700/labs/lab1 then by listing the current working directory: ls -l . you will see the output containing a name (or more) of your file MyProgram.java. which can compile and run using the commands javac and java as described above. Play with the command line and Atom for a while until you feel that you can get around with these tools. Atom’s use for programming and its development is documented in the Atom Flight Manual which may find useful. Alternatives to Atom You can install on your personal computer and use if find it most convenient and productive one (or all) of the following programming editors: Sublime Text – commercial product (but the registration is not hard-pressed). Available for all platforms. Visual Studio Code – a surprising stable (more than Atom), sleeky and extendable free programming environment from Microsoft. All platforms. Java is supported by a couple plugins which need installation (they are not included in the main installation). TextMate – a historically first modern programming editors which introduced a host of new handy features (some of which its more modern rivals still do not emulate well). Commercial (but very affordable) product, only available for macOS. Emacs or Vim – classic tools for die-hards. Apart from supporting a multitude of languages (via the plugin architecture; often the need to program in a new language requires a specialised plugin installation, but some core languages are supported from scratch, eg Java in Atom) all modern editors provide System Code Management tools (like Git, which is used in our course). Integrated Development Environments (IDEs) If you prefer something less basic yet more powerful, consider an Integrated Development Environment – a powerful developer tool which allows to perform all (integrated!) activities which are required in the process of software creation. There are (in our labs) three products of such kind: IntelliJ IDEA Eclipse Netbeans all are excellent tools for (semi-) professional programming in Java environment. We definitely recommend you to use IntelliJ IDEA (“Idea” for short), which is installed on our lab computers, and which you can install for free as IntelliJ IDEA Community Edition (it is a lighter version of the commercial full-feature product, but it does possess necessary functionalities; the full version of Idea is available for free for students and university teachers, but requires special request and proof of status). Idea can be be launched by using the front panel (similar to how the launch of Atom is described above), or by typing this commands into the Terminal window: idea.sh &
(the ampersand symbol & at the end is important: try to start the applications without typing it and see what happens). If you choose an IDE, prepare for a steep learning curve: we will provide you with some moderate assistance if necessary, but most of the work to master it will be your own. Some of the rules and tricks will be demonstrated in the lectures. Our tutors will help you in the labs. A very useful Idea learning resource is a series of videos provided by the company Jetbrains (the maker of IntelliJ IDEA): Running IntelliJ IDEA for the First Time Creating a new project Choosing the project SDK Make, Compile and Rebuild Checking out from Version Control The full list of short tutorial videos Organising your workspace It make a lot of sense to organise your home directory for the COMP6700 (or COMP2140) studies. Given the content of our activities (check the labs and deliverables in the Schedule), you can create a dedicated directory comp6700 (or, comp2140) in your Home Directory, with the following structure: comp6700
/ | \
/ | \
/ | \
assignments hw labs
/ \ | / \
ass1 ass2 ... lab1 ...
This can be done by merely using the window manager (on Linux, this application is called Files; launch it the same way you’ve launched Terminal or Atom), or alternatively (and more in the spirit of programming) by using the command-line tools like mkdir (again, refer to the Basic Command-Line Commands guide, and/or ask your tutor to demonstrate). Updated: 17 Feb 2017/ Responsible Officer: Head of School/ Page Contact: Alexei Khorev Contact ANU Copyright Disclaimer Privacy Freedom of Information +61 2 6125 5111 The Australian National University, Canberra CRICOS Provider : 00120C ABN : 52 234 063 906 You appear to be using Internet Explorer 7, or have compatibility view turned on. Your browser is not supported by ANU web styles. » Learn how to fix this » Ignore this warning in future