Tuesday, 21 February 2017

JDeveloper Feature: Application Navigator

Once we are all set with JDeveloper installation, we will move ahead to explore features JDeveloper offers.

The very first thing every developer notices and wants to know about is role selection.

Remember, after installation, I asked to select Studio Developer. So, you will get access to all the features JDeveloper offers.

The role selection window looks like the following,
Other roles are also there, different role has different set of components and windows available in the IDE. So, Database Developer role will have Database specific components available and you won't be able to create Java Projects and all in this role selection, similar thing happens for Java Developer role and any other role. Just play around a little bit with different roles and you will be accustomed to the system.

Moving forward, we will see JDeveloper IDE opened with a Start Page

This page is full of links connected to different tutorials and Oracle Documentation. If interested, you can check them. You can also deselect the 'Show on Startup' check box. This will stop JDeveloper to show this page from the next time.

In the left pane, you see Application Navigator, where you can see two buttons 'New Application' and 'Open Application'. While working with JDeveloper, you will create one or more projects, this panel keeps track of all the projects you create under one single hood. You can have more than one Applications in this window. If this window is not visible to you at any point of time, you can get this from here - Window > Applications


Next we'll create an application and a project in the application.
Click on the New Application button and it will open a new application window

As this is the first time we're creating an application and we want to make it simple, we'll go with Java Desktop Application, where we'll create Java Classes and run in console. Then gradually we'll move towards other features.

Click on OK and it will open another window to get input from user. Provide some meaningful name to the application and you may also want o change the directory of the application, if you don't bother for the location, just leave to default.

Then click Next and it will ask for more settings like project name, the directory to store the project files. You can give a name of your choice. Following the convention, I have named it as HelloWorld. Provide the details and click next. It will ask for Java Settings for the project you are developing.

In this window, you will provide the default package all java classes will be in. Also, it will ask you for source code directory and output directory. If you've worked with any build tool like Ant or Maven, you will relate these settings. If you are not getting what to select or provide, just leave it to default. Click Next.

In the last configuration window, you will have to select a build tool. From 12c, JDeveloper comes with two different build tools, Ant and Maven. You can configure your Ant/Maven settings accordingly. You can also select the default JDeveloper Build Tool. For simplicity, I will go with the default JDeveloper's build tool.

That's all the configuration you have to do while creating a Java Application. You can click Finish now and it will generate the complete project for you. You can see this in the Application Navigator now.
If you click on the + icon just beside your project name (HelloWorld in my case), you will find what all files, directories are there in the project.

Now let's create a new class which prints 'Hello World' to the console. Right click on the project and select New, it will open  a selection menu for you, choose Java Class,

Again it will pop up an window for different Java Class configuration. Provide a class name, you can also find that the default package is now coming in this section. I've also selected to provide a main method. Now click on OK.

What happens now is interesting. Take a closer look of each area of the IDE.

You can now see that in the Application Navigator, the project has been expanded and the class is residing in a package. In the editor, you now have your class and a main method in it. In the left pane, now you can check, there are some more accordions present, Application Resources, Data Controls and Recent Files. Also, another window has been populated with data just below Application Navigator - Structure.

Let's look at each of these.

Projects

This accordion shows the hierarchical view of all the available projects in the Application. In this window, there are four small buttons -
  1. Project Properties - if you click this button, you can see different project related properties. You can configure your project using the settings used here.
  2. Refresh - Refreshes the content of the project/application.
  3. Working sets - this button is useful, if you have a large list of projects in an application. Using this feature, you can make a subset of all the available projects in the application.
  4. Application Window options - this button will open a menu for different view configuration. I strongly suggest you to check with different options available. Play a little bit and you will understand what each option means.

Application Resources

This accordion shows all the application related resources like, Build Files, Database Connection, Server Connection, META Data, Related Libraries etc. In the subsequent sections, we will see the use of this window.

Data Controls

This accordion will show you different data related configuration while you will be working with Business Components.

Recent Files

As the name suggests, it shows the recent files.

Structure

This window shows the structure of the content in the editor. Like, in our case, It shows the structure of the HelloWorld class. This is useful when you have a large file open in the editor window. You can find all the related structure and click on it, the editor will show the specific part of the file.

Now, you might have not noticed, in the top of the Application Navigator, we have the application name and in its right side, there is a down arrow present. Click on it and you will find the 'New Application' and 'Open Application' Option. Click on the New Application Button. This time, follow the instructions for application creation, provided earlier.


Following is how it looks like in my system

Check different windows in this application. Now again click on the right Down Arrow beside the application Name in the Application Navigator and you will find two different applications. You can click on either of the projects and the IDE will show you the contents of that application.

You can also create other applications using the same method.

Now, to complete this part of the tutorial, we'll complete both the HelloWorld and HelloUser classes and run them.

Change the content of the classes as your choice. A quick information here, when a file is getting modified in the editor and it is not saved, the file name changes to italics. 

Another tip, while working with Oracle ADF/SOA Suite, you will come across situations where, you will only change a single file in the editor but it will internally modify many files. So, JDeveloper provides a feature to save all the files in the application, regardless of whether the file is modified in the editor. In the menu bar, you will find the Save All icon just beside the Save Icon.

So, you can use this button as well while you have multiple files to save. Now, right click the file and click Run and it will show the console just behind the editor window.

Similarly, with the next file run, I will conclude this section

Sunday, 19 February 2017

Introduction to Oracle JDeveloper

Introduction

JDeveloper is a freeware IDE supplied by Oracle Corporation for the development of different Java Based application. Oracle JDeveloper is a cross-platform application. So, you can use it any OS like Windows, Unix, Mac OS etc. JDeveloper started its life as a Java IDE but with time evolving, it gradually became more and more of an IDE for Oracle Fusion Middleware based development. Oracle JDeveloper provides with many ADF/SOA based development tools without which, the development task would become very painful. JDeveloper simplifies the development process by its visual and declarative approach. It offers features for development in Java, XML, HTML, JavaScript, PL/SQL and BPEL.

