INFO Object-Oriented Programming

Similar documents
1 Installation (briefly)

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Android Studio Setup Procedure

USING THE OOSIML/JAVA. With a Terminal Window

Getting Started with Eclipse/Java

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

IT151: Introduction to Programming (java)

Android SDK under Linux

This section contains information you should review before using this book. Any updates to the information presented here will be posted at:

Life Without NetBeans

Instructions. First, download the file

JVM interprets the Java bytecode, controls how it interacts with the operating system and manages memory.

EECS 1710 SETTING UP A VIRTUAL MACHINE (for EECS labs)

Installing Eclipse (C++/Java)

How To Reinstall Grub In Windows 7 Without Losing Data And Programs

Gradle and Command Line Workshop Activity

Computer Science 62 Lab 8

Jdk Linux Ubuntu Bit Desktop Iso >>>CLICK HERE<<<

Certified Core Java Developer VS-1036

Manual Unetbootin Windows 7 Iso To Usb Stick Install

Eclipse Environment Setup

Getting Started with Linux Development

VIRTUALBOX UBUNTU EBOOK

Getting Started with Java. Atul Prakash

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Intel Do-It-Yourself Challenge Robotics Hello World

Introduction to Java Programming

Manual Unetbootin Windows 7 Iso To Usb Stick Installieren

Software Installation for CS121

Linux Development Getting Started

Running Java Programs

Contents Coding standard Debugging tool Text editor Version control system

Building CircuitPython

CS197U: A Hands on Introduction to Unix

How To Manually Boot From Cd Windows 7 Iso

Lab E2: bypassing authentication and resetting passwords

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

An Introduction to Software Engineering. David Greenstein Monta Vista High School

Installation Instructions

Manually Mount Usb Flash Drive Ubuntu Server Command Line

Android Sdk Install Documentation Eclipse. Ubuntu >>>CLICK HERE<<<

Installation Instructions

Department of Computer Science. Software Usage Guide. CSC132 Programming Principles 2. By Andreas Grondoudis

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

Operating Systems Linux 1-2 Measurements Background material

How To Install Latex Windows Xp From Usb Stick Memory

Manual Install Ubuntu Alongside Windows 7 From Usb

Notes of the course - Advanced Programming. Barbara Russo

CSC116: Introduction to Computing - Java

Why You Should Not Use Arch

You should now start on Chapter 4. Chapter 4 introduces the following concepts

