Passing Objects as Arguments

Hi all.
Please tell me how the objects passed as arguments to methods are treated.
Actually I have a method swap(), which takes two objects as arguments. This method swaps objects without returning anything. But this does not affect original objects. Is there any other way then obvious (make changes to class wide objects) to do this thing?

Hi all.
Please tell me how the objects passed as arguments to
methods are treated.The objects are always passed per reference (in order to avoid the discussion: the object references are passed per value); i.e. the changes in the method parameters don't affect the caller, the changes in the referenced objects do.
The primitive values are passed per value, i.e. the changes in the method parameters don't affect the caller.
Important: The same is valid for the method return value as well.
There is no possibility to change this behaviour.
Actually I have a method swap(), which takes two
objects as arguments. This method swaps objects
without returning anything. But this does not affect
original objects. Is there any other way then obvious
(make changes to class wide objects) to do this thing?

Similar Messages

  • Calling a Procedure which has Array of Objects as arguments (from BPEL)

    Hi,
    I wanted to pass multiple records as arguments to a stored procedure from BPEL.
    We created stored procedure which takes array of Objects as arguments. I invoked it from BPEL. It was successfully compiled and deployed.
    At runtime it is throwing following error.
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
    <part name="code">
    <code>17072</code>
    </part>
    <part name="summary">
    <summary>Error binding the value of a parameter. An error occurred when binding the value of parameter ARG in the SCOTT.TESTPACK.TESTPROC API. Cause: java.sql.SQLException: Inserted value too large for column: "sadfsafsad" Check to ensure that the parameter is a valid IN or IN/OUT parameter of the API. Contact oracle support if error is not fixable.</summary>
    </part>
    <part name="detail">
    <detail>Inserted value too large for column: "sadfsafsad"</detail>
    </part>
    </bindingFault>

    I think you from Sierra Atlantic and you using Beta 3. There was a bug in Beta 3 in using arrays, which got fixed in post Beta3. You got to wait till next release.

  • Passing array as arguments

    im very new to java, dont know much about it.can any one please tell me how ot pass array or array list as a argument to a class

    this is my main class where it calls a readfile class to read contents of file
    import java.awt.List;
    import java.io.IOException;
    public class Sample {
    public static List alist = new List();
    public static void main(final String[] args) throws IOException {
    new Readfile().readFromFile("c:/sam.txt");
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.StringTokenizer;
    this is readfile class which reads from file having comma as a delimiter and store it in an array list.
    class Readfile {
    * Declaration of arraylist.
    static List alist = new ArrayList();
    public void readFromFile(final String filename) throws IOException {
    BufferedReader bufferedReader = null;
    // Construct the BufferedReader object
    bufferedReader = new BufferedReader(new FileReader(filename));
    String line;
    while ((line = bufferedReader.readLine()) != null) {
    // storing in to arraylist
    StringTokenizer st1 = new StringTokenizer(line, ",");
    while (st1.hasMoreTokens()) {
    alist.add(st1.nextToken());
    //here just im printing the elements from arraylist.
    for (int j = 0; j < alist.size(); j++) {
    System.out.println(alist.get(j));
    if (bufferedReader != null) {
    bufferedReader.close();
    //converting arraylist to array;
    String[] strArray = new String[50];
    alist.toArray(strArray);
    //passing array as argument
    Area area1 = new Area(strArray);
    area1.calc();
    area1.print();
    Here is the class for area
    class Area {
    String[] alist1 = new String[50];
    private int[] array = new int[50];
    private int[] array1 = new int[50];
    public Area(final String[] alist) {
    alist1 = alist;
    void calc() {
    * for (int i = 0; i < 2 - (alist1.length); i = i + 2) { array1[i] =
         (Integer.valueOf(alist1).intValue() * Integer .valueOf(alist1[i ]).intValue());
    * To print the Area.
    void print() {
    System.out.println("Area of Rectangles ");
    for (int i = 0; i < array1.length; i++) {
    System.out.println(array1[i]);
    im not sure how standard my code is .please guide me

  • Pass Files As Arguments

    I have several files and want to pass them as arguments to a Helper class for further processing. I put the public static void main (String arg[]) {} class and the Helper class in a package.
    I got error messages "cannot resolve symbol" for:
    1. variable XSLTransformHelper for if (!XSLTransformHelper.transform(xmlin, xslin, htmlout))
    2. method close() for xmlin.close();
    3. method close() for xslin.close();
    4. method close() for htmlout.close();
    I cannot spot the problems and my code can be seen below:
    =====================================
    package Transform;
    import java.io.*;
    public class XSLTransform {
    public static void main(String[] args) throws Exception {
    //Create a file object with the file name in the argument:
    File xmlin = new File("c:/javaprj/RSS.xml");
    File xslin = new File("c:/javaprj/RSS.xsl");
    File htmlout = new File("c:/javaprj/RSS.html");
    if (!XSLTransformHelper.transform(xmlin, xslin, htmlout))
    System.err.println("Transformation failed");
    else
    try {
    xmlin.close();
    xslin.close();
    htmlout.close();
    catch(IOException e)
    {System.out.println("closing file exception");}
    =======================================================
    =======================================================
    package Transform;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    public class XSLTransformHelper {
    public static boolean transform(String xmlFilename, String xslFilename, String resultFilename) {
    try {
    TransformerFactory factory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new FileInputStream(xmlFilename));
    Source xslSource = new StreamSource(new FileInputStream(xslFilename));
    Transformer transformer = factory.newTransformer(xslSource);
    Result result = new StreamResult(new FileOutputStream(resultFilename));
    transformer.transform(xmlSource, result);
    return true;
    } catch (TransformerFactoryConfigurationError transformerFactoryConfigurationError) {
    transformerFactoryConfigurationError.printStackTrace();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (TransformerException e) {
    e.printStackTrace();
    return false;
    ======================================================

    I have several files and want to pass them as
    arguments to a Helper class for further processing. I
    put the public static void main (String arg[]) {}
    class and the Helper class in a package.
    I got error messages "cannot resolve symbol" for:
    1. variable XSLTransformHelper for if
    (!XSLTransformHelper.transform(xmlin, xslin,
    htmlout))
    2. method close() for xmlin.close();
    3. method close() for xslin.close();
    4. method close() for htmlout.close();
    I cannot spot the problems and my code can be seen
    below:
    =====================================
    package Transform;
    import java.io.*;
    public class XSLTransform {
    public static void main(String[] args) throws
    ws Exception {
    //Create a file object with the file name in the
    n the argument:
    File xmlin = new File("c:/javaprj/RSS.xml");
    File xslin = new File("c:/javaprj/RSS.xsl");
    File htmlout = new File("c:/javaprj/RSS.html");
    if (!XSLTransformHelper.transform(xmlin, xslin,
    slin, htmlout))
    System.err.println("Transformation failed");
    else
    try {
    xmlin.close();
    xslin.close();
    htmlout.close();
    catch(IOException e)
    {System.out.println("closing file
    losing file exception");}
    =======================================================
    =======================================================
    package Transform;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    public class XSLTransformHelper {
    public static boolean transform(String
    ing xmlFilename, String xslFilename, String
    resultFilename) {
    try {
    TransformerFactory factory =
    y factory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new
    mSource(new FileInputStream(xmlFilename));
    Source xslSource = new StreamSource(new
    mSource(new FileInputStream(xslFilename));
    Transformer transformer =
    ansformer = factory.newTransformer(xslSource);
    Result result = new StreamResult(new
    mResult(new FileOutputStream(resultFilename));
    transformer.transform(xmlSource, result);
    return true;
    } catch (TransformerFactoryConfigurationError
    onError transformerFactoryConfigurationError) {
    transformerFactoryConfigurationError.printStackTrace()
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (TransformerException e) {
    e.printStackTrace();
    return false;
    ======================================================I observe that you pass Files as arguments of the method transform while this method is expecting Strings!!!!

  • Passing objects by reference in PL/SQL

    Hi,
    I have come across an unexpected problem using object types in PL/SQL that is causing me some grief. I'm from a Java background and am relatively new to Oracle Objects but what I'm trying to do is fairly trivial, I think. The code below illustrates the problem.
    --- cut here ---
    CREATE OR REPLACE TYPE test_obj_t AS OBJECT
    num INTEGER,
    CONSTRUCTOR FUNCTION test_obj_t RETURN SELF AS RESULT
    CREATE OR REPLACE TYPE BODY test_obj_t IS
    CONSTRUCTOR FUNCTION test_obj_t RETURN SELF AS RESULT IS
    BEGIN
    num := 0;
    RETURN;
    END;
    END;
    CREATE OR REPLACE PACKAGE test_obj_ref AS
    PROCEDURE init(o IN test_obj_t);
    PROCEDURE inc;
    FUNCTION get_num RETURN INTEGER;
    END;
    CREATE OR REPLACE PACKAGE BODY test_obj_ref IS
    obj test_obj_t;
    PROCEDURE init(o IN test_obj_t) IS
    BEGIN
    obj := o;
    END;
    PROCEDURE inc IS
    BEGIN
    obj.num := obj.num + 1;
    END;
    FUNCTION get_num RETURN INTEGER IS
    BEGIN
    RETURN obj.num;
    END;
    END;
    --- cut here ---
    The object type test_obj_t holds a integer and the test_obj_ref package holds a 'reference' to an instance of the object.
    To test the above code I run this PL/SQL block:
    declare
    obj test_obj_t;
    begin
    obj := test_obj_t;
    test_obj_ref.init(obj);
    dbms_output.put_line('obj.num='||obj.num);
    dbms_output.put_line('test_obj_ref.get_num='||test_obj_ref.get_num);
    test_obj_ref.inc;
    dbms_output.put_line('obj.num='||obj.num);
    dbms_output.put_line('test_obj_ref.get_num='||test_obj_ref.get_num);
    test_obj_ref.inc;
    dbms_output.put_line('obj.num='||obj.num);
    dbms_output.put_line('test_obj_ref.get_num='||test_obj_ref.get_num);
    end;
    giving the output:
    obj.num=0
    test_obj_ref.get_num=0
    obj.num=0
    test_obj_ref.get_num=1
    obj.num=0
    test_obj_ref.get_num=2
    It appears that the object held by the test_obj_ref package is being incremented as expected, but I would have expected the object declared in the PL/SQL block to be pointing to the same object and so should report the same incremented values.
    I suspect that the object is copied in the call to test_obj_ref.init() so I end up with two object instances, one that is held by the test_obj_ref package and one in the anonymous block. Although, I thought that all IN parameters in PL/SQL are passed by reference and not copied!
    Am I right?
    Is passing objects by reference possible in PL/SQL, if so how?
    I'm using Oracle 10.2.0.3.
    Cheers,
    Andy.

    the object being passed to the test_obj_ref.init+ procedure is passed by reference; however, when you assign it to your package variable obj it is being copied to a new instance. you can pass object instances as parameters to procedures using the +IN OUT [NOCOPY]+ *calling mode, in which case modifications to the attributes of the passed object will be reflected in the calling scope's instance variable.
    oracle's only other notion of an object reference is the +"REF &lt;object-type&gt;"+ datatype, which holds a reference to an object instance stored in an object table or constructed by an object view.
    hope this helps...
    gerard

  • Passing object as parameter in JSF using h:commandLink tag

    Hi ,
    I have a scenario in which i need to pass objects from one jsp to another using h:commandLink. i read balusC article "Communication in JSF" and found a basic idea of achieving it. Thanks to BalusC for the wonderful article. But i am not fully clear on the concepts and the code is giving some error. The code i have is
    My JSP:
    This commandlink is inside a <h:column> tag of <h:dataTable>
    <h:commandLink id="ol3"action="ManageAccount" actionListener="#{admincontroller.action}" >
                   <f:param id="ag" name="account" value="#{admincontroller.account}" />
                   <h:outputText id="ot3" value="Manage Account" rendered="#{adminbean.productList!=null}" />
                   </h:commandLink>
    Also a binding in h:dataTable tag with the  binding="#{admincontroller.dataTable}"
                      My Backing Bean:
    public class CompanyAdminController {
              private HtmlDataTable dataTable;
              private Account account=new Account();
    public HtmlDataTable getDataTable() {
            return dataTable;
    public Account getAccount() {
             return this.account;
    public void setAccount(Account account) {
              this.account = account;
          public void action(){
                account= (Account)this.getDataTable().getRowData();
           } faces-config.xml
    <navigation-rule>
        <from-view-id>/compadmin.jsp</from-view-id>
        <navigation-case>
          <from-outcome>ManageAccount</from-outcome>
          <to-view-id>/manageAccount.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.forrester.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>account</property-name>
                   <property-class>com.model.Account</property-class>
                   <value>#{param.account}</value>
             </managed-property>
         </managed-bean>My account object:
    public class Account {
    string name;
      public String getName()
        return this.name;
      public void setName(String name)
           this.name=name;
      }I need to display #{admincontroller.account.name} in my forwarded jsp. But I am not sure whether the code i wrote in commandlink is correct. I get an error if i use <f:setActionListener> . No tag "setPropertyActionListener" defined in tag library imported with prefix "f"
    Please advise.
    Edited by: twisai on Oct 18, 2009 11:46 AM
    Edited by: twisai on Oct 18, 2009 11:47 AM
    Edited by: twisai on Oct 18, 2009 11:48 AM

    Yes.. iam removed the managedproperty from faces-config. But still i get the null pointer exception on main jsp itself and i am taken to second jsp manageaccount.jsp. Did you find anything wrong in my navigation case in the action method??
                                     public String loadAccount(){
               Account account = (Account)this.getDataTable().getRowData();
                return "ManageAcct";And also can you please answer this question i have
    The AdminController is the backing bean of 1st JSP and manageAccontController is the backing bean of forwarded JSP .
    Can i put this action method and dataTable binding in a 2nd manageAccontController backing bean instead of AdminController. But if i do that way dataList binding in h:dataTable tag will be in first JSP backing bean and dataTable binding to 2nd JSP. Not sure how to deal with this.
    {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Memory leak problem while passing Object to stored procedure from C++ code

    Hi,
    I am facing memory leak problem while passing object to oracle stored procedure from C++ code.Here I am writing brief description of the code :
    1) created objects in oracle with the help of "create or replace type as objects"
    2) generated C++ classes corresponding to oracle objects with the help of OTT utility.
    3) Instantiating classes in C++ code and assigning values.
    4) calling oracle stored procedure and setting object in statement with the help of setObject function.
    5) deleted objects.
    this is all I am doing ,and getting memory leak , if you need the sample code then please write your e-mail id , so that I can attach files in reply.
    TIA
    Jagendra

    just to correct my previous reply , adding delete statement
    Hi,
    I am using oracle 10.2.0.1 and compiling the code with Sun Studio 11, following is the brief dicription of my code :
    1) create oracle object :
    create or replace type TEST_OBJECT as object
    ( field1 number(10),
    field2 number(10),
    field3 number(10) )
    2) create table :
    create table TEST_TABLE (
    f1 number(10),f2 number (10),f3 number (10))
    3) create procedure :
    CREATE OR REPLACE PROCEDURE testProc
    data IN test_object)
    IS
    BEGIN
    insert into TEST_TABLE( f1,f2,f3) values ( data.field1,data.field2,data.field3);
    commit;
    end;
    4) generate C++ classes along with map file for database object TEST_OBJECT by using Oracle OTT Utility
    5) C++ code :
    // include OTT generate files here and other required header files
    int main()
    int x = 0;
    int y = 0;
    int z =0;
    Environment *env = Environment::createEnvironment(Environment::DEFAULT);
    Connection* const pConn =
    env->createConnection"stmprf","stmprf","spwtrgt3nms");
    const string sqlStmt("BEGIN testProc(:1) END;");
    Statement * pStmt = pConn->createStatement(sqlStmt);
    while(1)
    TEST_OBJECT* pObj = new TEST_OBJECT();
    pObj->field1 = x++;
    pObj->field2 = y++;
    pObj->field3 = z++;
    pStmt->setObject(1,pObj);
    pStmt->executeUpdate();
    pConn->commit();
    delete pObj;
    }

  • Hoe to pass object as a parameter thru webSerive

    I need to pass Object as a parameter to web service:
    example:
    public calss returnCodes{
    int ret_code;
    String ret_string;
    public retrunCodes(int ret_code, String ret_string){
    this.ret_code = ret_code;
    this.ret_string = ret_string;
    public int getret_code()
    return this.ret_code;
    public String getret_string {
    return this,ret_string
    and other repc holder class to hold returnCodes
    public class retrunCodesHolder implents javax.xml.rpc.Holder
    returnCode value;
    pubic returnCodesHolder(){
    public returnCodesHolder(returnCodes value) {
    this.value = value;
    In Webservice I use returnCodesHolder as parameter.
    WebService getReturnCodesWs I have
    returnCodes retCodes = new returnCodes(04,"Good return code)
    returnCodesHolder retholder = new returnCodesHolder(retCodes)
    return myString;
    When I am calling above webService in servlet I have code:
    org.test.mytest.returnCodesHolder retHolder = new org.test.mytest.returnCodesHolder();
    String result = port.getReturnCodesWs(retHolder);
    How to I access /get values of returnCodes class in my calling servlet?
    I am using Tomcat v 6.0

    I believe (although have never used, so if I'm wrong,
    correct me please!) you can do it with implicit
    dynamic cursors, such as:
    For rec in 'select col1, col2 from table 1 '||lstr
    loop
    Not really:
    michaels>  declare
       lstr   varchar2 (30) := ' where empno = 7788';
    begin
       for rec in 'select * from emp e ' || lstr
       loop
          null;
       end loop;
    end;
    Error at line 1
    ORA-06550: line 5, column 4:
    PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
       . ( * @ % & - + / at mod remainder rem .. <an exponent (**)>
       ||

  • Passing Objects to Stored Procedures in SQL Queries: UNREF(REF(o))

    To me it seems that passing an object (type) to stored procedure in a SQL query is quite laborious. See:
    I created the following simple type:
    TYPE LAST AS OBJECT (
    id NUMBER
    defined a function:
    FUNCTION "CHECKLAST" (l LAST)
    RETURN NUMBER
    AS LANGUAGE JAVA
    NAME 'Checker.checkLast(Last) return int';
    created a typed table:
    CREATE TABLE lastTable OF Last;
    inserted some objects:
    INSERT INTO lastTable VALUES (1003);
    NOW! If want to use the StoredFunction I have to use the following syntax:
    SELECT checkLast(DEREF(REF(o)))
    FROM lasttable o;
    That's not very elegant.
    I would expect the follwing to be working:
    SELECT checkLast(o)
    FROM lasttable o;
    Did I do something wrong? Or did Oracle forget to implement the simple syntax?
    Even worse, the DEREF(REF(o)) trick does not work for member functions...
    Regards,
    André

    I did some experiments and can now (partly) answer my own question:
    Indeed, it is possible to declare a function with a parameter passed as reference:
    CREATE OR REPLACE TYPE Point AS OBJECT
    ID INT,
    MEMBER FUNCTION distance(q IN REF Point) RETURN NUMBER
    Unfortunately, it is not possible to use the REF in PL/SQL directly:
    CREATE OR REPLACE TYPE BODY Point is
    MEMBER FUNCTION distance(q IN REF Point) RETURN NUMBER
    AS
    BEGIN
    RETURN q.ID - SELF.ID; --Error(5,14): PLS-00536: No navigation through REF
    END;
    end;
    So, for testing purposes I decided to implement a very simple PL/SQL member function:
    CREATE OR REPLACE TYPE BODY Point is
    MEMBER FUNCTION distance(q IN REF Point) RETURN NUMBER
    AS
    BEGIN
    RETURN -1;
    END;
    end;
    BUT: The SQL query without VALUE is still not possible. The query
    SELECT *
    FROM PointTable d, PointTable e
    WHERE d.distance(e) > 0
    renders ORA-00904: "E": invalid identifier
    Somehow the 'e' seems to be misinterpreted completely.
    Illogically, the following query works fine:
    SELECT *
    FROM PointTable d, PointTable e
    WHERE d.distance(REF(e)) > 0
    The illogical thing is that, now 'E' seems to refer to a VALUE and not to REF (because we can use the REF function), whereas in Gaverill's post 'O' seems to refer to a REF (because we can use the VALUE function).
    My intent is to avoid both the VALUE(o) from Gaverill's example and the REF(e) from my example, because both is not intuitive for end users...
    Maybe I have to define a VIEW holding the object values... But then the end user has to use it in the FROM part.
    All in all, there seems to be no elegant solution for passing objects as parameters to functions...
    Regards,
    André

  • Can we pass objects to pl/sql block

    hi,
    can we pass objects to pl/sql block.i think we can.how to pass it.help me in getting the examples of "passing objects to pl/sql block"

    What exactly do you mean ? You can pass objects like any other parameters
    into and out from procedures/functions:
    SQL> create or replace procedure get_object(myobj in out nocopy my_obj)
      2  is
      3  begin
      4   dbms_output.put_line('ID : ' || myobj.empno);
      5   dbms_output.put_line('Salary : ' || myobj.sal);
      6   dbms_output.put_line('Department : ' || myobj.deptno);
      7   myobj.sal := myobj.sal*2;
      8  end;
      9  /
    Procedure created.
    SQL> declare
      2   mo my_obj := my_obj(1,1000,10);
      3  begin
      4   get_object(mo);
      5   dbms_output.put_line('New salary : ' || mo.sal);
      6  end;
      7  /
    ID : 1
    Salary : 1000
    Department : 10
    New salary : 2000
    PL/SQL procedure successfully completed.Rgds.

  • Passing Object parameters to Procedures in Oracle

    Hi,
    Can any one please provide me with a sample example how to pass object types as parameters (IN) to a procedure/package.
    Thanks in Advance.

    Here is a simple example
    SQL> create or replace type tbl as table of number
      2  /
    Type created.
    SQL> create or replace procedure proc(pTbl tbl)
      2  as
      3  begin
      4     for i in 1..pTbl.count
      5     loop
      6             dbms_output.put_line(pTbl(i));
      7     end loop;
      8  end;
      9  /
    Procedure created.
    SQL> exec proc(tbl(1,2,3,4,5))
    1
    2
    3
    4
    5
    PL/SQL procedure successfully completed.

  • Passing objects to a method.

    Hi,
    I was reading this from a book and puzzled by this suggestion:
    for example:
    public Employee findEmployee(String employeeID);
    This method takes a String specifying a unique employee id and returns the Employee object with that id, null otherwise. Don't pass un-necessary objects to methods, and return the appropriate results.
    Why not passing objects to methods, I found it is convenient to pass objects to methods, why ?
    Thanks in advance !
    Tee

    Of course you can pass objects to methods. A String is also an object.
    The author doesn't say to not pass any objects to methods, only no unnecessary objects. He propably means that you don't need a method likepublic Employee findEmployee(String employeeID, String country)to retrieve the Employee if the employee ID by itself is unique or you don't use the country in the method, to give you an example.

  • What is the use of passing object reference to itself ?

    What is the use of passing object reference to itself ?
    regards,
    namanc

    There is an use for returning an object reference from itself, for instance:
    class C {
    public:
         C append(C c) {
             // do something interesting here, and then:
             return this;
    }You can "chain" calls, like this:
    C c = new C();
    C d = new C();
    C e = new C();
    c.append (d).append (e);Maybe the OP has "inverted" the common usage, or thought about a static method of a class C that requires a parameter of type C (effectively being a sort of "non-static method").
    class C {
        static void doAnotherThing (C c) {
            c.doSomething(); //-- effectively C.doAnotherThing(c) is an "alternative syntax" for c.doSomething()

  • Pass XML in argument tag in JNLP file

    Is there a way to pass an xml string in the <argument> tag. I tried to do it but I get xml parsing error. It seems that the xml becomes the child node when I pass that to the arguments tag. the CDATA also does not work. Has anyone done this successfully. thanks
    I am trying to pass somthing like
    <argument><Settings><URL>http://xxx.com</URL></Settings></argument>
    this is just an example I have also tried
    <argument>"<Settings><URL>http://xxx.com</URL></Settings>"</argument>
    this also errors out.
    <argument><![CDATA[<Settings><URL>http://xxx.com</URL></Settings>]]</argument>
    that does not work too.
    Please let me know if there is anything else I can try

    I've successfully used CDATA to embed HTML in an argument, on JDK 1.5 at least (not tried on others yet).
    Your CDATA closing section should be: ]]> Yours is missing the end bracket - if that's not an error in your post it's probably the cause of the XML parsing error.

  • How to pass command line arguments to JWS app

    Hi,
    I want to pass command line arguments to my JWS application. However those arguments are dynamic (eg the username of the user who launched the app) and thus I can not use the argument tag of JNLP file. So what do I need to do in this case?
    Thanks.

    Well, if it's the username on your server systems you should probably include it in the jnlp: can pass it in the url, write once and remove jnlp href attribute, etc.., etc.. (a quick tour of this forum should suffice).
    If it's the OS username you should be able to retrieve it through system properties.
    Whatever it is, passing dynamic arguments means launching javaws through a shell or a shell script (bat if running on windows), so you won't be able to launch through autogenerated desktop and menu shortcuts.
    Anyway, you have two solutions:
    Clean one: associate an extension to your app and write those infos in a file named after that extension.
    Dirty one (always seen it work, but there's no warranty): javaws -open whateverParamYouLike yourAppURL.jnlp, will pass to your main method '-open' as args[0] and '+whateverParamYouLike+' as args[1]. I gotta admin I used it, but I had the most peculiar reason (my app needed another instance on a different JRE aware of being a secondary instance at startup time).
    Bye.
    PS: I'd really love dukes ;-)

Maybe you are looking for

  • AMD Radeon HD 6630M vs Intel HD 3000 for driving a Thunderbolt Display

    Hi I've searched the net and cant find the specific answers I'm looking for regarding this issue. Which graphics option is better for the Mac mini when connected to an Apple Thunderbolt display running at 2560 x 1440 resolution: 1) AMD Radeon HD 6630

  • Are Disc Menu Templates Restricted to Certain Versions of Premiere Elements

    I ask this question after visiting the movipix site to look at what templates I might add to my PrE 9 program. This got me to wondering if templates are restricted to certain versions of PrE. After reading various posts in this forum I thought I was

  • Microsoft Surface RT with HP Officejet L7480

    Is there a driver available for Surface tablets with an ARM processor (Surface RT) so I can print to an Officejet L7480 across my home network? Thanks in advance

  • Completely lost with itunes

    alright recently i subscribed to itunes and paid the 30 something dollars to subsribe to it for life. yet when i go in under the login name it gave me and i got to the itunes store, when i clikc on a song it still says that i have to buy it. what is

  • Can not open PDFs

    I just upgraded to Mountain Lion and can not open PDFs.  For instance, I am trying to download a form from the DMV and the extension is a PDF.   Nothing opens and the page is gray.   I didn't have this problem with Snow Leopard.   I have Adobe Reader