Use external libraries in XS Engine

I'm trying to use third party Javascript libraries for my projects in the XS Engine. Let's assume I'm writing a script that has two direct dependencies:
my-app.js
|-- dependency-a.js
  |-- dependency-b.js
        |-- subdependency-b1.js
        |-- subdependency-b2.js
How can I make dependency-a.js and dependency-b.js (including their dependencies) available for my-app.js in the XS Engine?
Does the XS Engine support some kind of package management / module system (like CommonJS)?
Currently the only method I found for one Javascript file to depend on another is to make the dependency an *.xsjslib file and import it. This isn't a feasible solution in my scenario, because:
1. Pretty much all server-side libraries I want to use are modules based on CommonJS (mainly written for Node.js), and would have to be adapted
2. Not all libraries I use have been validated by JSLint, so HANA doesn't actually allow me to activate them till they are (is there a way to disable JSLint?)

UPDATE:
The error I reported below was in my js code. Not sure where, but doesn't appear to be an "XS issue".
For others looking at this thread, below is a more detailed example for your reference.
STRUCTURE:
-Content
--MyPackage
---MyApp.xsjs
---MyLib.xsjslib
MyApp.xsjs code:
$.import("MyPackage","MyLib");
var x = $.MyPackage.MyLib.MyObject.MyFunction("my test string");
$.response.setBody(x);
MyLib.xsjslib code:
var MyObject:{
     MyFunction: function (myString) {
          return = "You passed in the string: " + myString;
ORIGINAL:
I'm getting the following error:
Found the following errors:
===========================
TypeError: "xml2json" is read-only (line 146 position 0 in /sales/xml2json.xsjslib)
here is my import code:
$.import("sales","xml2json");
xsjslib and xsjs are in the same package, sales, as shown below.
Content
-Sales
--ccw.xsjs
--xml2json.xsjslib

Similar Messages

  • Using external libraries in Web Dynpro DCs

    Hi,
    I've followed the example in the following blog for using external libraries in my Web Dynpro (WD) DCs:
    /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro and some other messages in the forums. However, it isn't working exactly as described in the blog. I have to twist it a bit to get it work. I were wondering if anyone has any better solution for this problem?
    The senario is like this:
    - External libraries: a.jar, b.jar
    - WD DCs: wd1, wd2 in that wd1 and wd2 are both using external libraries a.jar and b.jar; wd1 is a library DC that can be reused in wd2.
    According to the example in the blog, the following steps are carried out:
    - Step 1. Create an external library DC, add a.jar and b.jar to public part "ExternalLibs" as described in the blog.
    - Step 2: Create, build, deploy “J2EE Server / Library” DC. (Add reference to the public part of the external library DC as a used DC, with both Build-time and Run-time dependency).
    - Step 3: Create WD DC wd1, add used DCs and WD reference libraries as described in the blog. Add WD components as public part. Build and deploy WD DC wd1.
    All are ok so far!
    - Step 4: Create WD DC wd2, add used DCs and WD reference libraries as before. Try to build and FAIL!
    The error occurs here because wd2 cannot access to the classes in the external libraries, similar to the problems described in thread Re: Problems with deploying a JAR file.
    I've found a workaround, although quite tedious and cumbersom, but it works. My solution so far is:
    - Round 1: Perform those 4 steps above, but in step 1, after adding the jars to the public part "ExternalLibs", set the property of the public part "purpose" to "compilation", then build and deploy all other DCs accordingly.
    - Round 2: Change the public part "ExternalLibs" property to "assembly", then bulid and deploy all other DCs again.
    And now I can reuse the external libraries in my WD DCs as well as WD DCs as library in other WD DCs.
    I know it's not an elegant solution. So I were wondering if the experts out there can help me with better solutions?
    Many thanks in advance for your help.
    Regards,
    Van
    Edited by: Van Hai Ho on Dec 18, 2007 3:30 PM
    Edited by: Van Hai Ho on Dec 18, 2007 3:31 PM

    Hi Pascal,
    Thank you so much for your help. Your suggestion has helped to make my life a lot easier.
    Regards,
    Van

  • Use external libraries in web dynpro java

    Dear Experts,
    I need to add an external library to my project.
    Anyway, I do not know how to do it because it gives me many problems.
    I tried modifying the classpath and placing it in the lib folder of the project from "Navigator".
    Also project properties, add. jar outside, and throws me the following error:
    [javac] Compiling 213 source files to D:\WORK\WORKSPACE\7.2.jdi\LocalDevelopment\t\2BF09F48E6D0E2C201262098A0E4D79F\classes
         [javac] ERROR: D:\WORK\WORKSPACE\7.2.jdi\LocalDevelopment\t\2BF09F48E6D0E2C201262098A0E4D79F\gen_wdp\packages\elsys\com\.....\wd\comp\....\MainView.java:34: package com.estaf does not exist
         [javac] ERROR: import com.estaf.jpay;
         [javac] ERROR:             
    Given these errors, I know my includes without problems and I can instantiate objects from library classes, but these errors I can not deploy.
    I read the following link:
    /people/raphael.vogel/blog/2008/05/05/how-to-use-external-libraries-in-the-sap-component-model-part-ii
    I did everything the tutorial. I created the external library. I can see in my project "DC-Definition -> Used DCs" The public parts assembly and compilation. Now the problem is that it still does not recognize the classes of the libraries you want to use.
    A level of code, when I try to instantiate the class does not recognize me. What could be missing? I did a couple of times step by step and gives me the same results.
    I use SAP NetWeaver Developer Studio SAP NetWeaver 7.2 SP03 PAT0007 version.
    Infinitely appreciate any help. Thank you very much.
    Rasim
    Edited by: Rasim Donmez on Apr 11, 2011 4:50 PM
    Edited by: Rasim Donmez on Apr 11, 2011 4:51 PM

    Hi,
    please find below path for adding External Jar files.
    right click on the webdynpro dc and select the properties .
    then clcik on Java Build path->select libraries->select External External Jars.
    after that just rebuild your project (not Build).
    Regards,
    Govindu
    Edited by: Govindu Nagotla on Apr 12, 2011 2:28 PM

  • Using external libraries with Developer Studio 7.1 Composition Environment

    Hi,
    I downloaded DS 7.1 CE and tried to develop a simple application which uses an external library.
    I created a development component for "external library" for the local development -> MyComponent, giving it the name "test2" (for the domain basis).
    I imported the external library file using Import -> File System , then selecting the .jar file.
    In the component properties browser I added a public part naming it "mylib2" setting the purpose to "ASSEMBLY" (my intention was that the libarry will be transferred during the deployment to the application server).
    I right clicked on the public part to "managed entities". I selected the archive tree and checked the library file shown there (the one I imported before). #
    Then I opended component properties of my web dynpro project and clicked on "Dependencies". The I chose "Add..." and selected the "test2" development component I created before (see above).
    Then I tried to deploy the project (which uses this external library) using "Deploy Archive and Run"
    After deployment the browser window opens and shows the ClassNotFoundException
    So what did I oversee or do wrong?
    BTW: Is it necessary for using external libraries to use a full fletched NWDI? Or can I use external libs also with netweaver development environments freely available for download on sdn.sap.com?
    Any hints?
    Thanks a lot
    Hannes

    Hannes,
    If you want to use external libraries with DCs then you should follow the NWDI completely.
    Check this step, otheways of using external libraries is mentioned <a href="http://help.sap.com/saphelp_nw70/helpdata/en/e3/de813e77d46245e10000000a114084/frameset.htm">here.</a>
    Regards
    Abhilash

  • Using external libraries in eSWT on 7.1

    Hi again.
    Is it still possible to use external libraries when developing applications for Handhelds on Mobile 7.1 (eSWT)? Or do we have any restrictions here?
    Thanks,
    Sascha

    Hi,
    as long as your have POJOs it should be ok to use them still.
    Regards,
    Oliver

  • Using external libraries in DS 5.2 plugins

    Hello,
    I'm writing a moderately complicated preoperation plugin for Directory Server 5.2, and I've linked in glib 2.0 so I can use some of its data structures. Aside from some memory leaks I'm tracking down, things look okay, and the plugin behaves as expected.
    Are there any reasons why I should avoid using external libraries in the directory server? I know that SLAPI has its own memory management code that glib isn't using, but I don't think that's the reason I have the leaks.
    Thanks!
    -lars

    Plug-in library code runs inside the memory space of the server process, so it can be nice to have the memory management from the API.
    Also if you have things coming in from all over the place, maybe there's a higher security risk, since there are more places where somebody could replace a dynamic library and do bad things when you load that code.
    I don't recall us putting anything in the docs that said you should make a special effort to avoid doing linking out to external libraries. (If it's there, I don't see it with a quick google search.)
    Mark

  • Using external libraries over signed Java applet: InvocationTargetException when running locally with 7u51

    We have a signed Java applet that uses external libraries, specifically the OpenOffice application libraries.
    We have a problem running Java applet with 7u51 of "InvocationTargetException" when use these libraries OpenOffice, that is not signed; regardless of the browser used (Mozilla Firefox, Explorer, Chrome).
    Please, as you could solve this problem?   This problem can not arose with 7u40 and earlier..
    Best regards.

    In  java - JRE 1.7.0_51-b13 and signed applet - Stack Overflow found solution. I've missed to add in external jars manifest this: 
    Trusted-Library: true

  • How to use external libraries jar files in the composite application?

    Hi,
    I have some external jars files (which consists of java classes) that I would like to use in my composite application. 
    I have created a DC with type as external library for the jars.  However, I don't know how to specify the DC to be used in my caf application.
    Can anyone help?
    Thanks.
    Regards,
    Fui Voon

    Hi,
    My jar files consists only java classes and a manifest.mf. The files are compiled using jdk 1.4.2-b28.  Will this be any issue?
    It seems that if I ignore the error and continue step 7 which is to do deployment of the ear, the error given is
    Cannot update it.
    Caused by: com.sap.engine.library.bytecode.cf.CFException: Invalid constant pool tag, 60 at index 41.
    Does anyone know what that mean?
    Is there any sample that teach how to deploy external libraries as bundled library?
    Thanks.
    Regards,
    Fui Voon

  • Using external libraries in desktop programs

    Hi everybody, i'm a bit newbie and i have some questions for you. Can I create a project in C# (VS2013) and use the exe as a desktop program? (I mean, if it's consider a desktop application). My main question is: Can i import external libraries on this
    project? I don't know this, because it's hard to know if the users have the library (or is it include in the program?)
    Thanks in advance :)

    You can write windows forms or wpf applications ( and some other types ) using visual studio.
    These are desktop applications which you can distribute.
    A library is a dll.
    Dynamic link library.
    To use one you add a reference to it in your solution.
    That dll is then a dependency for your application.
    You can later build an msi which someone would use to install that application or you can deliver by clickonce.
    http://msdn.microsoft.com/en-us/library/ms173084(v=vs.90).aspx
    You do that using an install project which will detect those dependencies and include them in the msi you give to people to install your application.
    There are a number of options:
    Installshield lite
    Wix
    Setup and deployment project
    https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • How to use external libraries and JAR files with OpenScript

    Hello.
    I am trying to include ApachePOI, JODATime, and Javamail in my scripts to handle different aspects of our automated performance tests.
    I followed the documentation for Eclipse to be allowed to utilize these external libraries, however, when I attempt to run my tests the classes and methods that are being imported, show up with errors saying that they do not exist.
    I think perhaps that I am using them incorrectly. I cannot see them as script assets, package assets, or project assets using the properties for these items. An error pops up and says those screens are not displaying correctly or display incorrect information.
    If anyone can provide guidance on using these items, that would be great. Right now I'm trying to include them as "previously exported scripts" but I'm not sure that method will work.
    Any advice is appreciated.
    Thanks.
    --tiff                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi Tiff
    For OpenScript 9.* there is an out of the box solution for that, all you need to do in OpenScript go to:
    Script -> Script Properties -> Script Assets -> Add -> jar File ....
    And that is it.
    Alex

  • Using external libraries

    Hello there,
    I am finding solution for my software's proposal. I will have got some flex libraries in my project(air application), but I would like to dynamically switch off some libraries. For example, one version of application(for example the free version) will not have got all functions, so I would like to deny some libraries(the best solutions is, that libraries will not be a part of application, so anybody could not crack it). And when i will use the library in application, which is deny, no error occur(for example some conditions, if libraires is here, i will can use it, or not).
    Which technology is the best solution?
    Thank you very much and sorry for my english

    An AIR application can load external code using the Loader.loadBytes API. But that would mean you download pieces of the application on startup based on licensing details. That might not be optimal and it only adds a level of protection. In the end, if people are bent on breaking your software they could potentially get around this as well.
    You may be interested in Adobe InMarket: http://learn.adobe.com/wiki/display/InMarket/4.7.2+Disabling+features+when+in+trial+mode

  • Using external libraries with Actionscript Project

    Hi,
    I've hit a bit of a brick wall trying to do something that I figured would be a relatively simple task. I'm working on multiple projects and I'm trying to build a number of SWC libraries shared between a number of Actionscript projects using Flash Builder 4. The projects using the SWC's build just fine, but yield this error when run:
    VerifyError: Error #1014: Class <whatever> could not be found.
    Here's a simple example:
    1) Create a new library project.
    2) Add a new Actionscript file in the "testpackage" package.
    3) Slap this code into that file:
    package testpackage
        public class stuff
            public function Testing():void
                trace("Oh yeah!");
    4) Create a new Actionscript Project named Launcher
    5) In "Properties->Actionscript Build Path", hit "Add SWC Folder" and browse to wherever the library project gets built to.
    6) In the AS file that's generated, add code something like:
    package
        import flash.display.Sprite;
        import testpackage.*;
        public class Launcher extends Sprite
            public function Launcher()
                var s:stuff = new stuff();
                s.Testing();
    7) Run this bad boy.
    I get the above error and I have no idea why. Everything builds fine so I'm not sure what I'm doing wrong. I read somewhere that you can manually extract the .swf file from the generated .swc and load that explicitely in code. This is a pretty horrible workflow and I hope it's not the answer
    Thanks a ton in advance!
    -D

    Check  linkage type in Build Path for project Launcher when you add Swc folder. It has to be merged into code.
    If it is external, you'll see this error.
    That aside, why not do "add project" instead of "add swc folder"?
    -Anirudh

  • How to use external libraries in EP

    Hi!
    I am with dificulties in utilizing an external ".jar" file in a Portal application (JSPDynPage). The ".jar" file is the JSTL 1.0 version. It compiles and is exported correctly (SNDS to Portal), but give me an error at runtime (NullPointerException). There is any restrictions in utilizing external ".jar"s files, e.g., not especific/proprietary versions?
    Regards,
    Alex

    hi,
    You can place the external .jar files under dist/PORTAL-INF/lib . By placing the external jars it would certainly run
    The other way  is as follows
    1. Go to navigation perspective
    2. Get into the project\lib folder of the your project. copy the jar files into it
    4. Right click on the project
    5. Click on properties
    6. Click on java build path
    7. Go to libraries tab
    8. click on Add Jars button
    9. Select the jar in your project
    11. Recompile
    12. Deploy
    Hope it helps..
    regards,
    Ganesh.N
    Message was edited by: ganesh natarajan

  • WDP classics: how to use external libraries in DCs

    Hi,
    I am also on 7.0 SP 13.
    I used method in the following blog & its working for me:
    /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro
    Regards,
    Apurva

    Hi, I checked again to no use. I'm on NWDS 7.0.09
    I had to do it the hard way, procedure follows.
    Create external library as per blog.
    Create two public parts (API and SDA).
    build
    Create J2EE library as per blog.
    Add to used DCs both external lib's API_pp and SDA_pp: buildtime and runtime dependency - strong
    build
    ignore warnings such as: runtime dependency ignored
    the .sda does not have any .jar inside
    open the .sda in the file system path or directly from NWDS
    add your .jar to the server directory inside the .sda
    in server/provider.xml replace the line:
    </jars>
    with
    <jars>
    <jar-name>it.sap.mycustomer.myproject.jar</jar-name>
    </jars>
    do not build or you will lose your little tricky .sda editing
    deploy from NWDS as usual
    set WDP DC dependency as per blog (used DC + WDP references settings)
    Hope this save some time to others...
    If some one know how to do this without manual editing please let me know
    Best regards
    Vincenzo

  • Using External Libraries as SWF

    Scenario:
    We are two developers, working on same FLA. We are using
    SVN/TortoiseSVN as a repository management tool.
    Problem & current work-around:
    End of the day, if one developer commits his FLA [with some
    new symbols or MoviClips] into SVN, there are no way to compare
    & determine thru SVN, that what all changes have been done.
    Ultimately we have to keep all over Library items into different
    folders and manually copy _myLocalLibraryFolder to library, taking
    the latest FLA. It is certainly not a good approach.
    Probable solution:
    Since we have divided different modules amongst us. We can
    have different [external] library files, which can be included into
    main ActionScript file.
    Problem with this approach:
    I tried with two approaches:
    1. Embed -- [Embed(source=" ConrolButtons.swf")]
    2. Thru loader class:
    var libLoader:Loader = new Loader();
    var libLoaderInfo:LoaderInfo = libLoader.contentLoaderInfo;
    libLoaderInfo.addEventListener(Event.COMPLETE, onLibLoaded);
    libLoader.load(new URLRequest("ConrolButtons.swf"));
    But in either of the cases it gives this Error:
    "1046: Type was not found or was not a compile-time constant"
    external swf

    In the help documents that come with flash cs3 look up
    Runtime Library. Note that the symbol you try to export has to be
    loaded for Actionscript.
    Also note that you have mispelt the word Control in your
    urlrequest.
    I think your problem is due to the new security sandbox
    model. Configure your loader like this:
    var path:URLRequest = new URLRequest("ConrolButtons.swf");
    // this line is the line your code does not have.
    var context:LoaderContext = new LoaderContext(false,
    ApplicationDomain.currentDomain);
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
    loader.load(path,context);

Maybe you are looking for

  • Conversion from SQL Server 7.0 to Oracle 8 -- Urgent!!

    Hi! I've an urgent task of migrating data from SQL Server 7.0 to Oracle 8 for Oracle Financials Application. When is the Migration Workbench for SQL Server 7.0 is going to be released, please let me know? And the other question is -- Is there a possi

  • Flash Builder Error Compiling Ipad Actionscript Mobile Project.

    I just bought a brand new ipad for testing. I am using flash buider 4.7 to make an actionscript mobile project. I created an app ID, provisioning profile, and certificate. I have done this before in flash professional so it wasn't too bad. However, w

  • MPLS implementation in a LAN

    Hi everyone, I have been researching MPLS for a few days now with the intention of setting up a network to test MPLS operations using 2651xm routers and 2950 switches. Presently Iam simply gathering general information before I start the project. If

  • Sending udp packets using java and receiving it using c

    hi, Is it possible to send udp packets using java and receive the same using c??????? if yes.... plz help immediately.

  • Adobe After Effects Multiple instances does not working parallel using Scripting

    Hi all, i am uploading after effects template to my site, user came and upload his desired contents. i update the template using scripting with user's contents and then render video so user get video with his uploaded text/images etc. its working per