Trying to pass arguments into a method call and failing

Hi everyone, I'm fairly new to programming, and newer to Java. I'm currently working on a project that pulls fields from a database based on a name, and I'm having some trouble getting the connection string set up.
Statically defined, the database connects and the program logic that follows works just fine. The problem is that to future-proof this application, I need to pass the database URL, port, db instance, username, and password into the program as arguments from the batch file that will then be scheduled to run the program on a job-by-job basis.
Product Version: NetBeans IDE 6.1 (Build 200805300101)
Java: 1.6.0_06; Java HotSpot(TM) Client VM 10.0-b22
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\xxxxxxxxxxx.SPROPANE\.netbeans\6.1
Here's my current working source (with the network addresses obfuscated):
package processsqrjob;
import java.io.*;
import java.sql.*;
import java.util.Date;
public class Main {
     * @param args jobname, jobparameters, HYPusername, HYPpassword, HYPservername, HYPport, oracleDBURL, oracleport (default 1512), SID (dbb?), oracleusername, oraclepass
     * @throws exeption
    // jobname [0], jobparams[1], hypusername [2], hyppassword [3], hypservername [4], hypport[5], oracledburl[6], oracleport[7], sid[8], oracleusername[9], oraclepass[10]
    public static void main(String[] args) throws SQLException
        DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@oracleserver.local.intranet.com:1521:dbname", "username", "pass");
        Statement stmt = con.createStatement();
        Date date = new Date(); //get the system date for output to both the error log and the DB's lastrun field
        System.out.println(date); //print the date out to the console
        System.out.println(args[0]); //print the job name to the console
        String sourcefolder=""; //we're going to load the job source folder into this variable based on the job's name
        String destfolder="";//same with this variable, except it's going to get the destination folder
        try {
            ResultSet rs = stmt.executeQuery("SELECT * FROM myschema.jobs WHERE NAME =\'"+args[0]+"\'");
            while ( rs.next() ) {
                sourcefolder = rs.getString("sourcefolder");
                destfolder = rs.getString("destfolder");
            stmt.executeQuery("UPDATE myschema.jobs SET lastrun ='"+date+"' WHERE name ='"+args[0]+"'");//put this after hyp code
//            System.out.println(sourcefolder);
//            System.out.println(destfolder);
//            System.out.println(description);
            stmt.close(); //close up the socket to prevent leaks
        }catch(SQLException ex){
            System.err.println("SQLException: " + ex.getMessage());
            logError(args[0], ex.getMessage());
}That works, and it connects to the database and everything. But when I pass the variables in from the project properties run settings, I get the following exception:
Exception in thread "main" java.sql.SQLException: invalid arguments in call
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:235)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:440)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:207)
        at processsqrjob.Main.main(Main.java:42)
Java Result: 1That is with Connection con = DriverManager.getConnection("jdbc:oracle:thin:@oracleserver.local.intranet.com:1521:dbname", "username", "pass"); changed to Connection con = DriverManager.getConnection("jdbc:oracle:thin:@"+args[6]+":"+args[7]+":"+args[8]+"\", \""+args[9]+"\", \""+args[10]+"\"");{code}, with args 6 7 8 and 9 set to url, port, dbinstance, username, and password respectively.
Perhaps it's the way I'm escaping the quotation marks, but I put that same line inside a System.out.println() and it output it exactly as I had typed it in statically before, so I don't know what it could be.
I would really appreciate any advice. Thanks in advance for your time.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

I think you're mixing up SQL and Java. The Java method expects the user name and password as separate parameters, not encoded in one String. So you shouldn't be concatenating args[9] and args[10] at all, they should remain as separate parameters.
The call should be:DriverManager.getConnection("jdbc:oracle:thin:@" + args[6] + ":"+ args[7] + ":" + args[8], args[9], args[10]);
                                                 parameter 1                                  2         3

