SlideShare a Scribd company logo
Java goes wild 
Lesson 1: Introduction to Java 
Thierry Wasylczenko
After this course ... 
You will: 
• Know what is the JDK/JRE 
• Be able to set up your development environment 
• Know how to compile and run a Java program 
2
Agenda 
• Bascis 
• How does all of this work? 
• Developer’s environment 
3
Basics 
Success is neither magical nor mysterious. Success is the natural 
consequence of consistently applying the basic fundamentals. 
Jim Rohn “ 
4
Basics 
• Source code is inside files with .java extension 
• The source code is compiled into .class files 
• The class files are executed by a strange thing (covered later) 
5
A Java file 
public class Foo { 
public static void main(String[] args) { 
System.out.println("Hello World!"); 
} 
} 
6
How do I get class files? 
• By compiling all Java files 
$ cd /location/of/java/files 
$ javac Foo.java 
$ ls 
Foo.class Foo.java 
$ 
7
How do I run it? 
• With the java command 
$ java Foo 
Hello World! 
$ 
• Yes you DON’T put the .class extension when you run a class ! 
8
Java Archive 
• aka JAR 
• A collection of compiled Java classes 
• Package of a Java program 
• Can be runnable 
java -jar Foo.jar 
9
That's 
freaking 
AWESOME !
That’s awesome dude. But how 
does all of this work? 
You “ 
11
12 
How does all of this work? 
It is not the beauty of a building you should look at; it's the construction 
of the foundation that will stand the test of time. 
David Allan Coe “
The source code 
• Plain text file 
• File extension: .java 
• Rules for naming each file (covered later) 
13
The bytecode 
14 
• Result of compilation 
• Something in between the source code and the machine’s language 
• Interpreted by the Java Virtual Machine
The Java Virtual Machine 
• aka the JVM 
• Kind of a black box 
• Interprets the Java bytecode 
• Is available on major platforms 
• "Compile once, run everywhere" 
15
A little schema 
Source 
code 
Source 
code 
Byte code JVM 
Byte code JVM 
turns on 
turns on 
java 
java 
javac 
javac 
16
Well man, you’re talking about 
JVM, javac, bytecode and cool 
stuff. But how do I set them up? 
You “ 
17
18 
Developer's environment 
When people think about computer science, they imagine people with 
pocket protectors and thick glasses who code all night. 
Marissa Mayer “
Java Development Kit 
• aka JDK 
• Provides tools 
• javac: java compiler 
• javadoc: generates the documentation 
• ... 
• Includes a Java Runtime Environment 
19
Java Runtime Environment 
• aka JRE 
• Provides tools: 
• java: for running Java applications 
• ... 
20
JAVA_HOME 
• An environment variable 
• Points to the JDK installation 
• Required by some tools such as: 
• IDEs 
• build tools (maven, gradle, ...) 
• ... 
• Used to update the PATH variable 
21
JAVA_HOME: example 
# Unix 
export JAVA_HOME="/path/to/jdk" 
export PATH=$JAVA_HOME/bin:$PATH 
REM Windows 
set JAVA_HOME="C:pathtojdk" 
set PATH=%JAVA_HOME%bin;%PATH% 
22
Avoid spaces in the path of your 
JAVA_HOME. 
JAVA_HOME 
23
JAVA_HOME: test the setup 
To test the setup you can execute the following command: 
24 
$ java -version 
java version "1.8.0_11" 
Java(TM) SE Runtime Environment (build 1.8.0_11-b12) 
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
What does JRE stand for? 
• Java Runtime Embeded 
• Java Routine Exclusive 
• Java Runtime Environment 
Start Stop 
25
What is the correct command to 
execute a Java program? 
• java Foo.java 
• java Foo 
• java Foo.class 
Start Stop 
26
1. Set the JAVA_HOME in your 
environment 
2. Verify your setup 
Practice #1 
27
Practice #2 
Given the following code: 
public class Foo { 
public static void main(String[] args) { 
System.out.println("Hello World!"); 
} 
} 
28
1. Copy it in your favorite editor 
2. Save the file as Foo.java 
3. Compile it 
4. Run it 
Practice #2 
29
30
31 
Appendix
Appendix 
• Java Code conventions 
• Not maintained since 1997, may not be accurate 
32

More Related Content

What's hot

