Passing variables frm xsl to a java method

here is my current frustration -- aside from being new to java and xsl...
i have an xml message (that is passed to me from another process) as follows:
<?xml version="1.0" encoding="UTF-8"?>
<WillsXMLStart>
    <inputEventStart>TRUE</inputEventStart>
    <inputEventNumber>1</inputEventNumber>
    <inputEventID>HEREISTHEID</inputEventID>
    <inputEventEnd>TRUE</inputEventEnd>
</WillsXMLStart>ok now i am using netbeans to create and xsl to gram the information and reformat the information because the end process want the data and event tags differantly. my xsl is as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:gng="java:GetAndConvert"
                exclude-result-prefixes="gng"
                version="2.0">
    <xsl:output     encoding="UTF-8" indent="yes" method="xml"/>
    <xsl:template match="/">
        <WillsXMLStart>
            <inputEventStart>
                <xsl:value-of select="WillsXMLStart/inputEventStart"/>
            </inputEventStart>
            <inputEventNumber>
                <xsl:value-of select="WillsXMLStart/inputEventNumber"/>
            </inputEventNumber>
            <inputEventID>
                <xsl:variable name="inputVariable">
                    <xsl:value-of select="WillsXMLStart/inputEventID"/>
                </xsl:variable>
                <!-- <xsl:value-of select="$inputVariable"/> -->
                <xsl:value-of select="gng:getString('$inputVariable')"/>
            </inputEventID>
            <inputEventEnd>
                <xsl:value-of select="WillsXMLStart/inputEventEnd"/>
            </inputEventEnd>
        </WillsXMLStart>
    </xsl:template>
</xsl:stylesheet>ok... now for the frustrating part... what i need to do is (as the code shows(i think)), get and store in a variable called "inputVariable" the specific informati that is stored in the "inputEventID" from the xml. that works fine... but i need to pass that information as a string to the java method "getString(String inputVariable)".... my java code (just a test) is as follows:
* GetAndConvert.java
*  @author william
* Created on June 27, 2007, 8:04 AM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
public class GetAndConvert {
    /** Creates a new instance of GetAndConvert */
    public String getString(String inputVariable) {
        String x = "test";
        System.out.print("this is the string that is hardcoded into GAC: " + inputVariable);
        return x;
}OK.... i am getting the following error when i try to run the whole thing -- translation from within XSL:
XML validation started.
Checking file:/home/william/PROGRAMMING/TestingJavaXML/src/testingXML-JavaInput.xsl...
Cannot find class 'java:GetAndConvert'.
Cannot find external method 'java:GetAndConvert.getString' (must be public).
Could not compile stylesheeti have 2 packages in my "project". 1 = default where i have my xml and xsl files... 2 = JavaEvents where i have my .Java file.
any and all help would really be appreciated... as i am going bald trying to figure this out. you can either post here or you can email me at: [email protected]
thanks in advance for all your help.
Deathsbain.

OK... now i am getting this error...:
XSL
<!--
    Document   : translatorJavaXSL.xsl
    Created on : June 27, 2007, 3:53 PM
    Author     : william
    Description:
        Purpose of transformation follows.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:gng="java:JavaSRC.xmljavamain"
                exclude-result-prefixes="gng"
                version="1.0">
    <xslutput encoding="UTF-8" indent="yes" method="xml"/>
    <xsl:template match="/">
        <WillsInputXML>
            <eventStart>
                <xsl:value-of select="WillsInputXML/eventStart"/>
            </eventStart>
            <eventNumber>
                <xsl:value-of select="WillsInputXML/eventNumber"/>
            </eventNumber>
            <eventUniqueID>
                <xsl:variable name="inputVariable">
                    <xsl:value-of select="WillsInputXML/eventUniqueID"/>
                </xsl:variable>
                <xsl:value-of select="$inputVariable"/>
                <xsl:variable name="myInstance">
                    <xsl:value-of select="gng:new()"/>
                </xsl:variable>
                <xsl:value-of select="gng:xmlJavaConverter($myInstance, $inputVariable)"/>
            </eventUniqueID>
            <eventEnd>
                <xsl:value-of select="WillsInputXML/eventEnd"/>
            </eventEnd>
        </WillsInputXML>
    </xsl:template>
</xsl:stylesheet>
JAVA
* xmljavamain.java
* Created on July 2, 2007, 8:58 AM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package javaSRC;
* @author william
public class xmljavamain
    /** Creates a new instance of xmljavamain */
    public String xmlJavaConverter (String inputValue)
        return ("this is the xmljavamain function...");
}when running the "NetBeans" translator for the XSL page i get this error.
XML validation started.
Checking file:/home/william/PROGRAMMING/XML-Java-XSL/src/xmljavaxsl/translatorJavaXSL.xsl...
Cannot find class 'java:JavaSRC.xmljavamain'.
Cannot find external constructor 'java:JavaSRC.xmljavamain'.
The first argument to the non-static Java function 'xmlJavaConverter' is not a valid object reference.
Could not compile stylesheet
Could not compile stylesheet
XML validation finished.WHAT AM I DOING WRONG?
Deathsbain.

