There are a lot of messages on SDN forums regarding using third-party libraries in SAP J2EE applications. Also there is a complete section available at, many developers either find it incomplete or cannot find it at all (I bet majority even don’t try to search, but this is different topic).

Below is step-by-step guide how to deploy Rhino JavaScript interpreter library to J2EE server and use it in WebDynpro application.</p>

Step 0. Preparation

First download latest Rhino build from and extract


file from Zip archive. Mozilla download page contains broken links, here is direct link to Rhino 1.6 R2 / RC2 .

Next, activate “Development Configurations” perpective in NetWeaver IDE (use menu path: “Window -> Open Perpective -> Other…”). We will create all necessary development components (DC for short) in Local Development / My Components branch.

Step 1. Create and build “External Library”

Switch to “Development Configurations” perpective if you are not already there, drill down to “Local Development -> My Components”, right-click and select “Create New DC…” command

Now fill in all necessary fields as shown below and click finish.

IDE will create and open automatically necessary project. In root project directory find a folder


(in my environment NetWeaver shows it in project tree, but does not create it on disk – just create it manually). Now copy


from Rhino distribution here. Next, select


folder in IDE, right-click on it and call “Refresh” command.

After IDE synchronized changes with file system, right-click on jar file in tree and select “Development Component -> Add To Public Part”


Adding Aarchive (js.jar) to public part

NetWeaver pre-create


public part for this type of projects, so simply select it in appeared dialog and click “OK”. Afterwards right-click on project itself and run command “Development Component -> Build”. Step complete.

Step 2. Create, build, deploy “J2EE Server / Library”

After we have created and built

External Library

DC we need to deploy it to SAP J2EE server somehow. So next create “J2EE Server Component / Library” DC:

Note that during project createion NetWeaver IDE may prompt you to open

JEE Development Perspective

. Just agree with it. Along this it will open

J2EE DC Explorer

view (switch to this view yourself if this doesn’t happen). Now expand project structure to “DC Metadata -> DC Definition -> Used DCs”. Activate contextual menu on last node and invoke “Add Used DC…”. Add reference to the public part of previously created

Extrenal Library

here. Note, that you have to specify both build time and run-time dependency here. Otherwise created SDA file will not contain js.jar from external library.


Add used DC (External Library) to J2EE library

It is time to build the project and analyze results. First of all you have to check generated SDA file in


folder. Verify that it contains


. Now something interesting. Go to


folder. You should find here


folder. Yes, NetWeaver IDE again created public part, this time it is


. And if you drill down to


then you meet


file again.

From now you may refere this (defLib) public part in the rest of SAP J2EE projects. But before we have to deploy it!. So, context menu on SAP J2EE Component / Library project, “Development Component -> Deploy”. Everything should go smoothly, let us verify results and run Visual Administrator:


Scroll to Libraries node


JavaScript (Rhino) Library Deployed

Step 3. Create WebDynpro Development Component

Now you may refer JavaScript library from any J2EE project. Obviously, that I wiil use it from WebDynpro 😉

So, two initial tasks should be known for you: we will create WebDynpro Development Component and add


public part of


DC to it (the only difference is that here build-time dependency is enough):


Create “WebDynpro” DC.


Add used DC (defLib) to WebDynpro DC

However, WebDynpro project will not contain JavaScript library files (as in case with J2EE library). So we have to define


to aforementioned library to let class loader find necessary classes at run-time. Run contextual menu on project root in IDE and select “Properties”, then switch to “WebDynpro References ->

Library references” and add “mozilla.orgjslib” (you may see the name in Visual Administrator):