Maven
Maven Maven
Maven
Khan625
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
DaliaAboSheasha
 
Using Play Framework 2 in production
Using Play Framework 2 in productionUsing Play Framework 2 in production
Using Play Framework 2 in production
Christian Papauschek
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
Saeed Zarinfam
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC Mobile
Steve De Zitter
 
Omfw 2013
Omfw 2013Omfw 2013
Omfw 2013
504ensics
 
JavaScript unit testing with Jasmine
JavaScript unit testing with JasmineJavaScript unit testing with Jasmine
JavaScript unit testing with JasmineYuval Dagai
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
Ryan Cuprak
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
Ryan Cuprak
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
Khan625
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell script
David Cobb
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework application
VulcanMinds
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
Hackito Ergo Sum
 

What's hot (13)

Maven
Maven Maven
Maven
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
 
Using Play Framework 2 in production
Using Play Framework 2 in productionUsing Play Framework 2 in production
Using Play Framework 2 in production
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC Mobile
 
Omfw 2013
Omfw 2013Omfw 2013
Omfw 2013
 
JavaScript unit testing with Jasmine
JavaScript unit testing with JasmineJavaScript unit testing with Jasmine
JavaScript unit testing with Jasmine
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell script
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework application
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
 

Similar to Java goes wild, lesson 1

Introduction to java
Introduction to java Introduction to java
Introduction to java
Java Lover
 
Pj01 2-install java and write first java program
Pj01 2-install java and write first java programPj01 2-install java and write first java program
Pj01 2-install java and write first java program
SasidharaRaoMarrapu
 
OOP Lecture 1-Intro to Java.pptx
OOP Lecture 1-Intro to Java.pptxOOP Lecture 1-Intro to Java.pptx
OOP Lecture 1-Intro to Java.pptx
Tanzila Kehkashan
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
kamal kotecha
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
jyoti_lakhani
 
1.Intro--Why Java.pptx
1.Intro--Why Java.pptx1.Intro--Why Java.pptx
1.Intro--Why Java.pptx
YounasKhan542109
 
Fundamentals of java --- version 2
Fundamentals of java --- version 2Fundamentals of java --- version 2
Fundamentals of java --- version 2Uday Sharma
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaattiqrocket
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
Fu Cheng
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
Chun-Yu Wang
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
Charles Nutter
 
JavaFX - Sketch Board to Production
JavaFX - Sketch Board to ProductionJavaFX - Sketch Board to Production
JavaFX - Sketch Board to Production
Yoav Aharoni
 
01. Introduction to programming with java
01. Introduction to programming with java01. Introduction to programming with java
01. Introduction to programming with java
Intro C# Book
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basicstosine
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Anton Arhipov
 

Similar to Java goes wild, lesson 1 (20)

Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Pj01 2-install java and write first java program
Pj01 2-install java and write first java programPj01 2-install java and write first java program
Pj01 2-install java and write first java program
 
OOP Lecture 1-Intro to Java.pptx
OOP Lecture 1-Intro to Java.pptxOOP Lecture 1-Intro to Java.pptx
OOP Lecture 1-Intro to Java.pptx
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
java swing
java swingjava swing
java swing
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
1.Intro--Why Java.pptx
1.Intro--Why Java.pptx1.Intro--Why Java.pptx
1.Intro--Why Java.pptx
 
Java part 1
Java part 1Java part 1
Java part 1
 
Fundamentals of java --- version 2
Fundamentals of java --- version 2Fundamentals of java --- version 2
Fundamentals of java --- version 2
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
JavaFX - Sketch Board to Production
JavaFX - Sketch Board to ProductionJavaFX - Sketch Board to Production
JavaFX - Sketch Board to Production
 
01. Introduction to programming with java
01. Introduction to programming with java01. Introduction to programming with java
01. Introduction to programming with java
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basics
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
 

More from Thierry Wasylczenko

Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9
Thierry Wasylczenko
 
JavaFX et le JDK9
JavaFX et le JDK9JavaFX et le JDK9
JavaFX et le JDK9
Thierry Wasylczenko
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
Thierry Wasylczenko
 
#JavaFX.forReal()
#JavaFX.forReal()#JavaFX.forReal()
#JavaFX.forReal()
Thierry Wasylczenko
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
Thierry Wasylczenko
 
