Laboratorio II Introduzione all`ambiente di sviluppo

Laboratorio II
Raffaella Brighi, a.a. 2005/06
Corso di Laboratorio II. A.A. 2006-07
CdL Operatore Informatico Giuridico.
Introduzione all’ambiente di
sviluppo
Raffaella Brighi, a.a. 2005/06
Corso di Laboratorio II. A.A. 2006-07
CdL Operatore Informatico Giuridico.
1
Kit per sviluppare un programma JAVA
„
JSDK – Java Software Development kit release J2SE v 1.6 (o 1.5)
SDK
IDE – Netbeans 5.5 --- GLI IDE (Integrated Software Enviroment)
sono ambienti di sviluppo integrati che mettono insieme Editor,
compilatore, interprete, debugger, documentazione, ecc. in una
unica soluzione.
„
Il pacchetto completo può essere scaricato da:
http://www.netbeans.info/downloads/index.php oppure
http://java.sun.com/javase/downloads/index.jsp
„
„
„
Nota: Il testo Lewis fa riferimento alla JDK 1.4.2. Per il download d
questa versione con netbeans 5.0
http://java.sun.com/j2se/1.4.2/download-netbeans.html
JSDK
„
Java SDK - Software Development Kit
(http://java.sun.com/j2se/downloads/)
contiene: J2SE Runtime Environment (JRE)
and J2SE Development Kit (JDK).
‰
‰
‰
compilatore Java
debugger
interprete Java
2
Java SE Overview
http://java.sun.com/javase/technologies/index.jsp
„
The following Java technologies and
application programming interfaces
(APIs) are the foundation of the Java
Platform, Standard Edition (Java SE).
They provide all you need to create
server applications, desktop
applications, and applets that run on
almost every popular operating system,
including Linux, Macintosh, Solaris, and
Windows.
There are two principal products in the Java SE platform family: Java
SE Runtime Environment (JRE) and Java Development Kit (JDK).
Java Runtime Environment (JRE)
The Java Runtime Environment (JRE) provides the libraries, the Java
Virtual Machine, and other components to run applets and applications
written in the Java programming language. In addition, two key
deployment technologies are part of the JRE: Java Plug-in, which
enables applets to run in popular browsers; and Java Web Start, which
deploys standalone applications over a network. It is also the
foundation for the technologies in the Java 2 Platform, Enterprise
Edition (J2EE) for enterprise software development and deployment.
The JRE does not contain tools and utilities such as compilers or
debuggers for developing applets and applications.
Java Development Kit (JDK)
The JDK is a superset of the JRE, and contains everything that is in the
JRE, plus tools such as the compilers and debuggers necessary for
developing applets and applications. The conceptual diagram above
illustrates all the component technologies in Java SE platform and
how they fit together.
3
http://java.sun.com/javase/technologies/index.jsp
Java SE API
The Java SE application programming interface (API) defines the
manner by which an applet or application can make requests to and
use the functionality available in the compiled Java SE class libraries.
(The Java SE class libraries are also part of the Java SE platform.)
The Java SE API consists of core technologies, Desktop (or client)
technologies, and other technologies.
Core components provide essential functionality for writing powerful
enterprise-worthy programs in key areas such as database access,
security, remote method invocation (RMI), and communications.
Desktop components add a full range of features to help build
applications that provide a rich user experience – deployment
products such as Java Plug-in, component modeling APIs such as
JavaBeans, and a graphical user interface.
Other components round out the functionality.
Java Virtual Machine
The Java Virtual Machine is responsible for the hardware- and
operating system-independence of the Java SE platform, the small size
of compiled code (bytecodes), and platform security.
Java Platform Tools
The Java SE platform works with an array of tools, including
Integrated Development Environments (IDEs), performance and
testing tools, and performance monitoring tools.
4
Java API Documentation
„
„
„
„
„
E’ la documentazione API (application programming
interface) di Java. Documenta tutte le classi della
libreria standard di Java, descrivendo brevemente lo
scopo della classe e riportando l’elenco dei suoi
metodi e di come devono essere richiamati
(interfaccia della classe).
http://java.sun.com/j2se/1.4.2/docs/api/
http://java.sun.com/j2se/1.5/docs/api/
Può essere scaricata dal sito e collegata a netbeans
(http://java.sun.com/javase/downloads/index.jsp).
nota: potrà essere consultata durante l’esame
NetBeans 5.0
„
„
in
http://www.netbeans.org/kb/50/index.html
è disponibile un’ampia documentazione per
utilizzare il sw.
Si segnala in particolare:
‰
‰
http://www.netbeans.org/kb/50/quickstart.html
http://www.netbeans.org/kb/50/usingnetbeans/index.html
5
Quick Start
„
1.
Creare una nuova applicazione Java
creare un nuovo progetto: File > New Project, sotto Categories,
scegliere General. Sotto Projects scegliere:
a)
b)
Java Class Library: crea un progetto vuoto in cui aggiungere classi
Java Application: crea un progetto con tutti gli elementi necessari
all’avvio (classe main ecc.)
Al momento utilizziamo la strada b)
Chekkare ‘Set as Main Project’ e Create Main Class (dando un nome
alla classe di avvio!).
„
‰
‰
„
„
„
Editing del codice
scrivere nuove istruzioni
aggiungere classi/campi/metodi
Compilare un progetto o una classe
Eseguire il progetto
Debug
6