Heck, we “invent” tool before task 😉 If anyone has ideas how scripting could be applied in WebDynpro you are welcome to share your thoughts in comments!</p>

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Maksim Rashchynski
    Nice blog, Valera!

    Some remarks:

    NetWeaver pre-create ExternalLibs public part for this type of projects, so simply select it in appeared dialog and click “OK”.

    My studio does not create it. You have create it manually with “Purpose” “Assembly”.

    And if you drill down to gen/default/plublic/defLib/lib/java then you meet js.jar file again.

    Nothing there but it is not a problem. SDA contains jar and everything is working.

    Best regards, Maksim Rashchynski.

      1. Sanketh Kandlikar
        The article is very helpful.

        Can we extract URL parameters from URL and bind it to the context in the Web Dynpro application.

        For eg:

        If I have URL which has
        param=value as FileName=One needs to read value of param ‘FileName’ and store ‘One’ in the context.

        Can the below be implemented in Web Dynpro

        For, the two lines below should return the value after the “=” for the variable “xxx”:

        fullurl = parent.document.url
        xxx = fullurl.substring(fullurl.indexOf(‘?’)+3, fullurl.length)

        It says to “Take the text string of the url. Use a substring beginning three past the position of the “?” and going through the end of the text string.

      2. Sanath Thearam
        I am trying to use an external JAR in my WDApp. I am able to build and deploy the app but not able to run it. Getting a well known ”  java.lang.NoClassDefFoundError” error.

        1.Followed your steps and created 2 DCs(DCjar and DClib)
        2.Created a WebDynpro DC and attached DCjar as used DC.
        3.written my code which has some references to the above library(added library reference). Was able to build and deploy the app.
        4.Tried running the app but came with the error mentioned above.

        an interesting thing that I noticed was I went though Visual Administrator selected the above library abut there was no file under JARs Contained.

        Can you please point me in the right direction if you can.


  2. Marc Wirth
    Nice entry, but sadly a bit outdated by now. As Maksim already noted this does not quite work with newer SPs. There is a SAP note 833415 that describes External Library handling but that is also specific to SP11 and the exact procedure changed with SP12.

    The SP11 IDE automatically created a compilation public part and also marked the DC as “external” (you can see a tag in the .dcdef file). Due to this flag the public part is actually treated as both compilation and assembly public part at the same time (which can be rather confusing).
    Starting with SP12, the IDE does neither automatically create a public part, nor does it mark the DC as “external” anymore. This means that the developer is responsible for creating and filling appropriate compilation and/or assembly public parts.
    Best regards,

    1. Valery Silaev Post author

      Yes this is an issue, and, btw, Maksim pointed out about differences even within SP11 <-> SP12 versions.

      Thank you for comment — it helps this blog post to stay up to date 😉


  3. Kelly Mulheren
    Unbelievable that SAP could make such a simple Java development task as referencing external libraries so mind-numbingly complex and, worse, inconsistent from one release to the next. Job security for high-paid consultants, I guess. 🙁
  4. David Z. Pantich
    I have to agree with Kelly’s question/comment. It seems that SAP just has to make everything so darn complicated. Using an 3rd party library is as simple as can be in regular J2EE development.

    Before starting to work with Netweaver I did Java web development for 6 years. It’s been an extremely frustrating experience to learn the SAP-way of things. I spent the first year fighting it but I’m at the point now where I just want to understand it.

    But it’s still very frustrating because things just aren’t consistent.

    The process covered in this blog is a perfect example. For the last year and a half we’ve been doing normal (not web dynpro) web development using Netweaver. We use external libraries as well as ‘common code’ that we expose as Public Parts.

    The process we use to include those in our web projects is very different from the process I’m finding has to be used for Web Dynpro apps.

    Now, WHY couldn’t SAP have made those consistent?

    Sorry for the rant. It’s just so frustrating. It feels like I spend more time configuring than actually developing.

    Anyway, thanks Valery for the blog. I found it helpful as well as a lot of your posts on the forums.


  5. David Z. Pantich
    I noticed that on your screen print of the “Add Dependency” dialog box you have the “Run Time” box checked and have “strong” selected in the “runtime qualifier” dropdown.

    When I’ve done this in my web apps (non-web dynpro) I’ve always just selected the “Build Time” and “Deploy Time” boxes. I’ve always left the “Run Time” and “runtime qualifier” to their default values (unselected and blank respectively)

    As I’ve said before, that works fine in web apps. Is the “Run Time” and “strong” requirements for web dynpro apps? If so, would you be able to explain why the difference?

    Thanks again!

  6. Shashank Jain
    The blog seems to be good.I still have some doubts here.
    If we have 2 applications (ear’s) and there is a dependency between them. Do we put it through used DC with a run time checkbox selected or through application references or both. Can anyone explain the difference in detail.It sounds so confusing
  7. Leonid Litvak

    Dear Valery and  SDN members,<br/><br/>I think your blog really helped me to use the external jar files in Webdynpro DC. I’m still trying to catch up with what’s discussed. Here is my problem:<br/><br/>NW 04s SP12, NWDS Version: 7.0.09 <br/><br/>I have a project SCMDashboard which is suppose to be entered in NWDI and run on Dev, Test, Prod (no Cons). Also there is a sandbox that has no relation to JDI<br/><br/>In my project I have 2 Deployable DCs:<br/>(1) <br/>-WebDynPro DC app/scmticon , vendor<br/> it has app/securityLib(defLib)  as Used DC<br/>This DC is  build into .ear <br/><br/>The Project Properties=> WebDynpro References=> Libraries References point to:   app~securityLib  (what Visual Admin shows as a DC name)<br/><br/>(2)<br/>Based on Valery Silaev’s blog I made 2  following DCs.<br/><br/>-J2EE Server Library DC app/securityLib,  vendor<br/> it has app/security(poi3_compile), app/security(poi3_assembly), app/security(secur_compile), app/security(secur_assembly) used DCs<br/>This DC is successfully build into .sda file with warninggs:<br/><Warning: No runtime information available for development component type External Library (, cannot validate runtime dependency.<br/>and deployed.>-  External Library  type of DC is not deployable and has no runtime info, that’s why it got this message,I guess. The actual .sda has 2 jars in it<br/><br/>(3) External library DC app/security<br/>This one has 2 jar files and 2x(compile+assembly)=4 public parts<br/><br/><br/>The project runs successfully on Sandbox and Dev. DC(1) uses the classes of 2 jars that reside in DC(2).<br/><br/>!!!ERROR!!!!! After assembly into DASHBOARD_SC .sca successfully and import/deploy into Test, the DC1 cannot find the DC2 (java.lang.NoClassDefFoundError).<br/>I think after assembly the reference of DC2 become broken or .SDA is missing inside the assembled .sca.<br/>I haven’t looked at .sca file yet cause I don’t have an access to transport dir/CMS/archives/ *.sca<br/>Do you have any thoughts on this issue?<br/>Thank you for you attention and time.<br/><br/>Leonid Litvak<br/>

  8. David Pierre
    Hi ,

    One example of a possible appplication for your WDP Javascript interpreter would be the use of the Google Maps API in WDP-applications!


Leave a Reply