Friday Jul 31, 2015

Java SE 8: Creating a Basic REST Web Service using Grizzly, Jersey, and Maven

Duke Waving

My latest Java tutorial is now up on Oracle.com. This tutorial covers how to make a basic REST application using Grizzly, Jersey, and Maven. If you are new to any if these tools, this tutorial is a great way to try them out. You can launch the tutorial from here:

Java SE 8: Creating a Basic REST Web Service using Grizzly, Jersey, and Maven

In the tutorial you create an application using the open source Grizzly web server and the Apache Jersey library to create a RESTful web service. The Jersey library is the reference implementation of the JAX-RS Java REST web service API. Jersey makes creating RESTful web services really easy and the tutorial takes you through the process step by step.

Finally, Apache Maven is a Java build tool that makes it really easy to create and manage projects. It also allows you to create new projects using well known tools and templates and automates the process of downloading required libraries. Finally, you use Maven to create create an uber jar file which stores all the required libraries for an application in a single file.

Monday Jun 08, 2015

Announcing: JDK 8 MOOC: Lambdas and Streams!

https://apexapps.oracle.com/pls/apex/f?p=44785:145:0::::P145_EVENT_ID,P145_PREV_PAGE:4887,143

We are pleased to announce that the Oracle Massive Open Online Course: JDK 8 Lambdas and Streams is open for enrollment!

The course will start July 14th!

Enroll
If you are like me, you are an experienced Java programmer, and understand Java as an Object-oriented language, but you are not really familiar with Lambda expressions. You may also have watched Brian Goetz's talk, Lambda: A Peek Under the Hood from JavaOne 2012, but you didn't quite get it.

Well, now is your chance to join me and thousands of your peers to learn more about Functional Programming in Java using Lambda expressions and the Streams API in our latest free Massive Open Online Course (MOOC).  The course will start July 14th, and is short - just three weeks. But you will learn a lot, including how to:

  •  Apply Lambdas to everyday problems
  • Convert anonymous classes to Lambda expressions
  • Apply the Streams API to solve problems of sorting, identifying the most and least, and reducing duplicates
  • Determine when to apply Lambdas (and when not to!)
  • Use Collectors
  • Improve performance with parallel streams
  • Debug Lambda expressions

So click the Enroll button - read the full description of the course and watch the video - and I will see you on July 14th!

Wednesday May 06, 2015

Announcing: Java SE8 Oracle Certified Professional Exam Beta

Want to be recognized as a Java SE8 Oracle Certified Professional?

Take advantage of this limited offer to beta test the Java SE8 Oracle Certified Professional exam!

This beta exam offer applies to Java SE 8 Oracle Certified Associates and is available now until June 13, 2015 at a discounted price of US$50.

 Three Things You Need to Know:

  1. 7%: Salary growth for Oracle Certified Professionals in 2015 - According to the Certification Magazine 2015 Annual Salary Survey.
  2. Java SE8 reduces your development time by using lambdas programming.  In the technical keynote address for JavaOne 2013, Mark Reinhold, chief architect for the Java Platform Group at Oracle, described lambda expressions as the single largest upgrade to the Java programming model ever.- http://www.javaworld.com/article/2092260/java-se/java-programming-with-lambda-expressions.html
  3. Join the close to 2 million people who are now Oracle certified.

Click here to register for the beta exam before June 13, 2015. 

Good luck!

The Oracle Certification Team

Click here for Frequently Asked Questions (FAQ).

Monday Oct 20, 2014

Using Device I/O with Java Embedded Suite on a Raspberry Pi

One of the "cool" features of Java ME Embedded 8 is the Device I/O (DIO) API. With DIO, you can write Java code to take advantage of the GPIO header on the Raspberry Pi, and connect LED's, switches, I2C and SPI devices, and serial devices that use a UART. This opens up the world of the Internet of Things to Java developers, and for less than $40 US!  See this tutorial series on Java ME Embedded 8 for more info on using the Raspberry Pi as development platform for the Internet of Things.