Similar Messages

  • Combine standard task (ABAP method call) and additional UWL Action Handlers

    Hi, i have defined a task with an asynchronous ABAP method call and a terminating event which i want to use "as is" in the universal worklist, that means that the standard action has to be the ABAP method call defined for the task.
    In addition to that i want to add an extra button to the workitem view in the worklist which opens a web dynpro application. The web dynpro needs a parameter from the workitem container. Opening the web dynpro is not required for completing the task, so i do not consider using secondary methods.
    I created an UWLConfiguration for the task type without defining the defaultAction attribute, since defaultAction should not be overwritten. I wanted to use SAPWebDynproABAPLauncher to generate the button since i can easily include values from the workitem container in the call.
    When executing a workitem from the worklist the ABAP method call is not performed, instead a window opens which just displays the workitem. The button to web dynpro is generated and works fine.
    Does anyone have a clue how i can use UWL to define an additional button with SAPWebDynproABAPLauncher without overwriting the standard task definition?
    My definition:
    <ItemTypes>
        <ItemType
    name="uwl.task.webflow.TS95100103"
    connector="WebFlowConnector"
    defaultView="DefaultView">
          <ItemTypeCriteria
    systemId="ED1CLNT100"
    externalType="TS95100103"
    connector="WebFlowConnector"/>
          <CustomAttributes>
            <CustomAttributeSource
    id="WEBFLOW_CONTAINER"
    objectIdHolder="externalObjectId"
    objectType="WebFlowContainer"
    cacheValidity="final">
              <Attribute
    name="HROBJECT_OBJEKTID"
    type="string"
    displayName="HROBJECT_OBJEKTID"/>
            </CustomAttributeSource>
          </CustomAttributes>
          <Actions>
            <Action
    name="launchWebDynPro"
    groupAction=""
    handler="SAPWebDynproABAPLauncher"
    returnToDetailViewAllowed="yes"
    launchInNewWindow="yes"
    launchNewWindowFeatures="resizable=yes,scrollbars=yes,
    status=yes,toolbar=no,menubar=no,
    location=no,directories=no">
              <Properties>
                <Property
    name="WebDynproApplication" value="hr01_app"/>
                <Property
    name="newWindowFeatures"
    value="resizable=yes,scrollbars=yes,status=yes,
    toolbar=no,menubar=no,location=no,directories=no"/>
                <Property
    name="DynamicParameter"
    value="candidacy_id=${item.HROBJECT_OBJEKTID}
    &amp;from_workflow=X"/>
                <Property
    name="openInNewWindow" value="yes"/>
                <Property
    name="System" value="SYSTEM_ALIAS_ERP"/>
                <Property
    name="WebDynproNamespace" value="hr01"/>
              </Properties>
              <Descriptions default="Show"/>
            </Action>
          </Actions>
        </ItemType>
      </ItemTypes>
    Thank you very much, best regards, Martin
    Edited by: Martin Sommer on Dec 1, 2008 5:51 PM

    found a solution with transaction launcher and custom transaction

  • Passing arguments to a method

    I need to pass an ip address into a method. So I know its type InetAddress. If the IPAddress is 10.100.50.33. how would I pass it in to the method. eg:
    SysNameScanCommand(  )Would it be like this?
    SysNameScanCommand(InetAddress 10.100.50.33 )

    It depends what kind of argument your function is expecting. If it wants a String, you could call
    SysNameScanCommand("10.100.50.33");If it wants an InternetAddress object, then the call would be something like:
    SysNameScanCommand(new InternetAddress("10.100.50.33"));

  • Passing state into a Task called from a continuation

    I have implemented a solution from Crafting a Task.TimeoutAfter Method and I curious about the best practice regarding passing data upwards from a Task to its continuation.
    I would like to know if the parent task released the semaphore, I could simply release it only in the continuation, is that safe enough?
    Task task = Task.Factory.StartNew(
    () =>
    try
    this.MyMethod(foo, bar);
    catch
    // Signal termination.
    taskCancellationTokenSource.Cancel();
    // Propagate up.
    throw;
    finally
    // Release handle.
    semaphore.Release();
    TaskCreationOptions.AttachedToParent)
    .TimeoutAfter(5000)
    .ContinueWith(
    antecedent =>
    // How can I pass state/indicator into this task to know if I need to do ths?
    semaphore.Release();
    if (antecedent.IsCanceled || antecedent.IsFaulted)
    throw new System.TimeoutException("A task has hung.");
    Thanks!

    Hi Ritmo2k,
    The Semaphore.Release method will release one semaphore to the pool. If the pool is already full, it'll throw SemaphoreFullException, that means you cannot call Release method until a thread has called WaitOne method. And this method will return an integer
    which indicates the count on the semaphore before Release method is called.
    If I understand you correctly,you want to know the count on the semaphorebefore you call the second Release method. I think you could create a global integer variable to store the return value from the first call of the Release method.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Passing vector into class/methods

    I am new to Vectors check this simple code out. I am trying to pass a vector onto another class then add an integer element to it. I see that its looking for an identifier but i dont unerstand how the code is for an identifier for a vector.
    ERRORS: .\Remove.java:4: <identifier> expected
         public static void AddIntegers(varray);
    ^
    .\Remove.java:4: ')' expected
         public static void AddIntegers(varray);
    ^
    .\Remove.java:4: cannot resolve symbol
    symbol : class varray
    location: class Remove
         public static void AddIntegers(varray);
    ^
    C:\Computer Work\Lab4\RemoveTest.java:11: cannot resolve symbol
    symbol : method varray ()
    location: class RemoveTest
              rm.AddIntegers(varray());
    ^
    .\Remove.java:4: missing method body, or declare abstract
         public static void AddIntegers(varray);
    ^
    .\Remove.java:6: cannot resolve symbol
    symbol : variable varray
    location: class Remove
              varray.AddElement(new Integer(13));
    ^
    6 errors
    Tool completed with exit code 1
    import java.io.*;
    import java.util.*;
    public class RemoveTest
         public static void main(String[] args)
              Vector varray = new Vector();
              Remove rm = new Remove();
              rm.AddIntegers(varray);
              System.out.println(varray);
    public class Remove
         public static void AddIntegers(varray);
              varray.AddElement(new Integer(13));

    I think the question whether you should use Vector over arrays, but rather should you use Lists over arrays. Vectors are kind of deprecated. You should be using the Collections Framework as a whole, and that means that ordered items are in java.uti.Lists, where are a kind of java.util.Collection, and a Vector is just a particular kind of List, and not necessarily even the best kind -- an ArrayList or LinkedList is often better.
    The advantage of arrays over Lists is that they can hold primitive types trivially. You can only hold objects in Lists, so you can put primitive class wrapper objects in Lists, but that has its disadvantages. Apparently in JDK 1.5 there's some syntactic sugar to make this easier, but there are still other disadvantages.
    The advantages of Lists over arrays are like what you mentioned -- things like resizings are automatic, there are lots of convenience methods, etc. The Collections Framework provides an abstraction of, well, collections, which is a good thing over futzing with details like with arrays, frequently.

  • Inputting multiple arguments into a method

    Hi,
    I have somewhat of a problem. I'm trying to create a method, stringQuery, and I do not know how many arguments the method will take.
    Allow me to explain my goal, so you can have some idea of what I'm talking about.
    I want to create a method that will basically generate a SQL query (no, this is NOT a JDBC question) from text. This method should be able to take a large number of String arguments, because the user might want to select one thing from the database, or he or she might want to select five things, or he or she might want to select twenty things.
    Because of this, there is not a set number of arguments for my stringQuery method.
    Furthermore, the method should also be able to take a large number of float arguments, in case the user wants to specify where he or she is selecting data from.
    It's just a mess, I'm not sure where to start, and I'm pretty damn sure there must be a better way. I can specify that I want an infinite number of Strings by saying something like this:
    public static String stringQuery(String... select)But I cannot do the same for floats, or for another String array. Or can I? If I try to do something like:
    public static String stringQuery(String... select, float... foo)I get a syntax error, that says "select must be the last parameter". If I change the order, it will say "foo must be the last parameter", obviously. Therefore, I can't do that.
    I realize this is a lot of information. However, if someone could please point me in the right direction here (either how to do what I am trying to do, or a better method for what I am trying to do), I would be very appreciative.
    Also, please let me know if this didn't make much sense, and what part of it didn't make sense.
    Thanks,
    Dan

    I'm not too sure what you mean by this. Do you know
    of any links or resources that can explain this
    further?Search for "Object-Oriented Programming".public class SQLBuilder {
      private // some list of selection criteria
      public SQLBuilder() {
        // initialize the list to empty
      public void addCriterion(String name, String value) {
        // add this criterion to the list
      public void addCriterion(String name, int value) {
        // add this criterion to the list
      // many more overloaded addCriterion methods could go here
      public String toString() {
        // compute the SQL string based on the list
    }And to use that:SQLBuilder builder = new SQLBuilder();
    builder.addCriterion("name", "Arthur Eddington");
    builder.addCriterion("answer", 137);
    String query = builder.toString();

  • Passing arguments to main method from a shell script

    The main method of my class accept more than 10 arguments so my shell script execute this class like this :
    java -cp xxxx mypackage.MyClass $*
    The problem is that some of those arguments allows spaces. When i execute this script like this :
    myscript.sh firstparam secondparam ...... tenthparm "eleventh param"
    or
    myscript.sh firstparam secondparam ...... tenthparm 'eleventh param'
    the java class consider that my eleventh param is 'eleven' and not 'eleventh param'
    The same class works well with an equivalent dos script.

    I had this problem once also, and I found there are several ways to fix it. One way is to replace all of the spaces in the arguments with _ characters, or you can concantate all of the arguments into one String at runtime (with spaces in between) and use code to separate the arguments out. With the quotation marks, this code would be simple. If the spaces in one argument are used to divide different parts of the argument, just make them spearate arguments.

  • Passing T into a method

    I did these methods twice, and I'd like to change the signature to something like:
    private void removeAllArticles(<T>)
    Is that possible, and, what's the terminology?
    public class DatabaseOps {
        private EntityManagerFactory factory = Persistence.createEntityManagerFactory("AssignmentPU");
        private static Logger logger = Logger.getLogger(DatabaseOps.class.getName());
        private void removeAllArticles() {
            logger.log(Level.INFO, "emptying table");
            EntityManager em = factory.createEntityManager();
            Query query = em.createNativeQuery("select * from article", Article.class);
            @SuppressWarnings("unchecked")
            List<Article> articles = query.getResultList();
            em.getTransaction().begin();
            for (Article article : articles) {
                logger.log(Level.INFO, "removing\n" + article);
                em.remove(article);
            em.getTransaction().commit();
            em.close();
        private void removeAllFeeds() {
            logger.log(Level.INFO, "emptying table");
            EntityManager em = factory.createEntityManager();
            Query query = em.createNativeQuery("select * from feed", Feed.class);
            @SuppressWarnings("unchecked")
            List<Feed> feeds = query.getResultList();
            em.getTransaction().begin();
            for (Feed feed : feeds) {
                logger.log(Level.INFO, "removing\n" + feed);
                em.remove(feed);
            em.getTransaction().commit();
            em.close();
         //other methods ommitted
    }thanks,
    Thufir

    I'm not familiar with the classes you're using, so I can't test it.
    Do you mean something like this?
    public class DatabaseOps {
        public static final class MyTableNames {
         private static final HashMap<Class<? extends SomeInterface>, String> classMap;
         static {
             classMap = new HashMap<Class<? extends SomeInterface>, String>();
             classMap.put(Feed.class, "feed");
             classMap.put(Article.class, "article");
         public static <T extends SomeInterface> String getTableName(Class<T> cls) {
             return classMap.get(cls);
        public static interface SomeInterface {
        private EntityManagerFactory factory = Persistence
             .createEntityManagerFactory("AssignmentPU");
        private static Logger logger = Logger
             .getLogger(DatabaseOps.class.getName());
        private <T extends SomeInterface> void removeAll(Class<T> cls) {
         String tableName = MyTableNames.getTableName(cls);
         if (tableName == null) {
             throw new IllegalArgumentException(cls.getName()
                  + " is not a valid class for this function");
         } else {
             logger.log(Level.INFO, "emptying table");
             EntityManager em = factory.createEntityManager();
             Query query = em.createNativeQuery("select * from " + tableName,
                  cls); //
             @SuppressWarnings("unchecked")
             List<T> feeds = query.getResultList();
             em.getTransaction().begin();
             for (T feed : feeds) {
              logger.log(Level.INFO, "removing\n" + feed);
              em.remove(feed);
             em.getTransaction().commit();
             em.close();
        // other methods ommitted
    }Piet

  • Trying to make or receive a phone call and there is constant background buzzing noise?

    Trying to make or receive a call and there is constant buzzing sound in background.
    I reset the phone.
    I updated network setting on Verizon.
    I can play music with no trouble.
    Speaker mode works on phone.

    Did you use the latest backup after setting it up "as new device"? If yes, try again, this time without using the backup, maybe it contains damaged data causing your problem.
    If this does not bring any change, you should get it serviced.

  • Pass parameters into a method from other methods.

    I m testing  2 related applications with coded ui test and wanna pass a parameter from one method into another.
    how can i do that?
    Thank you in advance.

    Hi mah ta,
    Could you please tell us what about this problem now?
    If you have been solved the issue, would you mind sharing us the solution here? So it would be helpful for other members who get the same issue.
    If not, please let us know the latest information about it.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • BCS passing dynamic inputs to methods & calling using in O365

    Hi all ,
    I have a requirement to pass dynamic values to BDC methods & retrieve data, for this I have created a BDC model file(which has SQL server as external source) with GenericInvoker methods & upload same to Admin central. how do we access these generic
    methods in Office 365 using JavaScript client object model.
    what are the options we have to invoke methods manually by passing dynamic values.
    I tried below code. but I getting below error.
    The web with URL 'http://XXXXXXXX:26110/sites/RA5' is not an app web. The GetAppBdcCatalog method must be called on an app web.
    Any help on this would be appreciated
    function retrieveListItems() {
    // This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
    $(document).ready(function () {
    context = SP.ClientContext.get_current();
    web = context.get_web();
    context.load(web);
    entity = web.getAppBdcCatalog().getEntity("PersonalDetails", "New external content type");
    context.load(entity);
    lob = entity.getLobSystem();
    context.load(lob);
    lobSystemInstances = lob.getLobSystemInstances();
    context.load(lobSystemInstances);
    context.executeQueryAsync(GetLobSubscribesystemInstance, onQueryFailed);
    function Entity() {
    alert("Reached the Entity method");
    //these are the helper methods and variables
    var context;
    var web;
    var user;
    var entity;
    var lob;
    var lobSystemInstance;
    var lobSystemInstances;
    // Initialize the LobSystemInstance.
    function GetLobSubscribesystemInstance() {
    var $$enum_1_0 = lobSystemInstances.getEnumerator();
    while ($$enum_1_0.moveNext()) {
    var instance = $$enum_1_0.get_current();
    lobSystemInstance = instance;
    context.load(lobSystemInstance);
    break;
    context.executeQueryAsync(Entity, onQueryFailed);
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    ragava_28

    Hi all ,
    I have a requirement to pass dynamic values to BDC methods & retrieve data, for this I have created a BDC model file(which has SQL server as external source) with GenericInvoker methods & upload same to Admin central. how do we access these generic
    methods in Office 365 using JavaScript client object model.
    what are the options we have to invoke methods manually by passing dynamic values.
    I tried below code. but I getting below error.
    The web with URL 'http://XXXXXXXX:26110/sites/RA5' is not an app web. The GetAppBdcCatalog method must be called on an app web.
    Any help on this would be appreciated
    function retrieveListItems() {
    // This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
    $(document).ready(function () {
    context = SP.ClientContext.get_current();
    web = context.get_web();
    context.load(web);
    entity = web.getAppBdcCatalog().getEntity("PersonalDetails", "New external content type");
    context.load(entity);
    lob = entity.getLobSystem();
    context.load(lob);
    lobSystemInstances = lob.getLobSystemInstances();
    context.load(lobSystemInstances);
    context.executeQueryAsync(GetLobSubscribesystemInstance, onQueryFailed);
    function Entity() {
    alert("Reached the Entity method");
    //these are the helper methods and variables
    var context;
    var web;
    var user;
    var entity;
    var lob;
    var lobSystemInstance;
    var lobSystemInstances;
    // Initialize the LobSystemInstance.
    function GetLobSubscribesystemInstance() {
    var $$enum_1_0 = lobSystemInstances.getEnumerator();
    while ($$enum_1_0.moveNext()) {
    var instance = $$enum_1_0.get_current();
    lobSystemInstance = instance;
    context.load(lobSystemInstance);
    break;
    context.executeQueryAsync(Entity, onQueryFailed);
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    ragava_28

  • Problem with byte array arguments in webservice method call

    I am using JWSDP 1.5 to generate client stubs for a webservice hosted on a Windows 2000 platform.
    One of the methods of the webservice contains a byte array argument. When our application calls this method passing the contents of a TIFF file as the byte array, the method is failing. I have discovered that tthe reason for the failure is that the byte array in the SOAP message has been truncated and is missing its terminating tag.
    Is this a known problem in JWSDP 1.5? Is there a fix for it? Does JWSDP 1.6 resolve this problem?
    Any assistance will be much appreciated.
    Regards,
    Leo

    I'd like to add the the webservice being invoked by the generated client stubs is rpc/encoded.

  • Passing arguments to java methods

    i Haver been reading the java web page on this, yet am still miffed about what happening. heres the code
       class A {
            public int x;
            A(int x) {
                this.x = x;
            public String toString() {
                return Integer.toString(x);
        public class CallDemo2 {
            static void f(A arg1) {
                arg1 = null;
            public static void main(String args[]) {
                A arg1 = new A(5);
                f(arg1);
                System.out.println("arg1 = " + arg1);
        }The above code prints out 5, i think i understand that because of the local method can just be seen to be intitalling the value. The calling method in the main also something like the value gets passed back not the memory location so therefore doesnt effect the value 10.
    Now the below code is what confuses me
    class A {
            public int x;
            public A(int x) {
                this.x = x;
            public String toString() {
                return Integer.toString(x);
        public class CallDemo3 {
            static void f(A arg1) {
                arg1.x = 10;
            public static void main(String args[]) {
                A arg1 = new A(5);
                f(arg1);// why does 10 get printed out and not 5 ?
                System.out.println("arg1 = " + arg1);
        }

    u have manged to explain how to get to each result, but am not sure
    that you understad it correctly, it is different to the way i am
    understanding it, thats why im posting here... i hope byt the end of
    today i will understand whats going on that bit of code i posted. I
    hope someone like pervel can post and explain. Pervel is a reliable
    person...sorry cant be of any more help however thsi is the page i am
    readingWell, THANKS A LOT. I wont bother to help you again, then. I assure you that my explanation is totally right, but if you dont trust me, well, then I wont help you again.

  • How to pass arguments into a Captivate project

    Hello,
       We use dotNetNuke (DNN) as our Content Management System. We are using tokens in DNN to personalize the screens. We have access to the uses first name and email. I would like to pass this information into a Captivate project. I have seen references in my research to using Javascript to invoke the Captivate project, but I have not found any samples of the source code, nor examples of how to use the passed values in the Captivate presentation.  Can someone validate that this functionality exists for Captivate 8 and perhaps point me to a few examples?
    Thanks,
    Peter

    Sorry. I think I was a bit too vague in my answer.
    And I don't know about how you are getting your token value, but that part is up to you.
    Just make sure to put it in place of where I wrote "whateveryourtokenvalueiscalled".
    1.
    create a variable in cp to hold your value. (e.g. holdName)
    2.
    Add this inside the <head></head> tags of your page (after you export it):
    <script>
         function = getMyValues () {
              if(window.cpAPIInterface)
                   //assign your token value to the cp variable you created in the project
                   window.cpAPIInterface.setVariableValue("holdName",whateveryourtokenvalueiscalled);
    </script>
    3.
    Back in your cp project, call to the function at some point.
    For example, on page 2, add to the page's action
    On Enter:
         Execute Javascript
    Then in the script window, type this to start up the function:
    getMyValues();
    I hope that makes sense.  I'm not really great at explaining scripting unfortunately.

  • Passing arguments into main program using eclipse

    If I want to pass a file into my Main program using "file redirection" I would do the following when running my program from the command prompt:
    C:\ MainProgram < inputfile.txt
    How do I do this using Eclipse SDK(WinXP)? I have investigated the options for passing in "Program Arguments" and still can't figure it out. Can anyone please help? What do I type in the Program Arguments text box?
    Thank you,
    Mark

    Well, input redirection is a shell thing, so Eclipse may not support it like that. (Maybe it does, somehow, but if it does it's just aping shell behavior for convenience.)
    What I'd suggest, is to create an option to your program to read a specified file. Maybe something like
    MainProgram -input intputfile.txt
    Then give that as an argument in Eclipse.
    If this is for testing purposes, another option is to create a test class, and hardcode the filename in there.

Maybe you are looking for

  • Button link doesn't open after publishing

    Hello, I am trying to put a link into my Captivate project so that users can access our homepage. From what I can tell, the only way to do this is to create a button that opens to a URL. Great, except when the project is published, the link doesn't w

  • How to add file directory to the af:inputFile

    Hi, Working in jdev 11.1.1.3.0, ADF BC with rich faces. I have af:inputFile in my page, when ever user clicks on browse button it could directly navigate to the specified folder location. can any one suggest me how can we do this.

  • Soap Service Registration Problem

    When i try to register the sample helloWorld soap application i get the following problem... install_service: Copying SOAP service classes to d:\iplanet\ias6\ias/APPS/soap-services/samples/s oap/helloworld. Registering SOAP service with Apache SOAP c

  • Help adding video to composition

    I have the following in a trigger on the timeline so that a video will start at a spcific point in time. For some reason I just can't get the video to play. var vid = sym.$("video"); vid.html('<video width="480" height="270" src="video/convert.mp4" t

  • Customised layout in iphoto

    Hello everyone, I am currently working on a rather large photo book in photo essay theme. For some pages I have chosen the custom layout, with one picture in the middle and no others around. The one in the middle is grey and the others are blue. I th