#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application
Thierry Wasylczenko
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
Thierry Wasylczenko
 

More from Thierry Wasylczenko (8)

Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9
 
JavaFX et le JDK9
JavaFX et le JDK9JavaFX et le JDK9
JavaFX et le JDK9
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
 
#JavaFX.forReal()
#JavaFX.forReal()#JavaFX.forReal()
#JavaFX.forReal()
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
 

Recently uploaded

Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
azkamurat
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 

Recently uploaded (20)

Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 

Java goes wild, lesson 1

  • 1. Java goes wild Lesson 1: Introduction to Java Thierry Wasylczenko
  • 2. After this course ... You will: • Know what is the JDK/JRE • Be able to set up your development environment • Know how to compile and run a Java program 2
  • 3. Agenda • Bascis • How does all of this work? • Developer’s environment 3
  • 4. Basics Success is neither magical nor mysterious. Success is the natural consequence of consistently applying the basic fundamentals. Jim Rohn “ 4
  • 5. Basics • Source code is inside files with .java extension • The source code is compiled into .class files • The class files are executed by a strange thing (covered later) 5
  • 6. A Java file public class Foo { public static void main(String[] args) { System.out.println("Hello World!"); } } 6
  • 7. How do I get class files? • By compiling all Java files $ cd /location/of/java/files $ javac Foo.java $ ls Foo.class Foo.java $ 7
  • 8. How do I run it? • With the java command $ java Foo Hello World! $ • Yes you DON’T put the .class extension when you run a class ! 8
  • 9. Java Archive • aka JAR • A collection of compiled Java classes • Package of a Java program • Can be runnable java -jar Foo.jar 9
  • 11. That’s awesome dude. But how does all of this work? You “ 11
  • 12. 12 How does all of this work? It is not the beauty of a building you should look at; it's the construction of the foundation that will stand the test of time. David Allan Coe “
  • 13. The source code • Plain text file • File extension: .java • Rules for naming each file (covered later) 13
  • 14. The bytecode 14 • Result of compilation • Something in between the source code and the machine’s language • Interpreted by the Java Virtual Machine
  • 15. The Java Virtual Machine • aka the JVM • Kind of a black box • Interprets the Java bytecode • Is available on major platforms • "Compile once, run everywhere" 15
  • 16. A little schema Source code Source code Byte code JVM Byte code JVM turns on turns on java java javac javac 16
  • 17. Well man, you’re talking about JVM, javac, bytecode and cool stuff. But how do I set them up? You “ 17
  • 18. 18 Developer's environment When people think about computer science, they imagine people with pocket protectors and thick glasses who code all night. Marissa Mayer “
  • 19. Java Development Kit • aka JDK • Provides tools • javac: java compiler • javadoc: generates the documentation • ... • Includes a Java Runtime Environment 19
  • 20. Java Runtime Environment • aka JRE • Provides tools: • java: for running Java applications • ... 20
  • 21. JAVA_HOME • An environment variable • Points to the JDK installation • Required by some tools such as: • IDEs • build tools (maven, gradle, ...) • ... • Used to update the PATH variable 21
  • 22. JAVA_HOME: example # Unix export JAVA_HOME="/path/to/jdk" export PATH=$JAVA_HOME/bin:$PATH REM Windows set JAVA_HOME="C:pathtojdk" set PATH=%JAVA_HOME%bin;%PATH% 22
  • 23. Avoid spaces in the path of your JAVA_HOME. JAVA_HOME 23
  • 24. JAVA_HOME: test the setup To test the setup you can execute the following command: 24 $ java -version java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
  • 25. What does JRE stand for? • Java Runtime Embeded • Java Routine Exclusive • Java Runtime Environment Start Stop 25
  • 26. What is the correct command to execute a Java program? • java Foo.java • java Foo • java Foo.class Start Stop 26
  • 27. 1. Set the JAVA_HOME in your environment 2. Verify your setup Practice #1 27
  • 28. Practice #2 Given the following code: public class Foo { public static void main(String[] args) { System.out.println("Hello World!"); } } 28
  • 29. 1. Copy it in your favorite editor 2. Save the file as Foo.java 3. Compile it 4. Run it Practice #2 29
  • 30. 30
  • 32. Appendix • Java Code conventions • Not maintained since 1997, may not be accurate 32