Java SE, both 7 and 8 are also available for the Raspberry Pi (ARM 6 architecture), and if you want to explore Java SE Embedded, and play with profiles, you can do that too. But what about Java EE and Web Services? How do I access devices using servlets and web services?

The answer is by combining two technologies. Recently, the Device I/O API has been under development as an Open JDK project - creating a standalone way to access the GPIO header using exactly the same API that makes Java ME Embedded so special. This allows developers to write DIO code outside of a Java ME Embedded VM.

The second technology is Java Embedded Suite 7.0. JES 7.0 is designed to run on ARM 6 and 7 environments and comes with a small footprint application server (Glassfish for Embedded Suite Application Server), Jersey RESTful Web Services Framework and Java DB Embedded database. GlassFish for Embedded Suite supports servlets 3.0, web services and bean validation.

Putting the two together, you can write a servlet or web service that controls and communicates with devices. In this post, I'll show you how to set up the JES 7.0 with DIO to turn an LED on and off using a servlet running on Oracle Java Embedded Suite on a Raspberry Pi.

Part 1: Install JDK 8 (if not already installed)

Start by installing JDK 8. If you are working with Raspbian Debian Wheezy (September 2014), then you already have JDK 8 installed. Otherwise, you can download the JDK 8 for ARM as a tar gzip file, and extract into /opt. Then install the compiler and JVM with these two commands:


Alternatively, you can install the JDK using these commands:

sudo apt-get update
sudo apt-get install oracle-java8-jdk
sudo chmod +s /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java

Make sure that JDK 8 is your default version by typing:

java -version

If you see that the default version is still JDK 7, you can change that with these two commands:

sudo update-alternatives --config javac
sudo update-alternatives --config java

Part 2: Install JDK DIO

Next, download the JDK DIO developer code. While the JDK DIO team recommends cross-compiling the code on a Linux 86 platform, I have found it easier just to compile it directly on the Raspberry Pi. Download the current dev build as a zip file and unzip it on the Pi.  The Makefile has a several targets, you want to use the target for the Pi: osgi_build_arm.  But first you need to modify the target to set PI_TOOLS to the correct path for GCC on the Raspberry Pi.

cd to the directory (on the RPi) where you unzipped the DIO zip file. In Makefile, find the osgi_build_arm section and change the make command to:
make bundle PI_TOOLS=/usr osgi.

Then run the Makefile with the target:

make osgi_build_arm

The important artifacts are the native libraries (build/so/libido.so) and the jar file (build/jar/dio.jar).

Copy the dio.jar file to your development machine (I used psftp to ftp it over).

Part 3: Install JES 7.0 and Test

Next step is to download Oracle Java Embedded Suite 7.0 ARMv6/7 Linux zip file and the Product Samples zip file to your development machine. Unzip the jes-7.0-ga-bin-b11-linux-arm-runtime-15_nov_2012.zip file and by default it will create a jes7.0 directory.  You will need the glassfish-jes.jar file from the glassfish/lib directory when you write code. The zip file contains a jre directory. You can delete this, since you are going to use your JDK instead. Then zip up the remaining files and directories and download the updated zip file to your Raspberry Pi along with the Product Samples zip (again, I used psftp, but you can use another ftp solution, such as vsftpd.)

Unzip the JES file and Product Samples on your Raspberry Pi and cd to the samples/dist/run directory.

Edit the config.sh file and modify JAVA_COMMAND:

JAVA_COMMAND="java -Xmx64m"

Then try running one of the samples, using the following line:

sudo ./gfhost.sh ../helloservlet.war

After a few seconds, your should see these lines:

Deploying ../helloservlet.war ...
Press <Enter> to exit server.

In a browser, you should be able to enter the IP address of your Pi (use port 8080) and helloservlet and see the response, Hello World from Servlet!.  Now it is time to write our own servlet that communicates with DIO.