Similar Messages

  • Passing variables between data tag and Java

    Hello all,
    I have a question about using variables between data tag and java.
    Let me explain.
    I would like to populate variable "Test" with
    the information returned by jbo data tag library.
    <code>
    <% String Test = "%><jbo:ShowValue datasource="ds" dataitem="Cod" /><%";%>
    or
    <% String Test = "<jbo:ShowValue datasource="ds" dataitem="Cod" />";%>
    </code>
    This code did not work.
    Some suggestions
    Thanks
    Humberto
    null

    Humberto,
    I'm afraid I do not know the specific answer
    to your question (perhaps Juan the Data Tag
    Wizard will reply ;-). I vaguely recall
    struggling with teh same issue when I was
    playing with the tags for a demo. Here
    is a hack-around lifted from my demo
    that might help:
    <jbo:Row id="privRow" action="CURRENT" datasource="privileges" />
    <%
    String privName = (String)privRow.getAttribute("Privilegename");
    %>
    In other words, I ended up using the Row
    tag to get a local Java variable bound to the
    row instance and then used its methods
    to extract the value. I presume the class
    of the row instance is oracle.jbo.Row
    and you can lookup its supported methods
    in the reference doc.
    I'd be interested to hear if their is a more
    elegant way - the one suggested above is
    pretty tedious.
    Regards,
    Bill
    ----

  • Jquery and serialize / passing variables

    I already put this question on the jquery forum but noone responded. My question is about jquery.
    I have this image gallery, people can drop and drag pictures, the idea is they can determine theirselves the order in which images are shown on their website.
    I have the sortable part, but I don't know how to pass the new order to the next page that should contain a query that updates the ordernumber for each item.
    My code:
    <!--- load the necessary scripts --->
         <script src="scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
        <script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>
    ,!--- the actual sortable image gallery --->
    <ul id="ulsortable">
        <cfoutput query="items">
            <li id="ID_#T_items_autoID#">
                <CFIF #T_items_img1# IS NOT 0>
                    <img src="../#session.foldername#/galleries/#T_items_itemid#_thumbsitemanager.#T_items_img1#" alt="Click here to update" border="0" width="125" height="125">
                    <CFELSE>
                        <img src="layoutimg/no_picture_available.jpg" alt="" width="125" height="125" border="0">
                    </CFIF><br>
                    <CFIF #T_items_title# IS NOT "">#left("#T_items_title#","15")#</CFIF>
            </li>
        </cfoutput>
    </ul>
      <script>
        $(function() {
            $( "#ulsortable" ).sortable();
            $( "#ulsortable" ).disableSelection();
            $('#frm-sort').submit(function(){
                var sort_serialized = $("#ulsortable").sortable("serialize");
        </script>
    <form action="#request.site.webroot#/actions/act_writeneworder.cfm" method="post" id="frm-sort">
      <input type="submit" name="save" id="save" value="save" />
      <input type="hidden" name="sort_serialized" id="sort_serialized" value="" />
    </form>
    When I use this and go to the next page thrugh submit button I get the error that sort_seriallized is an empty string. i must be doing something wrong. It has been 3 days i am on it:-)

    If anyone is interested, here is the working code.
    Make sure to include the right jslibraries
    Make your stylesheet so you have an unordered list that looks like an image gallery:
    <style>
             ul
                width                : 715px;
                list-style-type    : none;
                margin              : 0;
                padding             : 0;
            /* float & allow room for the widest item */
              ul li
                float                 : left;
                width                : 136px;
                height              : 165px;
                margin              : 2px;
                text-align          : center;
                border              : 1px solid gray;
               /* stop the float */
              br
                clear            : left;
              /* separate the list from subsequent markup */
              div.wrapper
                margin-bottom    : 1em;
        </style>
    Then the jquery script:
    <script type="text/javascript">
            $(document).ready(function(){
    // sortable makes the ul drag and drop
                $("#ulsortable").sortable();
    // create variable that will be submitted with form           
                    $("#frm_sort").submit(function(){
                        var order = $('#ulsortable').sortable("serialize");
                        $('#order').val(order);
        </script>
    Ouput the listitems:
    <ul id="ulsortable">
        <cfoutput query="items">
            <li id="myprimarykey_#T_items_autoID#">
                     <img src="../#session.foldername#/galleries/#T_items_itemid#_thumbsitemanager.#T_items_img1#" alt="Click here to update" border="0" width="125" height="125">
                    <br/>
                   <CFIF #T_items_title# IS NOT "">#left("#T_items_title#","15")#</CFIF>
            </li>
        </cfoutput>
    </ul>
    Finally the form with submit button and hidden field that passes variable:
    <form action="actions/act_writeneworder.cfm" method="post" id="frm_sort">
          <input type="hidden" name="order" id="order" value="" />
          <input type="submit" name="save" id="save" value="Save new order" />
    </form>
    The page that handles the serialize and database update:
    <!--- convert the serialized string to a comma delimited list --->
        <cfset idlist = ReReplaceNoCase( form.order, "(&)?myprimarykey\[\]=", ",", "all" )>
        <cfset position = 0>
        <cfset pk = 0>
    <cfloop list="#idlist#" index="pk">
          <cfset position++>
        <cfquery name="writeneworder" datasource="#request.dba#">
            UPDATE T_items
                SET T_items_order = <cfqueryparam value="#position#" cfsqltype="CF_SQL_INTEGER">
                 WHERE T_items_autoID = <cfqueryparam value="#pk#" cfsqltype="CF_SQL_INTEGER">
        </cfquery>
    </cfloop>
    <cflocation url="#request.site.webroot#/item_choose_cat.cfm?currentopic=changeorder" addtoken="no" />
    As I couldn't find anywhere a full working exemple I decided to post this code, hope it helps you.
    Bianca

  • Multidimensional array as argument to a Java method

    Hello all,
    I have defined in C the following array :
    char my_array[100][3];I want to pass this mutidimensional array to a Java method. How should I write my C array as an argument of the Java method ?
    TIA

    You cannot do that in a straight-forward fassion. The C compiler reserves 300 consecutive bytes in memory, the base address of which is accessible through my_array. The base address of each of your 100 rows can be accessed as my_array[row]. The length of each row is fixed and only known to the programmer and the compiler which uses it to calculate the row offsets.
    Java has a slightly different approach to multi-dimensional arrays. Actually they are simply not implemented. What you see and use as multi-dimensional array is a composition of one array holding the references to other arrays - remember, arrays are also only Objects. This implies that the data of different rows does not at all represent a contingious memory region.
    So what you need to do is to allocate an array of size 100, which holds char[]s - references to char-arrays. Then you iterate through your C array and for each row you allocate an char-array of length 3 initialized to the appropriate row. The references to those char-arrays need to be stored in the char[]-array.
    Use env->NewCharArray(env, length) to create a new char[] and env->NewObjectArray(env, length, clazz, null) to create the char[][]. Accesing the elements of these arrays is described in:
    http://java.sun.com/docs/books/tutorial/native1.1/implementing/array.html

  • How to pass a JavaScript variable into a java method

    I would like to know how to pass a JavaScript variable into a java method with in a <% %> tag inside a JSP file like so:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <script LANGUAGE="JavaScript">
    myValue = someDynamicValue;
    <% System.out.println(myValue)%>
    </script>
    </head>
    <body>
    </body>
    </html>
    obviously "System.out.println(myValue)" will not work because myValue is seen as a java variable and not a JavaScript variable.
    I would like to know how to let the jsp file, that I wrote in the above code, see myValue as a JavaScript variable and not a java variable so that I can pass it to a java method.
    NOTE: the java method does not have to be a println() method, it can be any method of my choice.
    NOTE: someDynamicValue is a JavaScript value that can dynamically change

    I don't believe you can. JSPs are really just elaborate templates that an engine such as Tomcat parses and generates an HTML page based on. That page is then displayed to the user. By the time you want to use some function in Javascript, the JSP has already been parsed and generated.
    Basically, Javascript and JSPs can't talk to each other. One's server-side and the other is client-side.

  • How to pass variable form javacript to java BackingBean

    Hello,
    I am trying to pass variable from Javascript method (which is written in jspx) page to a Java BakingBean.
    here is the Javascript code:
    <SCRIPT type="text/javascript">
    function OnSave() {
    alert("The signature you have taken is the following data: " + SigPlus1.SigString);
    </SCRIPT>
    of course, this method will be called after the use press save button as follow:
    <INPUT id="submit1" name="Save" type="submit" value="Save" onclick="OnSave()"/>
    As you can see this Javascript will alert the result to the user. Instead I want to pass the object ( SigPlus1) to a Java Bean.
    I am using ADF technology with JDveloper 11.1.2.3

    here is the answer:
    ADF RichClient API - af:serverListener

  • How to call a java method so I can pass a file into the method

    I want to pass a file into a java method method from the main method. Can anyone give me some help as to how I pass the file into the method - do I pass the file name ? are there any special points I need to put in the methods signature etc ?
    FileReader file = new FileReader("Scores");
    BufferedReader infile = new BufferedReader(file);
    Where am I supposed to put the above text - in the main method or the one I want to pass the file into to?
    Thanks

    It's a matter of personal preference really. I would encapsulate all of the file-parsing logic in a separate class that implements an interface so that if in the future you want to start taking the integers from another source, e.g. a db, you wouldn't need to drastically alter your main application code. Probably something like this, (with an assumption that the numbers are delimited by a comma and a realisation that my file-handling routine sucks):
    public class MyApp{
    public static void main(String[] args){
    IntegerGather g = new FileIntegerGatherer();
    Integer[] result = g.getIntegers(args[0]);
    public interface IntegerGatherer{
    public Integer[] getIntegers(String location);
    import java.io.*;
    public class FileIntegerGatherer implements IntegerGatherer{
    public Integer[] getIntegers(String location){
    FileInputStream fs=null;
    try{
    File f = new File(location);
    fs = new FileInputStream(f);
    byte[] in = new byte[1024];
    StringBuffer sb = new StringBuffer();
    while((fs.read(in))!=-1){
    sb.append(new String(in));
    StringTokenizer st = new StringTokenizer(sb.toString(),",");
    Integer[] result = new Integer[st.countTokens()];
    int count = 0;
    while(st.hasMoreTokens()){
    result[count]=Integer.valueOf(st.nextToken());
    count++;
    catch(IOException e){
    //something sensible here
    finally{
    if(fs!=null){
    try{
    fs.close();
    catch(IOException f){
    return result;
    Once compiled you could invoke it as java MyApp c:\myInts.txt
    Sorry if there are typos in there, I don't have an ide open ;->

  • How to pass a file into a java method

    I am trying to pass a file into a java method so I can read the file from inside the method. How can I do this? I am confident passing int, char, arrays etc into methods as I know how to identify them in a methods signature but I have no idea how to decalre a file in a mthods signature. Any ideas please ?
    Thanks

    Hi,
    Just go thru the URL,
    http://www6.software.ibm.com/devtools/news1001/art24.htm#toc2
    I hope you will get a fair understanding of 'what is pass by reference/value'.
    You can pass Object reference as an argument.
    What Pablo Lucien had written is right. But the ideal situation is if you are not modifying the
    file in the calling method, then you can pass the String (file name) as an argument to the called method.
    Sudha

  • I am using NetbeansIDE 5.5.1 In this, How to use java methods in xsl code ?

    Hi everybody,
    I am using Netbeans IDE 5.5.1, In that i am trying to call java methods in XSL code?
    Can anyone help me to provide the solution for this ????
    Note:
    I wrote simple java class method to change the case of given input string.
    Also i compiled that class.
    Now i need to know, where do i put that compiled class file or the source java file, to run my xsl code......
    Please reply soon..
    Thanks in advance....
    regards,
    Selva

    Jim, that sounds like a good hypothesis. Yes, I am using smart previews. I have my originals on an external drive which is connected. Still, LR can not find them. Do you know how to tell LR where to find the originals? I would like LR to identify the source automatically: if external drive is connected LR should show "original and smart preview" not only "smart preview". Thanks for your help.

  • Why does the Java method ServletContext.getResourceAsStream return null with a know good path to an xsl file?

    iPLANET ISSUE
    Why does the Java method ServletContext.getResourceAsStream return null with a know good path to an xsl file?
    CODE
    ServletContext context = mpiCfg.getServletConfig().getServletContext();
    // Debugging
    out.print(context.getServerInfo());     // Get server info
    out.print(&#8220;getRealPath = &#8221; + context.getRealPath("WEB-INF/xsl/RedirectToAcs.xsl"));
    String strXslName = "RedirectToAcs.xsl";
    InputStream is = context.getResourceAsStream("WEB-INF/xsl/"+ strXslName);
    TRACE FROM THE LOG
    [26/Jul/2002:08:23:15] info ( 2868): [0][][ClearCommerceCcpaMpi][]getServerInfo() = iPlanet-WebServer-Enterprise/6.0, getRealPath() = C:\iPlanet\Servers\web-apps\ccpa\WEB-INF\xsl\RedirectToAcs.xsl
    [26/Jul/2002:08:23:15] info ( 2868): [0][][ClearCommerceCcpaMpi][]strXslName = RedirectToAcs.xsl, is = null
    [26/Jul/2002:08:23:15] info ( 2868): [1][][ClearCommerceCcpaMpi][16]ResourceAsStream is null
    [26/Jul/2002:08:23:15] info ( 2868): [1][][ClearCommerceCcpaMpi][30]Problem reading XSL file.
    DIRECTORY DUMP
    C:\iPlanet\Servers\web-apps\ccpa\WEB-INF\xsl>dir
    Volume in drive C has no label.
    Volume Serial Number is 9457-EBF4
    Directory of C:\iPlanet\Servers\web-apps\ccpa\WEB-INF\xsl
    07/22/2002 05:54p <DIR> .
    07/22/2002 05:54p <DIR> ..
    07/22/2002 05:54p 3,086 RedirectToAcs.xsl
    07/22/2002 05:54p 3,088 Response.xsl
    2 File(s) 6,174 bytes
    2 Dir(s) 1,797,405,696 bytes free

    I think there's supposed to be a forward slash before WEB-INF.
    InputStream is = context.getResourceAsStream("/WEB-INF/xsl/"+ strXslName);

  • Java method call from c passing string

    I have a c program which gets a char* myVar and I want to pass it to a java method which takes in a string but what ever I try I just get errors. This seems like a simple thing to do but I keep getting stuck so any help would be much appreciated. Thanks

    I think you need to expalin your problem in more detail, or better still, post some code. Then we'll be able to help.

  • Java method call from c passing string more info

    I am trying to call a java method from c passing a String as an argument.
    my C code is as follows.
    //Initalise jstring and class (to recieve String)
    jstring textp;
    jclass texts = (*env)->GetObjectClass(env, obj);
    jmethodID text = (*env)->GetMethodID(env, texts, "texture", "([Ljava/lang/String;)V");
    //Create a new jstring from the char* texturePath (in textures)
    //call the java method with the jstring
    textp = (*env)->NewStringUTF(env,ret.textures->texturePath);
    (*env)->CallVoidMethod(env, obj, text,textp);
    //java code
    // texture which recieves a string
    public void texture(String texturePath){
    The error I get is as follows:
    SIGSEGV 11 segmentation violation
    si_signo [11]: SEGV
    si_errno [0]:
    si_code [1]: SEGV_MAPERR [addr: 0xc]
    stackpointer=FFBED790
    "Screen Updater" (TID:0x4f9060, sys_thread_t:0x4f8f98, state:CW, thread_t: t@11, threadID:0xf2d31d78, stack_bottom:0xf2d32000, stack_size:0x20000) prio=4
    [1] java.lang.Object.wait(Object.java:424)
    [2] sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:78)
    [3] sun.awt.ScreenUpdater.run(ScreenUpdater.java:98)
    "AWT-Motif" (TID:0x40be50, sys_thread_t:0x40bd88, state:R, thread_t: t@10, threadID:0xf2d71d78, stack_bottom:0xf2d72000, stack_size:0x20000) prio=5
    [1] sun.awt.motif.MToolkit.run(Native Method)
    [2] java.lang.Thread.run(Thread.java:479)
    "SunToolkit.PostEventQueue-0" (TID:0x431950, sys_thread_t:0x431888, state:CW, thread_t: t@9, threadID:0xf2e71d78, stack_bottom:0xf2e72000, stack_size:0x20000) prio=5
    [1] java.lang.Object.wait(Object.java:424)
    [2] sun.awt.PostEventQueue.run(SunToolkit.java:407)
    "AWT-EventQueue-0" (TID:0x430ea8, sys_thread_t:0x430de0, state:CW, thread_t: t@8, threadID:0xf3071d78, stack_bottom:0xf3072000, stack_size:0x20000) prio=6
    [1] java.lang.Object.wait(Object.java:424)
    [2] java.awt.EventQueue.getNextEvent(EventQueue.java:212)
    [3] java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:100)
    [4] java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:91)
    [5] java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
    Exiting Thread (sys_thread_t:0xff343db0) : no stack
    "Finalizer" (TID:0x154e98, sys_thread_t:0x154dd0, state:CW, thread_t: t@6, threadID:0xfe391d78, stack_bottom:0xfe392000, stack_size:0x20000) prio=8
    [1] java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:146)
    [2] java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:168)
    [3] java.lang.ref.Finalizer$FinalizerWorker$FinalizerThread.run(Finalizer.java:124)
    "Reference Handler" (TID:0x1506a0, sys_thread_t:0x1505d8, state:CW, thread_t: t@5, threadID:0xfe3c1d78, stack_bottom:0xfe3c2000, stack_size:0x20000) prio=10
    [1] java.lang.Object.wait(Object.java:424)
    [2] java.lang.ref.Reference$ReferenceHandler.run(Reference.java:130)
    "Signal dispatcher" (TID:0x13d180, sys_thread_t:0x13d0b8, state:MW, thread_t: t@4, threadID:0xfe3f1d78, stack_bottom:0xfe3f2000, stack_size:0x20000) prio=10
    "main" (TID:0x38918, sys_thread_t:0x38850, state:R, thread_t: t@1, threadID:0x25228, stack_bottom:0xffbf0000, stack_size:0x800000) prio=5 *current thread*
    [1] loader.Callbacks.nativeMethod(Native Method)
    [2] loader.Callbacks.main(Callbacks.java:184)
    [3] graphics.GR_MakeTrack.init(GR_MakeTrack.java:60)
    [4] graphics.GR_MakeTrack.main2(GR_MakeTrack.java:49)
    [5] graphics.GR_MakeTrack.main(GR_MakeTrack.java:41)
    [6] control.GE_main.GE_main1(GE_main.java:87)
    [7] control.GE_main.main(GE_main.java:66)
    gmake: *** [run] Abort (core dumped)

    I am trying to call a java method from c passing a
    String as an argument.
    my C code is as follows.
    //Initalise jstring and class (to recieve String)
    jstring textp;
    jclass texts = (*env)->GetObjectClass(env, obj);
    jmethodID text = (*env)->GetMethodID(env, texts,
    "texture", "([Ljava/lang/String;)V");
    Hi Pete,
    your problem is that the method texture you are trying to find does not exist. If you look carefully at your declaration of the method signature in the GetMethodID call you will see "([Ljava/lang/String;)V" which is trying to find a method that accepts a String array as its parameter. Remove the [ from the method signature and it should work ok. You might want to test text (jmethodID) for NULL or 0 before trying to call it as well.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to call java method from xsl

    hi friends,
    How to call a java method from xsl, i have a xsl file which will call the java method and retrieve the value and display it to the user. but its work well when i set xalan.jar and xerces.jar and the java class files in my classpath and run as
    java org.apache.xalan.xslt.Process -in navigate.xml -xsl nav-exst.xsl -HTML -out navoutpage.html[b]
    in the command prompt but when i deploy it as web application it gives error as
    [b]Namespace 'MyPack' does not contain any functions[b]

    OK. So, I think we can all conclude that you don't need to call any Java method, can't we? And, that wfUpdateMetadata is the command that will update your metadata.
    Now, the question is what are its arguments. It has two - the first is the name of a custom metadata field to be updated (let's suppose that one field is called xMinorVersion, and the other xMajorVersion), the other is the new value, e.g. <$wfUpdateMetaData("xMinorVersion", "New value.")$>As for new value - do you insist on using strings? Since you want to increase the value, it would be more convenient to work with numbers. For instance, with integers you could go with <$wfUpdateMetaData("xMinorVersion", xMinorVersion + 1)$>With strings you will need to convert it to numbers and back to strings. Besides, what happens if you have more than 100 minor versions? (you mentioned you want to add 0.01, but that would finally increase the major version, wouldn't it?) So, I think these two numbers are independent (perhaps, with exception that increase on the major version set the minor version to .00).
    If you want to present it, you can use profiles that will construct for you the representation 2.304 out of MajorVersion = 2, MinorVersion = 304
    Solved?

  • Concatenating VARCHAR2 to pass to a Java method

    Hi, I've imported in Oracle 10g a Java method which processes a String. I've mapped the String to a varchar2 as follow:
    create or replace function PARSE(input in varchar2) RETURN varchar2
    as language java
    name 'Base64.decodeToString(java.lang.String) return String';
    I then built a simple PL/SQL program to build the string to pass to the Java method as follows:
    create or replace procedure TEST_PARSE(input_tid in number) is
    begin
    declare
    result varchar2(32767);
    cursor object_cur is select TEXT from OBJECTSTORE where TID=input_tid order by rnumber;
    object_row object_cur%ROWTYPE;
    begin
    open object_cur;
    loop
    fetch object_cur into object_row;
    exit when object_cur%NOTFOUND;
    result := result || object_cur.TEXT;
    end loop;
    close object_cur;
    result := PARSE(result);
    end
    The PL/SQL program just concatenates the TEXT column from a bunch of records in the table OBJECTSTORE. The TEXT column is defined as a VARCHAR2(4000).
    Now if the SELECT in the TEST_PARSE program returns only 1 record, then everything works and the PARSE Java function returns the processed String.
    If the SELECT returns 2 or more records then I get the following warning and the Java method doesn't return anything:
    "Warning: PL/SQL procedure successfully completed with compilation errors"
    Since I know that the Java method works fine (it has been tested within java programs successfully ) I think the problem is something to do with data types or maybe with the size of the concatenated string.
    Any help really appreciated. Thank you!

    Thanks guys, it still doesn't work, but at least now I can see some error messages:
    Error code -24345: ORA-24345: A Truncation or null fetch error occurred
    1) The error occurs when I call the Java method. As before this happens only when the select returns more than 1 record and I concatenate two or more TEXT (each one is a VARCHAR2(4000)). However the concatenation works fine so I guess the problem is that the resulting string is too big for the Java method to process.
    Or maybe the string returned by the Java method is too big for the PL/SQL varchar2?
    2) Also why do I get a compilation error if I try to add the size of the varchar2 in the mapping below?
    create or replace function PARSE(input in varchar2) RETURN varchar2
    as language java
    name 'Base64.decodeToString(java.lang.String) return String';

  • How come Java methods can only return one variable?

    Hi,
    I am just curious, how come C/C++/Java methods/functions can only return one argument but can accept many parameters.
    I know that the workaround is to return an object, but sometimes creating a class is just too much overhead.
    Thank you in advance.

    Hello,
    It's an interesting discussion. To get the full answer to your question, you'd have to consult the library and find books on programming language design and implementation.
    I believe the tradition goes all the way back to the first programming languages having subroutines/procedures/functions/methods in them: you can return nothing at all (void i Java) or a single value. The need for returning a single value, I guess, comes from the wish to embed calls in arithmetic expressions:
      res = 2 * someObject.foo(x) - anotherObj.bar(a,b);To my knowledge, few languages allow you to return more values. One that does is BETA (see www.daimi.au.dk/~beta/). Though not indispensable, it's convenient sometimes. I don't know why it's not more widespread.
    Yours,
    Ole

Maybe you are looking for

  • How to Restrict the users from changing the Default variant of report.

    Hello everybody, The requirement is to restrict the users to save and overwrite  the default layout variant (Layout for higher managenet)set for the report, but at the same time they should be able to change and save the other layouts for which they

  • Transfer info from one mac to another

    I'm having problems with transfering data between my macbook (old) and my macbook pro (new) they are both in perfect running order. I have been trying to use target disk mode but I have been totally unsuccessful. I can't find my photo or my itunes li

  • Connect in database default  wiht SQL PLUS

    Hi How can I to connect in database default , using SQL PLUS ? And after I may change conexion with ACCEPT and change PROMPT ?

  • Best way to import a Camtasia .SWF File?

    I recently created a screen tutorial (as an .swf file) using Camtasia Studio 5 and would like to import the .swf I created into a topic of a Flash Web project I'm working on. I tried putting the .swf on in an .htm but RoboHelp crashes. It doesn't cra

  • Busted Built-In Memory

    I had my 9810 crash a while ago, and managed to fix it by re-loading the 7.1 update and starting all over with my phone. When I got it working the phone said the built in storage was fouled up. The only fix was to format the built -in memory. The pho