Thursday Oct 13, 2011

Writing, Running, and Debugging Your First JDev Extension

It recently came to my attention, that while I've talked about it many times in the different posts on this blog, I've never written a post just about getting started with your first JDev extension.

Sorry about that!

So here I will finally correct that.  I'm going to quickly cover the basics of starting an extension project from scratch and then how to run it from the IDE, and how to debug it from the IDE.  I'll toss in NOTES when there is a difference between the R1 process and the R2 process.  Most of it is still the same between versions of the IDE

To keep this at the beginners level:  R1 refers to any version of the IDE that is 11.1.1.x  where R2 is referring to anything 11.1.2.x and higher.  You can read the post about migrating extensions from R1 to R2 to get some details about what is different in the newest release of the IDE.

Creating a new Extension Application and Project

There isn't a specific Extension Application selection when you go to the New Gallery and click on Applications. You will need to create a Generic (R1) or a Custom (R2) Application.

Double-Click on the application item to start the wizard.

Just enter the Application name and click on the Finish button at the bottom of the dialog.

The wizard will create a default project called "project1".  Right-click on the project name and select "Delete Project".
You should select the option to remove the project and all of it's contents so we don't have junk code laying around in your work folder.  We don't need this default project, as we will create our own extension project next.

Right-click in the empty space of the Application Navigator and select "New Project from the context menu.

Click on the Extension Development option under the Client Tier category, and then double-click on the "Extension Project" option.

Once the project creation wizard comes up, fill out the name of the Project with some thing that you like.

Give your project an identifier.  This is what will be used in your library path.

The rest will be filled in for you with the information that you gave in the two entries above.

After the project is created, your IDE screen should look similar to this

Running the Extension

Now that we have our project created we can start work doing all of the things that I've already written blog posts about.  For the sake of making this post only about Writing, Running, and Debugging, I'm going to just paste in some code and jump ahead to how to run the code from within the IDE.

After the project is saved and built(compiled) you can right-click on the project name in the Application Navigator and select "Run Extension".  This will start another instance of the IDE with your extension loaded so you can see how it works.

NOTE: In 11gR2 you must click on the "Deploy to Target Platform" menu item before you Run or Debug the project. This is required to setup the MANIFEST.MF file with any changes that you may have made to your code, and then package everything up properly.  This is not required for the 11gR1 version of the IDE.

Any error messages or warnings that occur during the running of the extension, will show up in the log window of the Parent IDE.  This includes any System.out.* commands that you may have put into your code.

Debugging the Extension

You can set breakpoints in the code just like you would for any other type of code. To debug your extension, save the project, then right-click on the project name in the Navigator and select the "Debug Extension" option. The new instance of the IDE will start up, and you can perform the functions of your extension in that test instance.

NOTE:  The same thing applies for Debugging as Running in 11gR2.  You must click on the "Deploy to Target Platform" option before you click on the Debug menu item each time.

When the debugger hits a breakpoint in the code, the Parent instance of the IDE will show all of the debug info.


As you can see, it's pretty simple to run and debug you extension directly from the IDE.  There isn't a need to save off the extension .jar file to the extension folder and restart the IDE like a lot of people have been doing.  I hope this helps speed up development for people, and makes extension development just a little bit smoother for everyone.

As always, please post comments or questions so all developers can learn from each other.

Friday Jul 16, 2010

Where to start when writing JDev Extensions

For many of us, it's that first step that seems to be the hardest to get past when starting something new.  When it comes to JDev Extension development it really isn't any different.  It took a while to compile a lot of those sites that give you the beginners perspective and not just a lot of code samples that someone with experience could only use.

Below is a short list of some of the more beginners resources that I came across over the last couple of months.  If you have others, please add them in the comments.

1) The search field in the IDE itself is probably the best resource that I stumbled across in JDev.  It does far more then just search the existing code.  It looks at the JavaDocs, online Help, Oracle Technology Network and more.  Definitely give this a try.

2) Shay Shmeltzer's blog is a wealth of info for both beginner and more advanced extension developers.  A must have bookmark

3) The intro video for JDeveloper 11gR1 Extension SDK is a good place to start.  The intro video for 11gR2 is also available.

4) The JDeveloper FAQ blog by Nick Haralabidis has a three part series on writing your first JDev Extension.  The series is found in blog's #16 - #18.

5) The Extension SDK samples themselves.  There are approx. 30 sample application that come with the SDK that you install via the JDev Update Center.  These samples contain a lot of info beyond just what they say they do in the description.  I've gone through all of them over the last month and will post a spreadsheet shortly that shows a lot more about what each sample can provide some insights to.

6) The JDeveloper and ADF Forum.  If all else fails, ask for help in the JDeveloper forum.  There are a lot of great minds that follow this forum.  They are friendly and helpful.  If you do post up a new question, make sure you add an "extension" tag to the post, so that it's easier for others to learn from your questions in the future.

Hope these beginners resource help others get going with developing extensions for JDeveloper. If you have some of your own, please add them in the comments.


profile image
My name is John 'JB' Brock.
This Blog will focus on tips and tricks for working with the JDeveloper Extension SDK.
I hope to bring clarity to some of the mysteries around developing extensions for JDeveloper.


« July 2016