Part 4: Write a servlet in NetBeans (or your favorite IDE)

The samples provided with JES 7.0 are built as NetBeans projects, so the easiest thing is to make a copy of the helloservlet project from the samples directory on your development machine and modify that.

First, add the dio.jar file to the Libraries. Add a class called GPIOLED to the com.oracle.jes.samples.helloservlet package. The code for this class is here.

In the HelloServlet class, modify the doGet method:

try (GPIOLED led = new GPIOLED(23)) {
    led.blink(10);
}

Build the project and ftp the helloservlet.war file to the jes7.0/samples/dist directory on your Raspberry Pi.

Step 5: Create a DIO java.policy file in the DIO dev directory

The java.policy file is used by DIO to determine what device permissions are required by the application. For this simple application, we just need to grant two permissions:

grant {
        permission jdk.dio.gpio.GPIOPinPermission "*:*";
        permission jdk.dio.DeviceMgmtPermission "*:*", "open";
};

Step 6: Modify the JES run command:

Modify the config.sh script (the one from step 3) and add the following lines:

DIO_JAR=/home/pi/<dio-dev_dir>/build/jar/dio.jar
DIO_LIB=/home/pi/<dio-dev_dir>/build/so
DIO_POLICY=/home/pi/<dio-dev_dir>/java.policy
DIO_REG=/home/pi/<dio-dev_dir>/config/dio.properties-raspberrypi

Be sure to replace <dio-dev_dir> with your DIO dev build directory.

Modify the gfhost.sh script (in the same directory as config.sh):

JES_CLASSPATH="$JES_CLASSPATH:../webhost.jar:$DIO_JAR"
$JAVA_COMMAND -DAS_DERBY_INSTALL=$JES_HOME/javadb -Djava.security.policy=$DIO_POLICY
-Djava.library.path=$DIO_LIB -Djkd.dio.registry=$DIO_REG -classpath $JES_CLASSPATH com.oracle.jes.util.webhost.GlassFishHost $*

Step 7: the circuit:

The final step is to wire the circuit. If you have never wired an LED with a breadboard, I highly recommend looking at this tutorial for recommended parts and instructions first.


This circuit is a single LED connected to GPIO #23 (pin 16) through a 560 ohm resistor connected to the LED's anode (long lead). The cathode (short lead) of the LED is connected to ground. You can test that the LED is oriented properly by temporarily removing the wire from GPIO #23 and connecting it to 3.3V. If the LED lights, then you have the LED oriented properly. Reconnect the wire to GPIO #23.

Step 8: Ready to test!

On the RPi, execute the modified gfhost.sh script as root:

sudo ./gfhost.sh ../helloservlet.war

After you see these lines:

Deploying ../helloservlet.war ...
Press <Enter> to exit server.

In a browser, enter the IP address of your Pi and helloservlet and if everything is in place, then the LED should blink 10 times.

Although this is a simple example, hopefully you can see the possibilities with Java Embedded Suite and DIO - web services to provide fine grained control and access to a variety of sensors, and JavaDB to store sensor data and configuration information. Java Embedded Suite and DIO make a great combination!


Wednesday Jul 30, 2014

Coming to JavaOne? Check out these training opportunities!

Duke teachingHere is an exclusive opportunity to get top-notch Java training while you’re in San Francisco. Java University is a one-day training event on Sunday September 28th from 9:00am to 4:00pm at Golden Gate University. This is your chance to get accelerated Java training in a seminar-style format taught by Oracle University instructors, community experts, and Oracle engineers. Don’t miss this chance to get in-depth training on hot Java topics while you are in town for JavaOne.

Here is the full list of session titles:

Make the most of your JavaOne experience by starting out with one of these top-notch courses.  Click here to register or add to your registration. See you there!

Friday Jul 18, 2014

Java ME Embedded with Raspberry Pi - now a public self-paced course!

