Continuing on from our
previous post, we had just gotten
Oracle JDeveloper 11gR1 installed and we had launched JDeveloper Studio.
When you start up JDeveloper for the first time it will prompt you for a role. These are not security roles, but rather to help with the usability of JDeveloper. JDeveloper provides a lot of different features and is targeted to different audiences, so you can limit how much of the user interface is exposed depending on what sorts of things that you typically do.
You'll notice in the screenshot below that there are roles specifically for Java development. For the purpose of writing Java to extend PeopleSoft, the plain Java role is fine.

We ended up selecting the Default Role option to have everything available to us. Clicking OK then gave us the JDeveloper splash screen.

Since this was the first installation in this particular machine, we were also prompted about associating certain file extensions with JDeveloper. Unless you have specific reason not to, we'd recommend just taking all of them as associated with JDeveloper.

The other thing that we need to do since this is our first time using JDeveloper in this environment is to create an application. In JDeveloper an application is the top level container for work. An application will have at least one project associated with it, but in can have more.

Here we are creating an application called "HelloJDeveloper" using the "Generic Application" template. This is a pretty basic template that just creates a single project to hold our work. You can see in the list of templates that "Fusion Web Application (ADF)" is an example of an application template that will create more than one project. A template is just a starting point though, you can extend and change what is created fairly easily.

Since we had started with the generic template, there were no default technologies and we added Java from the list ourselves. If we had chosen a template that pre-defined the technologies, those would have been pre-selected here, but we could have added additional ones if desired.

Since we added Java as a technology to work with, we get one extra step in the wizard for setting up the Java configuration. Here we have selected com.greysparling.hellojdev as the default Java package, along with the default paths for our Java source code and the Java classes that will be generated from our source code.

Now we have our JDeveloper workspace properly configured and can begin working.
If you're just used to PeopleSoft's Application Designer, the first thing to notice is that although there are a few more child windows opened inside JDeveloper, it actually has a similar model to Application Designer where there is a primary window for working with whatever you are working on, and some supporting windows to help navigate, view status of different operations, etc. As with Application Designer, you can hide the child windows if you want to maximize the screen real estate for what you're working on.
In many cases JDeveloper will provide shortcuts for creating new definitions. For example, in the screenshot above you can see that where we are looking at the summary of the Java files in the project, there is a New button on the summary where we can create new Java files directly. There's also the traditional File->New menu option available, which provides some additional choices.

Here we can see that, in addition to being to create new Java classes and interfaces, we can create other new things such as connections to other systems, deployment information, additional projects, etc. Here's what creating a new Java class looks like.

We've given the class a name (we're calling it "Hello"). The package name has been defaulted in for us, so the fully qualified name of our class will be com.greysparling.hellojdev.Hello. The only other option that we changed was turn on the check box for having a main method. A main method in Java allows you to run a class directly from the command line (similar to what we've
shown in the past for PeopleCode by utilizing Application Engine).
We're missing the screen capture for the base file that JDeveloper created for us after clicking OK. Essentially it is the skeleton framework for the code. It compiles, but it doesn't actually do anything yet. The following screenshot shows after we added our own "speak" method to the Hello class.

In the main method, JDeveloper had created the first line for us, which created an instance of our Hello class. By entering a "." on the "hello" variable, JDeveloper (like most IDEs these days) automatically popped up the list of valid methods and properties that are associated with our hello variable. By typing "s", JDeveloper automatically trimmed down the list of choices to our newly typed in "speak" method.
The other nice thing that JDeveloper is doing for us is automatically syntax checking/compiling as we go. Notice the little red warning flag on the left of the line that we are adding to call the speak method. Because we have not actually chosen the speak method from the type-ahead list at the moment the screenshot was taken (mainly so that we could actually show the type-ahead functionality :-), JDeveloper is highlighting the fact that the line of code, as it stands at that exact moment won't work. As soon I as hit the Return key in the type-ahead list, JDeveloper removed the warning flag letting me know that the code was valid again.
Now we can run our code by clicking the green button at the top of JDeveloper. That will compile the code if it has not been compiled yet, and then run it.

JDeveloper shows us the command line that it executed (always nice when GUI tools show you the underlying details instead of hiding them), along with the actual output. The main method invoked the speak method on our Hello object, which in turn printed out the proverbial Hello World (except in our case it's "Hello JDeveloper!").
Now we've gotten JDeveloper installed and gotten our feet wet with some simple code. The next post in this series will pull what we've done so far into an existing PeopleSoft environment. The content is actually done for that, but Blogger (our blog hosting platform that we use) seems to have gotten very slow here as I've been adding these last few images so it won't get posted tonight.
Labels: 2009, Fusion, Java, Oracle