Java SE 6 Features
This lab has a set of sample Java SE 6 applications you can play
around. They are provided as "Ready-to-build-and run" NetBeans
project.
Expected duration: 60 minutes
(excluding homework)
Software Needed
Before you begin, you need to install the following software on your
computer.
- Java Standard Development Kit (JDK™) version 6.0 (download)
- NetBeans IDE 5.5 (download)
- When you install NetBeans IDE, it will ask you which JDK
you want to use. Select the JDK 5.0.
- 1512_javase6scripting.zip (download)
- The zip file contains this document and the lab contents
- Download it and unzip in a directory of your choice
OS platforms you can use
- Windows
- Solaris x86, Solaris Sparc
- Linux
- Mac OS X
Change Log
Lab Exercises
Exercise 1: Build and run
"HelloWorld" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application.
(1.1)
Open, build, and run "HelloWorld" sample JSP application
0. Start NetBeans IDE.
1. Open HelloWorld
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Windows: If you unzipped the 1512_javase6scripting.zip
file under
C:\
directory, the directory to which you want
to browse down should be C:\javase6scripting\samples.
- Solaris/Linux: If you unzipped the 1512_javase6scripting.zip
file under $HOME
directory, the directory to which you want
to browse down should be $HOME/javase6scripting/samples.
- Select HelloWorld.
- Click Open Project Folder.
The HelloWorld
project node appears under Projects tab
window.
2. Build and run HelloWorld project.
- Right-click HelloWorld
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "HelloWorld" sample
application.
return to the top
Exercise 2: Build and run
"InvokeScriptFile" sample application
In this exercise, you are going to build
and run "ready-to-build" Struts sample application.
(2.1)
Open, build, and run "InvokeScriptFile" sample JSP application
0. Start NetBeans IDE.
1. Open InvokeScriptFile
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select InvokeScriptFile.
- Click Open Project Folder.
The InvokeScriptFile
project node appears under Projects tab
window.
2. Build and run InvokeScriptFile project.
- Right-click InvokeScriptFile
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "InvokeScriptFile" sample
application.
return to
the top
Exercise 3: Build and run
"CallMethodByInvocable" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(3.1)
Open, build, and run "CallMethodByInvocable" sample JSP application
0. Start NetBeans IDE.
1. Open CallMethodByInvocable
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select CallMethodByInvocable.
- Click Open Project Folder.
The CallMethodByInvocable
project node appears under Projects tab
window.
2. Build and run CallMethodByInvocable project.
- Right-click CallMethodByInvocable
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "CallMethodByInocable" sample
application.
return to
the top
Exercise 4: Build and run
"GetListOfScriptEngines" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(4.1)
Open, build, and run "GetListOfScriptEngines" sample JSP application
0. Start NetBeans IDE.
1. Open GetListOfScriptEngines
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select GetListOfScriptEngines.
- Click Open Project Folder.
The GetListOfScriptEngines
project node appears under Projects tab
window.
2. Build and run GetListOfScriptEngines project.
- Right-click GetListOfScriptEngines
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "GetListOfScriptEngines" sample
application.
return to
the top
Exercise 5: Build and run
"SearchScriptEngineviaFactory" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(5.1)
Open, build, and run "SearchScriptEngineviaFactory" sample JSP
application
0. Start NetBeans IDE.
1. Open SearchScriptEngineviaFactory
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select SearchScriptEngineviaFactory.
- Click Open Project Folder.
The SearchScriptEngineviaFactory
project node appears under Projects tab
window.
2. Build and run SearchScriptEngineviaFactory project.
- Right-click SearchScriptEngineviaFactory
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "SearchScriptEngineviaFactory" sample
application.
return to
the top
Exercise 6: Build and run
"AccessJavaObjectsFromScript" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(5.1)
Open, build, and run "AccessJavaObjectsFromScript" sample JSP
application
0. Start NetBeans IDE.
1. Open AccessJavaObjectsFromScript
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select AccessJavaObjectsFromScript.
- Click Open Project Folder.
The AccessJavaObjectsFromScript
project node appears under Projects tab
window.
2. Build and run AccessJavaObjectsFromScript project.
- Right-click AccessJavaObjectsFromScript project
and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "AccessJavaObjectsFromScript" sample
application.
return to
the top
Exercise 7: Build and run
"ImportJavaPackage" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(5.1)
Open, build, and run "ImportJavaPackage" sample JSP application
0. Start NetBeans IDE.
1. Open ImportJavaPackage
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select ImportJavaPackage.
- Click Open Project Folder.
The ImportJavaPackage
project node appears under Projects tab
window.
2. Build and run ImportJavaPackage project.
- Right-click ImportJavaPackage
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "ImportJavaPackage" sample
application.
return to
the top
Exercise 8: Build and run
"ScriptPad" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(5.1)
Open, build, and run "ScriptPad" sample JSP application
0. Start NetBeans IDE.
1. Open ScriptPad
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select ScriptPad.
- Click Open Project Folder.
The ScriptPad
project node appears under Projects tab
window.
2. Build and run ScriptPad project.
- Right-click ScriptPad
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "ScriptPad" sample
application.
return to
the top
Exercise 9: Build and run
"Caculator" sample application
In this exercise, you are going to build
and run "ready-to-build" sample application. You will then
build the same application from scratch.
(5.1)
Open, build, and run "Calculator" sample JSP application
0. Start NetBeans IDE.
1. Open Calculator
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/javase6scripting/samples
directory.
- Select Calculator.
- Click Open Project Folder.
The Calculator
project node appears under Projects tab
window.
2. Build and run Calculator project.
- Right-click Calculator
project and select Run Project.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "Calculator" sample
application.
return to
the top
Homework
Exercise (for people
who
are taking Sang Shin's "Java Programming online course")
<to
be provided>