With time, JDeveloper evolved itself in a constructive fashion and with 12c release, it has become a robust and productive IDE with its express tooling support for Java based application, specially Oracle ADF and Oracle SOA Suite. Let's look at the features JDeveloper offers, which a developer needs for its development -
  1. An Integrated WebLogic Server, capable of running end-to-end Oracle ADF/SOA Application. So, no need to worry about any bulky server installation and configuration while on development stage.
  2. A lightweight JavaDB exposure, which you can use at the time development. So, in a nutshell, you won't have to install a Database Server to develop and test your application.
  3. A complete database IDE which you can use to connect to and explore your database. So, no need to install another software like SQL Developer/Toad to explore your database.
  4. A rich components palette, from where you can drag and drop components and in the back end JDeveloper writes the code for you. This feature saves a lot of time in development stage.
  5. A feature rich Source Code Editor.
  6. Easy to use installer.
  7. Testing tools like built-in browser and HTTP Analyser. So, no need of any other software to run your unit tests at development stage.
So, using JDeveloper, you can concentrate on your development completely without having to worry about any other software installation or any other configuration. Also, once you download the installer, it takes about half an hour to get into development with all the development tools handy with you.

In this series, we'll look into all the major features/tools, which most of the developers agree to be handy and productive in the development stage.

Prerequisite

JDeveloper heavily depends on Java, so, you must have JDK installed in your system before you proceed. If you do not have JDK installed in your system, you can ask your system administrator to do it for you. Also keep in mind that Oracle JDeveloper is resource intensive while in development stage, specially if you need integrated server instance running. So, my suggestion would be to use a system with at least 6 GB of RAM.

Download

Oracle JDeveloper downloads are available here. If you do not want to use SOA Suite features in JDeveloper, you can use this link and download Studio Edition for your development needs, but if you also want SOA Suite development features, it is recommended to use this link and download the latest Free Oracle SOA Suite 12c Installations generic version. With this installation, you'll get all the tools in a single hood for your development. I will be using this installation and the next section will guide you through this. If you are downloading any other version, you'll get the corresponding installation guide in the documentation tab.

Now, it's a nice time to have a coffee if you want. Because, the download will take some time, regardless of what version you are downloading. Come back once your download is ready.

Installation

Note: If you already have JDeveloper installed or you are using any other version of JDeveloper other than described in the previous section, you can safely skip this part and move to the next post in this series.

Now, we are ready to see the installation of Oracle JDeveloper. Assuming you are a developer, the simple navigation/java commands should not be a problem for you to figure out.

Once you have downloaded the Oracle SOA Suite 12.2.1 QuickStart Download, you should move to the downloads directory and unzip both the files. Please ensure that both the extracted files are in the same directory. Once done, you have to run the first file using java command. 
palash@Home-Computer ~ $ cd Downloads/
palash@Home-Computer ~/Downloads $ java -jar fmw_12.2.1.0.0_soa_quickstart.jar 
Launcher log file is /tmp/OraInstall2017-02-20_12-30-50AM/launcher2017-02-20_12-30-50AM.log.
Extracting files.............

Once the extraction is done, you should see the graphical installer which will guide you through the installation process.

This first window asks you for a location for the installation and also asks you for the user group, this installation is associated with. If not sure, leave these to default. Then the Welcome Screen appears, it is wise to read the welcome note. Click Next button.

This screen asks for Auto Updates, you can safely skip and click Next.

In the next screen, you have to choose the directory for Middleware Home to be installed. This is the directory which contains all the installation and user directory files, including you development works. So, take some time to think of the possibilities of the directory size and choose accordingly and click Next. Also, keep a note of this location.

The next screen checks your system for Operating System and JDK installation. You should match the requirements of the installer. Once everything satisfies the requirement, a green Tick will be placed.

In the next window, you should see all the details of the features, that are going to be installed. Check and click Install.

Once you have clicked Install, you will see the installation progress window and it will show the status of each sub tasks. Remember this is a resource intensive job and will take some time to complete. So, you might get some slowness while the installation is in progress. It is also recommended to close all other windows while installation is in progress.

Once all the tasks are performed successfully by the installer, you should see green ticks for all the tasks. Now, click Next. Optionally, you can view the log or messages by clicking on the appropriate buttons.

In the last screen, you will be shown all the successfully installed features. Check what features have been installed and in the Next Steps section, check Start JDeveloper. 

Now the JDeveloper starts.

You will be prompted to select a role. For the time being step ahead with Studio Developer.

Next the JDeveloper opens with its start page shown which indicates a successful installation.

Add Shortcut: After the installation is done, you may find it difficult to find the Jdeveloper shortcut. So, better to keep a shortcut handy. From the Oracle Home Location (You've chosen this in the Installation Location and in the Installation Complete section, you've been prompted), follow this path
palash@Home-Computer /mnt/sda3/install/Oracle/Middleware/Oracle_Home $ cd jdeveloper/

If you are on Windows System, you can shortcut to the jdeveloper.exe file in this directory. If on Linux, move  to the jdev/bin directory
palash@Home-Computer /mnt/sda3/install/Oracle/Middleware/Oracle_Home/jdeveloper $ cd jdev/bin/
Keep a shortcut of the jdev executable. This process varies for Linux distribution, please check the forum or community of your Linux Flavour on how to create a desktop shortcut.

This is how it looks like in my computer using a .desktop (Standard Shortcut file for Ubuntu based distribution) file


That's all for the introduction. In our next discussion, we'll move ahead with different features offered by JDeveloper.