In March and May of this year, we successfully offered the first Oracle Massive Open Online Course (MOOC), Develop Java ME Embedded Applications Using a Raspberry Pi to hundreds of Java developers.  The feedback from the MOOC has been extremely positive, and we will likely run additional MOOCs in the future.

Today I am pleased to announce that the materials that were presented in the MOOC are now available as a free, public, self-paced course offering. Click here to explore the content.  You will need an OTN account (also free) to access the downloadable content.

The course consists of 5 lessons, made up of videos and homework assignments that will guide you through the development of a realistic embedded application using Java ME Embedded 8, a Raspberry Pi and a handful of electronic components.  You provide the Raspberry Pi and the electronic components, and we provide over six hours of detailed HD video, downloadable examples, homework code and solutions. 

Although the materials are self-paced, we have a forum where you can ask for help and interact with from hundreds of students who participated in the MOOC, and experts from the Java ME Embedded engineering team and product development.

Check it out and happy learning! 

Tuesday Apr 15, 2014

Oracle Java ME Embedded MOOC - A second date added

We have added a second date for the 5-week Java ME Embedded MOOC. Register today!

Java Embedded leverages your experience with Java to open the world of the Internet of Things by providing direct access to electronic sensors and mechanical devices.

This free course, designed for Java developers, is delivered over 5-weeks. Take the course at your own pace - weekly we will add new lessons, quizzes and homework assignments.

You will work on a real-world application to:

  • Read input data from switches and drive LED's using the GPIO interface
  • Read temperature and barometric pressure from an I2C device
  • Read the device's current location using a GPS UART device
  • Store and manage data collected
  • Report data to a client through a variety of communication options
  • And more!

Wednesday Feb 12, 2014

Register today for the Oracle Java ME Embedded MOOC!

https://apex.oracle.com/pls/apex/f?p=44785:145:2756555862650::NO::P145_EVENT_ID,P145_PREV_PAGE:861,148

We are pleased to announce that the Oracle Massive Open Online Course: Develop Java Embedded Applications Using a Raspberry Pi is open for enrollment.

The course will start March 31st!

Enroll

Java Embedded leverages your experience with Java to open the world of the Internet of Things by providing direct access to electronic sensors and mechanical devices.

This free course, designed for Java developers, is delivered over 5-weeks. Take the course at your own pace - weekly we will add new lessons, quizzes and homework assignments.

You will work on a real-world application to:

  • Read input data from switches and drive LED's using the GPIO interface
  • Read temperature and barometric pressure from an I2C device
  • Read the device's current location using a GPS UART device
  • Store and manage data collected
  • Report data to a client through a variety of communication options
  • And more!

See you in class!

Friday Feb 07, 2014

Java EE 7 Survey

Greetings Java Developers,
We have created a short survey that will help us better understand which APIs and Java versions are the most important to you as a Java EE developer. This information will enable us to update our training material and certifications for Java EE 7 to better suit the Java community. If you can, please take the survey located at: https://www.surveymonkey.com/s/JavaEE2014UsageSurvey.

Your answers will remain anonymous, and you won't be contacted by Oracle as a result of answering this survey.


Monday Dec 09, 2013

Java Mission Control and Flight Recorder Demo Series

Over the past few weeks I have been working on a set of screencast videos demoing the key features of Java Mission Control and Flight Recorder 5.2. As you may know, as of Java 7 u40 Java Mission Control and Flight Recorder are now included free with the JDK 7 downloads. The demos show you the basics of how to use these powerful tools.

The Web tutorial version, which includes text notes and a few tips on how you can follow along with the demos at home, can be found here:

Oracle Learning Library: Java Mission Control and Flight Recorder Demo Series

To just see the demos only on YouTube, here is a link to the play list.

YouTube: Java Mission Control and Flight Recorder Demo Series

I hope you enjoy all the demos!

Monday Oct 21, 2013

Are you interested in a free course on Java Embedded on the Raspberry Pi?