Lesson 04: Our First Java Program (W01D4

Ubuntu Install Instructions Mac Usb In Windows 7 Via

1 Getting Started with Linux.

How To Reinstall Grub In Windows 7 With Cd Bootcamp Partition

Lecture 1: Introduction to Java

Systems Programming. The Unix/Linux Operating System

Welcome to Kmax Installing Kmax

Parallel Programming

Manually Mount Usb Device Linux Command Line Ubuntu 12.04


How To Install Windows Updates 8 From Usb

Getting Started with Python

Ubuntu Install Instructions Mac Usb In Windows 7 Using

Programming Principles 1 (CSC131) & 2 (CSC132) Software usage guide

Intro to Linux & Command Line

Installing an IDE ELECTRICAL ENGINEERING AND COMPUTER SCIENCE DEPARTMENT. A practical guide to installing NetBeans for Java and C/C++

What s NetBeans? Like Eclipse:

Format Hard Drive After Install Ubuntu From Usb

Parallel Programming Pre-Assignment. Setting up the Software Environment

DOC UBUNTU LINUX FOR DUMMIES

Using VMware Player 3.0 with USB Pocket Hard Drive For IT Curriculum

Format Hard Drive After Install Ubuntu From Usb External

USING THE OOSIML/JAVA COMPILER. With the Command Window

Monroe Township High School AP Computer Science A Summer Packet

CS260 Intro to Java & Android 02.Java Technology

Before you start with this tutorial, you need to know basic Java programming.

How To Update My Java Plug In Firefox Ubuntu 12.04

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Ubuntu Install Instructions Macbook Air Windows 7 Boot Camp Assistant

CS 170 Java Tools. Step 1: Got Java?

VIRTUAL MACHINES. By Seth Lemanek

CSC116: Introduction to Computing - Java

Using Eclipse for Java. Using Eclipse for Java 1 / 1

Manually Mount Usb Flash Drive Ubuntu Server 12.04

Why would I want too? There are many ways a bootable memory stick might come in useful:

User s Manual. Hi-Speed USB 2.0 Flash Disk

2 Installing the Software

How To Fix Regedit Windows Xp Install Cd With Sp3 On Usb

Step by step to getting R installed on your computer

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Using Eclipse for C Programming

DOWNLOAD OR READ : UBUNTU I IN YOU AND YOU IN ME PDF EBOOK EPUB MOBI

Some reasons to repair your boot-loader might include installing Microsoft Windows after you have installed Ubuntu, adding or removing a hard drive.

C++ Spring Break Packet 11 The Java Programming Language

Java Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs.

Introduction to Linux

Using Ruby and irb in CSE 341 Winter 2015

Transcription:

INFO0062 - Object-Oriented Programming Programming in Java with a terminal Jean-François Grailet University of Liège Faculty of Applied Sciences Academic Year 2018-2019

1 / 13 About using a terminal Under a Linux distribution or macos, you can use a terminal. To put it simply, it s a small window where you can type various commands. Such a mecanism also exists under Windows, but is less convenient to use. Using a terminal to program in Java has multiple advantages: You only need to install Java on your computer. The only other program you might want to add afterwards is a code editor. It s very simple to use. You don t have to handle your programs as projects. Just provide all relevant source files to the compiler. That s it!

Installation of Java

2 / 13 How to install Java To install Java SE (Standard Edition), you can Windows/macOS: download it on Oracle s website. Linux: install it via an online repository. N.B.: Java s lattest versions are 64-bit only. I.e., only compatible with a device that has a 64-bit hardware. Hopefully, most computers (including laptops) are 64-bit nowadays. If your device is quite old, it might be worth to double check it. N.B.: quite old here means more than several years (e.g. 5).

3 / 13 How to install Java SE Windows/macOS Download and install Java SE 11 32-bit Windows: download and install Java SE Development Kit 8u201 for x86 Linux You can use an online repository to download and install Java SE 11 32-bit devices: prefer using your OS default repositories. $ sudo apt-get update $ sudo apt-get install default-jre $ sudo apt-get install default-jdk

Compiling/running Java in a terminal

4 / 13 Two commands You will need to know and use two distinct commands: javac: the Java compiler. java: the Java command, used to run a Java program. The reason why there are two commands is Java s design. As explained in the course, Java code is compiled into bytecode. This code isn t directly executable and needs to be interpreted. The java command is the interpreter here. Java was designed this way to ensure portability of applications. I.e., ensuring a same program can run on computers with differing environments.

5 / 13 Compiling and running a simple Java program Suppose you want to compile a single class: open a terminal. Using the cd command, place yourself in the directory containing your code. cd is for "change directory". To check the contents of the current folder, you can also use ls. You will find many tutorials online about these simple but common commands. Tutorial in French $ cd MyJavaDirectory/

6 / 13 Compiling and running a simple Java program (II) Suppose our class is named MyClass. To compile it, run this command: $ javac MyClass.java If compilation is successful, you can run it with: $ java MyClass That s it!

7 / 13 Compiling and running a Java program made of several classes At compilation, you must provide all source files to javac. Upon running the program, you only need to provide the main class. For instance, let s say we have a program consisting of the following classes: MyMain (main class) ClassA, ClassB Run these commands: $ javac ClassA.java ClassB.java MyMain.java $ java MyMain

8 / 13 Compilation options javac places.class files in the same folder as the.java files. If you want to separate both kinds of files, you can create an output directory. Use the -d flag of javac to do so. If we want MyClass.class in a bin/ folder: $ javac -d bin MyClass.java To run a.class file located in a bin/, you will have to type $ java -cp bin MyClass -cp is another flag of javac used to specify where to look for.class.

9 / 13 Compilation options (II) Note that you can provide paths to javac. For instance, if you place your.java files in a folder src/: $ javac -d bin src/myclass.java In fact, placing.java in src/ and.class in bin/ is a common practice. Both kinds of files are clearly isolated from each other. Home folder can consist of documentation, usage examples, etc. By default, Eclipse creates src/ and bin/ folders when creating a project.

About Linux

A few words on Linux At this point in your cursus, you probably have heard about Linux a lot. Teacher(s) introduced you to the Linux terminal and its command lines. You most probably had laboratory sessions with Linux distributions.... and maybe some zealots tried to convert you to Linux! Why is it a big deal in computer science? Most Linux distributions are free. Programming under Linux is usually much easier. This is especially true for simple programs. With practice, using a terminal is also handier 1 than a GUI. Computer scientists should consider using Linux. 1 FR: plus pratique, plus commode 10 / 13

11 / 13 How can I use Linux? You can discover and use Linux without modifying or dumping your current OS. Running a Linux distribution in a virtual machine (FR) Using a bootable USB stick (EN) You can also dual boot (FR) your computer. Both your original OS and Linux will co-exist on your computer. You will select the OS to run when powering-up your computer. Requires to partition your disk space. Don t do this now if you are not confident about modifying your disk.

12 / 13 Which Linux distribution should I pick? Typically, Ubuntu ("Linux for human beings") is recommended for beginners. Has a complete GUI for browsing files and running programs, and even a store Terminal is not essential for a beginner to use it Other popular distributions you can consider using Mint Fedora

Code editors you can use

13 / 13 Code editors you can use To write Java code conveniently, get a text editor with code coloration. macos - TextWrangler Linux - Geany Linux - Emacs In some Linux distributions like Ubuntu, you can also use Gedit (native). If you also need such a text editor for Windows, consider trying Notepad++.