www.raspberrypi.org We are developing a free, on-line course on developing Oracle Java Embedded applications using a Raspberry Pi as the development platform. Interested? Read more about the course and give us your feedback in this short survey.

Tuesday Sep 24, 2013

Your opinion counts!

In an effort to provide you, our Java community, with the best possible training curriculum for Java EE 7, and to develop two new certification job roles, we are offering Java developers a chance to voice their opinion through this survey.

Oracle Java certification provides a proven industry recognized measure of ability and skills. These Java Enterprise Edition certifications are highly sought after by individuals and companies alike. We know that as a candidate - you spend considerable time and expense learning and practicing your skills before attempting to take a certification exam, so it is essential that these exams truly measure the skills required by your job role.

Each certification exam is developed by Oracle experts and is put through a rigorous qualification process before being released. Oracle Certification provides you with credentials backed by Oracle, and provides you with the security that you, your employees and new-hires have the skills and knowledge to be successful with Oracle technology.

An Oracle certification is typically associated with a particular role related to a single technology. In the case of Java EE7, the technology is very broad and comprehensive. We are looking to you and the industry to validate our definition of these job roles. Our assumption and preliminary investigation shows that programmers and developers working with Java EE technology design and create applications using front-end technologies and/or server-side enterprise technologies.

We are looking for developers working with Java EE 7 technology today, or those planning to develop with Java EE 7 in the near future. So if you are experienced with Java EE, and are following development trends, spend 15 minutes to complete this survey and help us define how to serve your training and certification needs for Java EE 7.

 The survey will remain open though November 30th, 2013.

 Thanks!

Java Learning Library

Java Learning Library image

The Java learning library is a portal to free resources to help you learn about the Java technology. The Java Curriculum Developers maintain the Java Learning Library, which is hosted in the Oracle Learning Library. Catch up on the latest tutorials, videos, and self-studies that are created by Java Curriculum Developers, Technical Writers, Developers, and Evangelists.

Friday Sep 13, 2013

OLL Live: Troubleshooting Applications in Oracle Cloud by Using OEPE

OLL-Live offers FREE, one-hour interactive webinars from Oracle. At an OLL Live webinar, you will experience an information packed session led by an Oracle expert showing you ways you can use Oracle products. Our speaker this time is Tom McGinn, Java Curriculum Developer. Tom's topic is Troubleshooting Applications in Oracle Cloud by Using OEPE.

Learn how to troubleshoot applications deployed to Oracle Cloud using resources available in Oracle Enterprise Pack for Eclipse (OEPE). You see how to view log messages generated by the Oracle Java Cloud Service, and how to use the Oracle Cloud Whitelist Scan to detect the use of API's or method calls that are prohibited.

To access the content this webinar is based on, click here.

September 18th, 2013, at 8:00 AM US/PT  

Wednesday Sep 04, 2013

Take Java Training at Openworld/JavaOne

Take Java Training at Openworld/JavaOne

Here is an exclusive opportunity to get top-notch Java training while you’re in San Francisco. Java University is a one-day training event on Sunday September 22nd from 9:00am to 4:00pm at Golden Gate University. This is your chance to get accelerated Java training in a seminar-style format taught by Oracle University instructors, community experts, and Oracle engineers. Don’t miss this chance to get in-depth training on hot Java topics while you are in town for JavaOne.

Here is the full list of session titles:

Cost for a day of training: $800

Register here.

Looking for Oracle Sessions? Oracle University will also be held on Sunday, September 22nd from 9:00a.m. – 4:00p.m. at Golden Gate University. Choose from 11 Oracle sessions, which include Application Development in the Oracle Cloud, Ask Tom Kyte Live, Certification Exam Cram, Extending and Customizing Oracle Fusion Applications, Oracle Business Intelligence 11g, Oracle Database Machine and much more! Learn more.

About

Information relating to Java training development and events.

Search

Categories
Archives
« September 2015
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today