JAVA�@Program Problems�iMemory Copy�j

���L���R�[�h�����s������
The Result of Execute
��
import java.util.HashMap;
import java.util.Map;
public class Test {
     * @param args
    public static void main(String[] args) throws Exception{
        Map map = new HashMap();
        Map in1 = new HashMap();
        in1.put("1", "test1");
        in1.put("2", "test2");
        in1.put("3", "test3");
        map.put("1", in1);
        Map in2 = new HashMap();
        in2 = ((HashMap)map.get("1"));
        map.put("2", in2);
        HashMap out1 = (HashMap)map.get("1");
        out1.put("2","testusotukijin");
        map.put("1", out1);
        System.out.println(map);
}       ��RESULT�F{2={3=test3, 2=testusotukijin, 1=test1}, 1={3=test3, 2=testusotukijin, 1=test1}}
I want result of
��
RESULT�F{2={3=test3, 2=test2, 1=test1}, 1={3=test3, 2=testusotukijin, 1=test1}}�@�@�@
Help me!

hi
in that program finally in1,in2,out1 has same
reference.
values "test1" "test2" "test3" (strings) will be
stored in string pool.whenever we do something in any
one object ,it will reflect in string pool
so only we are getting that resultThis has nothing to do with the string pool. It has to do with the fact that both "1" and "2" reference the same HashMap.
(S)He does the following:
HashMap map = new HashMap();
HashMap in1 = new HashMap();
// assignments into in 1
map.put("1", in1);
HashMap in2 = new HashMap();
in2 = map.get("1");  // this throws away the previously (in2) created HashMap
/* in2 now references the same HashMap as in1.  Changes to the
* object (HashMap) referenced by either one of these variables
* affects the object (HashMap) referenced by both variables because
* they are THE SAME OBJECT.
*/

Similar Messages

  • Java Programming Problem

    Hi all,
    I was looking for this java programming problem which had to do with a large building and there was some gallons of water involved in it too somehow and we had to figure out the height of the buiding using java. This problem is also in one of the java books and I really need to find out all details about this problem and the solution. NEED HELP!!
    Thanks
    mac

    Yes, it will. The water will drain from the bottom of
    the tank until the pressure from the water inside the
    tank equals the pressure from the pipe. In other
    words, without a pump, the water will drain out until
    there is the same amount of water in the tank as in
    the pipe The water pressure depends on the depth of the water, not the volume. So once the depth of the water inside the pipe reaches the same depth as the water inside the tank it will stop flowing. This will never be above the height of the tank.
    I found this applet which demonstrates our problem. If you run it you can drag the guy up to the top, when water in his hose reaches the level of the water in the tank it will stop flowing out.

  • Java program problem

    I'm doing this to practise for a competition on Tuesday, if someone can show me how it works, it would be great. I have been stuck on this for a long time. Thank you very much.
    When a share of common stock of some company is sold, the capital gain (or, sometimes loss) is the difference between the share's selling price and the price originally paid to buy it. This rule is easy to understand for a single share, but if we sell multiple shares of stock bought over a long period of time, then we must identify the shares actually being sold. A standard accounting principle for identifying which shares of a stock were sold in such a case is to use a FIFO protocol (i.e., the shares sold are the ones that have been held the longest). Indeed, this is the default method built into several personal finance software packages. Note, however, that it is also possible to use a LIFO protocol (i.e., the shares sold are the ones that were most recently purchased). As an example, suppose we buy 100 shares at $20 each on day 1, 20 shares at $24 on day 2, 200 shares at $36 on day 3, and then sell 150 shares on day 4 at $30 each. Then applying the FIFO protocol means that of the 150 shares sold, 100 were bought on day 1, 20 were bought on day 2, and 30 were bought on day 3. The capital gain for the LIFO case would therefore be 100(30 - 20) + 20(36 - 30) + 30(30 - 36) or $940. Applying the LIFO protocol, on the other hand, means that of the 150 shares sold, all 150 were bought on day 3. The capital gain (or loss in this case) for the LIFO case would therefore be 150(30 - 36) or -$900.
    Create a class named Stock that implements the Tradable interface:
    public interface Tradable {
    public void buy(int numberShares, int pricePerShare);
    public void sell(int numberShares, int pricePerShare);
    public int getCapitalGain();
    Write a Java program that takes as input a sequence of transactions of the form:
    buy x share(s) of stock y at $z each
    -or-
    sell x share(s) of stock y at $z each
    Assume the transactions occur on consecutive days (with respect to each stock). The values of x and z are integers, and the value of y is a string representing the name of the stock. Given this input, the output should be the total capital gain (or loss) for the entire sequence (i.e., all of the activity on all of the client's stocks) using the LIFO protocol to identify shares. Assume that no more than 10 transactions occur for any given stock.
    Modify your code so Stock is observable. Notifications should be sent whenever there is a negative capital gain (i.e., loss) that occurs as the result of the sale of some stock.
    There are two types of observers, traders and their spouses. Create a class named Trader that implements the Observer interface. Both traders and spouses should be instances of Trader. When the trader receives a notification about a capital loss, he/she should output the string "Oh no, what is my spouse going to think!". The spouse should give his/her spouse three chances for each stock (i.e., output "That's your first chance", "That's your second chance", and then finally "That's enough of that!"). After the third chance, the spouse should stop observing the trading activity. Note that traders can observe at most 2 stocks simultaneously.
    Create 5 instances of Stock and 8 instances of Trader that are inter-related and defined in the following table:
    Stock Trader Spouse(s)
    Microsoft Bill Linda
    HP Linda Bill
    IBM Joe
    Dell Susy Jack
    Bob
    Gateway Jack Susy
    Beth
    Mary
    Test your program on various combinations of trading activity.

    I'm doing this to practise for a competition on Tuesday, if someone can show me how it worksUnless I've missed something in your post, there is nothing to show. You've only posted a set of requirements. It works when someone writes code that fulfills the requirement. What are you having trouble with?

  • Multi-lingual Java program/problem

    Hi,
    The following program from the Sun books, is supposed to work with different languages. Except it doesn't!
    It has a problem finding the Properties files (?)
    It gives the following Exception:
    Exception in thread "main" java.util.MissingResourceException: Can't find bundle
    for base name MessagesBundle, locale en_GB
    here is the Sun program:
    import java.util.*;
    public class I18NSample {
    static public void main(String[] args) {
    String language;
    String country;
    if (args.length != 2) {
    language = new String("en");
    country = new String("GB");
    } else {
    language = new String(args[0]);
    country = new String(args[1]);
    Locale currentLocale;
    ResourceBundle messages;
    currentLocale = new Locale(language, country);
    messages =ResourceBundle.getBundle("MessagesBundle",currentLocale);
    System.out.println(messages.getString("greetings"));
    System.out.println(messages.getString("inquiry"));
    System.out.println(messages.getString("farewell"));
    and I have created several properties file (English, French, German, Arabic) as text files. Maybe I have problems with the properties files.
    I have followed the steps from the Java Tutorial book from Sun.
    Any help would be most welcome.
    Akz

    First save a java file "MessageBundle.java" in your current directory, for the moment. Then save java files "MessagesBundle_en_GB.java", "MessagesBundle_fr_FR", "MessagesBundle_de_DE" or "MessagesBundle_ar_EG" for example. Compile them to class files.
    Then try using your code with various locales.

  • Java program problems

    Hello all. I've posted for help on this exact same program before, but I'm just having a heck of a time with this.
    Basically, the output should look sometime like this:
    Name Item Value No.Sold Amount
    Joe 1 $2.00 2 $4.00
    2 $3.00 2 $6.00
    Total Amount: $10.00
    Then you should get an option to add another employee using sentinel controlled repetition. So far, this is the code I've got. I came up with most of it, but one of the helpful users here helped me with the rest...
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import javax.swing.JTextArea;
    import java.text.NumberFormat;
    import java.util.Locale;
    public class Pay1 {
    public static void main( String args[] )
    JTextArea outputArea = new JTextArea( 20, 40 );
    JScrollPane scroller = new JScrollPane( outputArea );
    String header = outputArea.getText();
    outputArea.setText(
    "Employee \tItem \tItem Value \tNumber Sold \tDollar Amount" );
    String output, employeeName, itemNumber, itemValue, numberItemsSold;
    int item, sold;
    double value, dollaramount;
    boolean whileLoop = true;
    while ( whileLoop )
    employeeName = JOptionPane.showInputDialog(
    "Enter an employee name" + "\nPress Enter to keep entering data"
    + "\ntype \"exit\" to quit" );
    if ( employeeName.equalsIgnoreCase( "exit" ) )
    break;
    itemNumber = JOptionPane.showInputDialog( "Item number" );
    numberItemsSold = JOptionPane.showInputDialog( "Number of items sold" );
    itemValue = JOptionPane.showInputDialog( "Item value" );
    item = Integer.parseInt( itemNumber );
    sold = Integer.parseInt( numberItemsSold );
    value = Double.parseDouble( itemValue );
    NumberFormat mf = NumberFormat.getCurrencyInstance( Locale.US );
    dollaramount = sold * value;
    output = employeeName + "\t" + item + "\t"
    + mf.format( value ) + "\t" + sold
    + "\t" + mf.format( dollaramount );
    String tmp = outputArea.getText();
    outputArea.setText( tmp + "\n" + output );
    JOptionPane.showMessageDialog( null, scroller, "Payroll Data",
    JOptionPane.PLAIN_MESSAGE );
    System.exit ( 0 );
    I spoke with the instructor in the class, and thought I understood how to do this, but I really just can't get it. If I saw how somebody else did it, then I think I would understand it alot better. So anybody could please help me with this, I would sooo greatly appreciate it. Thanks in advance.

    yep, but slight change,
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import javax.swing.JTextArea;
    import java.text.*;
    import java.util.*;
    public class Pay1 {
          public static void main( String args[] ) {
          JTextArea outputArea = new JTextArea( 20, 40 );
          JScrollPane scroller = new JScrollPane( outputArea );
          outputArea.setText("Employee \tItem \tItem Value \tNumber Sold \tDollar Amount");
          String output, employeeName, itemNumber, itemValue, numberItemsSold;
          int item, sold;
          double value, dollaramount,total=0;
          boolean whileLoop = true;
          String prev = "";
          while (whileLoop ) {
             employeeName = JOptionPane.showInputDialog("Enter an employee name" +
                                         "\nPress Enter to keep entering data" +
                                         "\ntype \"exit\" to quit" );
             if (employeeName.equalsIgnoreCase( "exit" ) ) break;
             if( prev.equalsIgnoreCase( employeeName ) )
                employeeName = "";
             else
                prev = employeeName;
             itemNumber = JOptionPane.showInputDialog( "Item number" );
             numberItemsSold = JOptionPane.showInputDialog( "Number of items sold" );
             itemValue = JOptionPane.showInputDialog( "Item value" );
             item = Integer.parseInt( itemNumber );
             sold = Integer.parseInt( numberItemsSold );
             value = Double.parseDouble( itemValue );
             NumberFormat mf = NumberFormat.getCurrencyInstance( Locale.US );
             dollaramount = sold * value;
             total+=dollaramount;
             String tmp = outputArea.getText();
             int i=tmp.indexOf("Total Amount")-4;  // get rid of total line if present
             if (i<0) i=tmp.length()-1;
             output = employeeName + "\t" + item + "\t" + mf.format( value ) + "\t" +
                sold + "\t" +  mf.format( dollaramount ) +
                "\n\t\t\tTotal Amount:\t"+mf.format (total);   // add total line
             outputArea.setText( tmp.substring(0,i) + "\n" + output );
             JOptionPane.showMessageDialog( null, scroller, "Payroll Data", JOptionPane.PLAIN_MESSAGE );
          System.exit (0 );
    }

  • O Dear! Basic Java Programming problem!

    import java.lang.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import java.util.Random;
    public class QuizApp extends Object
         public static void main(String[] argStrings) throws Exception
              Random random = new Random();
              int generateFirstFigure = random.nextInt(21);
              int generateSecondFigure = random.nextInt(31);
              int generateOperator = random.nextInt(3);
              String operator = "/";
              int correctAnswer = generateFirstFigure + generateSecondFigure;
              if (generateOperator == 0)
                   operator = "+";
                   int correctAnswer = generateFirstFigure + generateSecondFigure;
              if (generateOperator == 1)
                   operator = "-";
                   int correctAnswer = generateFirstFigure - generateSecondFigure;
              if (generateOperator == 2)
                   operator = "/";
                   int correctAnswer = generateFirstFigure / generateSecondFigure;
              //int correctAnswer = generateFirstFigure + operator + generateSecondFigure;
              int incorrectAnswerOne = correctAnswer -2;
              int incorrectAnswerTwo = correctAnswer + 1;
              int incorrectAnswerThree = correctAnswer + 3;
              String questionOne = "What is " + generateFirstFigure + operator + generateSecondFigure + "?"; 
              System.out.println(questionOne);
              System.out.println(incorrectAnswerThree);
              System.out.println(incorrectAnswerOne);
              System.out.println(correctAnswer);
              System.out.println(incorrectAnswerTwo);
    }Basically this code, creates 2 random characters and then allows you to either add, divide or subtract the two numbers... firstly this bit of the code doesnt work, secondly how can the user input a value (the answer) to the math's question?
    Thanks for help,
    Joel

    practissum wrote:
    dketcham, i printed out your hello world pumpkin. its a huge hit in the office!Sorry for propogating the off-topic remarks...but link to the hello world pumpkin?it was the friday coding challenge for last week:
    http://forum.java.sun.com/thread.jspa?threadID=5230548&messageID=9941964#9941964
    It's all about the pretty colors, and trying to squish a simple little program into a squarish-shape, so that another shape can be put within!
    As you can see, I have no real programming skills, but I like pretty colors, so it's all good.

  • Should I upgrade to Lion from 10.6.8 to improve stability of Java program i am running?

    I have a Java program problem, it's unstable and losing connection and freezing. Will an upgrade to Lion from 10.6.8 help?
    thanks

    they don't claim it but it is. I have never had a problem with the 2008 macbook, just the desktop. Narrowed it down to this after trying everything else speaking with Scottrade, Oracle and Apple.
    I tried to downgrade but got lost at the utilitoes terminal part. any easier way? Apple wont help me downgrade through my care program and I have no idea.
    Thanks

  • Paho Java, M2JE problem, compliling my program

    Hi all. First thank you for using your time to read about my problems.
    I am not a good programer, and usualy copy paste my programs together, so I am not so deep into what happends in the background but most of the time I get tings working my way,( at least in the right sky direction).
    I am trying to port my client running on a Cinterion wirless module, to include Mqtt protocol, and it seems to me Paho is the way to go. I have used the example on "https://eclipse.org/paho/clients/java/", and get it to sucsesful connect to my lokal Mosquitto Broker. My problem started when i was going to port the example to run on my module, with J2ME. It seams i am missing a supporting java .jar and class.
    The error code I got is:
    Preverifying 93 file(s) into Z:\Programering\Netbeans\TC65Client_MQTT\build\preverified directory.
    Error preverifying class org.eclipse.paho.client.mqttv3.MqttAsyncClient
    VERIFIER ERROR org/eclipse/paho/client/mqttv3/MqttAsyncClient.createNetworkModule(Ljava/lang/String;Lorg/eclipse/paho/client/mqttv3/MqttConnectOptions;)Lorg/eclipse/paho/client/mqttv3/internal/NetworkModule;:
    Cannot find class javax/net/ssl/SSLSocketFactory
    Z:\Programering\Netbeans\TC65Client_MQTT\nbproject\build-impl.xml:481: Preverification failed with error code 1.
    BUILD FAILED (total time: 48 seconds)
    (yes, i am using Netbeans )
    I beleeve that i am looking for the class "javax/net/ssl/SSLSocketFactory", but i canot find anyting on the dokumentation to Paho. ( " http://www.eclipse.org/paho/files/javadoc/index.html "). This makes me beleve that it is a class of the orginal Java Enviroment. So I need to find a seccond solution to get the program to go trought the Build prosess of the IDE.
    Does anyone have an Idea to where I need to start looking to get my problem svolved?
    Thanks in advance for any help!

    I think the problem is that your IDE cannot find javax/net/ssl/SSLSocketFactory which is in located in the main JDK, not paho. I've not got much experience with Netbeans, but have you configured your project / Netbeans to know where the JDK is?
    This might help: wiki.netbeans.org/FaqJdkHome

  • Error message when try to run copied java program

    Hi Java Guru,
    Can somebody help me with this issue ?
    I was copy my java source from java_ulangan2 to java_ulangan20, when i tried to run the java program, i get an error message.
    Below is the error message:
    05/01/2010 1:02:42 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [003]Deployment aborted
    Settings
    SDM host : wfmdev
    SDM port : 50018
    URL to deploy : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Result
    => deployment aborted : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Aborted: development component 'Java_ulangan20'/'local'/'LOKAL'/'0.2010.01.05.13.02.32'/'0':Caught exception during application deployment from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Cannot deploy application local/Java_ulangan20.. Reason: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine?; nested exception is:      com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine? (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted
    I really appreciate any kind of help.
    Thanks,
    JGN

    Hi John.
    In past i have faced same problem for the same task. Take help of the Basis team provide tham .ear file name and ask then to un-deploy the file from the server cluster.
    After this deploy your application again.
    Hope this may help you.....:)
    Deepak!!!

  • Problem while calling a Webservice from a Stand alone java program

    Hello Everyone,
    I am using a java program to call a webservice as follows. For this I have generated the client proxy definition for Stand alone proxy using NWDS.
    Now when I call the method of the webservice I am getting the correct result but along with the result I am getting one error and one warning message in the output.
    The java code to call the webservice is as follows.
    public class ZMATRDESCProxyClient {
         public static void main(String[] args) throws Exception {
              Z_MATRDESC_WSDService ws = new Z_MATRDESC_WSDServiceImpl();
              Z_MATRDESC_WSD port = (Z_MATRDESC_WSD)ws.getLogicalPort("Z_MATRDESC_WSDSoapBinding",Z_MATRDESC_WSD.class);
              String res = port.zXiTestGetMatrDesc("ABCD134");
              System.out.print(res);
    The result I am getting is :
    Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !
    Error Message is :com/sap/guid/GUIDGeneratorFactory
    <b>Material Not Found</b> -
    > This is the output of webservice method and it is right.
    Can any one please let me know why I am getting the warning and error message and how can I fix this.
    Thanks
    Abinash

    Hi Abinash,
    I have the same problem. Have you solve that problem?
    I am using a java program to call a webservice too. And I have generated the client proxy definition for Stand alone proxy using NWDS. When I call the method of the webservice I am getting the correct result but along with the result I am getting one error and one warning message in the output.
    The java code to call the webservice is as follows.
    MIDadosPessoaisSyncService service = new MIDadosPessoaisSyncServiceImpl();
    MIDadosPessoaisSync port = service.getLogicalPort("MIDadosPessoaisSyncPort");
    port._setProperty("javax.xml.rpc.security.auth.username","xpto");
    port._setProperty("javax.xml.rpc.security.auth.password","xpto");
    String out = port.MIDadosPessoaisSync("xpto", "xpto");
    System.out.println(out);
    The result I am getting is :
    Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !
    Error Message is :com/sap/guid/GUIDGeneratorFactory
    <b>The result of the WS is correct!!!</b>
    The Java project does not have any warning. But the stand alone proxy project has following warnings associated with it.
    This method has a constructor name     MIDadosPessoaisSync.java     
    The import javax.xml.rpc.holders is never used     MIDadosPessoaisSyncBindingStub.java     
    The import javax.xml.rpc.encoding is never used     MIDadosPessoaisSyncBindingStub.java     
    The constructor BaseRuntimeException(ResourceAccessor, String, Throwable) is deprecated     MIDadosPessoaisSyncBindingStub.java
    It is very similar with your problem, could you help me?
    Thanks
    Gustavo Freitas

  • Problems running a java program

    Hello,
    I have absolutely no java experience whatsoever, and I need to fix a program that suddenly stopped running properly after several years without problems. Basically, I have a perl script that calls a java program. Everytime I run this perl script from the web browser, the java program returns an internal error:
    # # HotSpot Virtual Machine Error, Internal Error # Please report this error at # http://www.blackdown.org/cgi-bin/jdk # # Error ID: 5649525455414C53504143450E4350500024 # # Problematic Thread: prio=5 tid=0x804e680 nid=0x6d16 runnable #
    However, when I run the perl script command line, it runs fine. I added the -verbose option to the java call, and I discovered that the program stops running after it opens the .jar files but before it loads them .... these files have full read permissions, so I don't think that's the problem. Any ideas?
    Thanks!

    ...fix a program that suddenly stopped running properly after several years without problems.Which means either the program changed or the environment changed. I would guess the environment. The most likely possibilities: new version of the operating system, new version of perl, new version of java. Also possible: new version installed of any of the previous without removing older versions, new software not associated with the first, new mapped drives and/or changed env vars.

  • Problem in Creating New position in Siebel CRM 7.8 using java program

    Hi
    We have Siebel CRM with Business Object and Business Component as Position.
    Position Business Component has a manadatory pick list Division.
    When we try to create a new Position by picking the Divison then we are getting the below error
    Logged in OK!
    picking the list
    in the pick() method before
    <Exception>
    <Major No.>256</Major No.><Minor No.>21944</Minor No.><Message>An error has occurred picking the current row.
    Please continue or ask your systems administrator to check your application configuration if the problem persists.(SBL-DAT-00292)</Message><DetailedMessage>Unknown<DetailedMessage>
    <Exception>
    <com.siebel.om.sisnapi.i>
    <Major No.>256</Major No.><Minor No.>21944</Minor No.><Message>An error has occurred picking the current row.
    <Error><ErrorCode>21944</ErrorCode> <ErrMsg>An error has occurred picking the current row.
    Please continue or ask your systems administrator to check your application configuration if the problem persists.(SBL-DAT-00292)</Message><DetailedMessage>Unknown<DetailedMessage>
    Please continue or ask your systems administrator to check your application configuration if the problem persists.(SBL-DAT-00292)</ErrMsg></Error>
    <com.siebel.om.sisnapi.i>
    <Error><ErrorCode>21735</ErrorCode> <ErrMsg>Siebel eScript runtime error occurred in procedure 'BusComp_SetFieldValue' of BusComp [Position]:
    <Error><ErrorCode>21944</ErrorCode> <ErrMsg>An error has occurred picking the current row.
    ConversionError 1616: Undefined and Null types cannot be converted to an object.
    Please continue or ask your systems administrator to check your application configuration if the problem persists.(SBL-DAT-00292)</ErrMsg></Error>
    (SBL-SCR-00141)</ErrMsg></Error>
    <Error><ErrorCode>21735</ErrorCode> <ErrMsg>Siebel eScript runtime error occurred in procedure 'BusComp_SetFieldValue' of BusComp [Position]:
    <Error><ErrorCode>21735</ErrorCode> <ErrMsg>Stack trace:
    BusComp [Position].BusComp_SetFieldValue(), Line: 1110</ErrMsg></Error>
    ConversionError 1616: Undefined and Null types cannot be converted to an object.
    </com.siebel.om.sisnapi.i></Exception>
    (SBL-SCR-00141)</ErrMsg></Error>
    <Error><ErrorCode>21735</ErrorCode> <ErrMsg>Stack trace:
    BusComp [Position].BusComp_SetFieldValue(), Line: 1110</ErrMsg></Error>
    </com.siebel.om.sisnapi.i></Exception>
    at com.siebel.data.SiebelBusComp.pick(SiebelBusComp.java:241)
    at siebelconn.main(siebelconn.java:44)
    Java program
    import com.siebel.data.*;
    import com.siebel.data.SiebelException;
    class siebelconn {
    public static void main (String args [])
    SiebelDataBean m_dataBean = null;
    SiebelBusObject m_busObject = null;
    SiebelBusComp m_busComp = null;
    SiebelBusComp picklistBC = null;
         try{
    m_dataBean = new SiebelDataBean(); //Create Siebel JDB instance
    m_dataBean.login("XXXX", "XXX", "XXX");
         System.out.println("Logged in OK!");
    m_busObject = m_dataBean.getBusObject("Position");
    m_busComp = m_busObject.getBusComp("Position");
    m_busComp.newRecord(false);
    picklistBC = m_busComp.getPicklistBusComp("Division");
    picklistBC.clearToQuery();
    picklistBC.setViewMode(3);
    picklistBC.setSearchSpec("Name", "idmtest");
    //picklistBC.executeQuery(true);
    picklistBC.executeQuery2(true,true);
    if(picklistBC.firstRecord())
    System.out.println("picking the list");
    picklistBC.pick();
    System.out.println("records are there");
    m_busComp.setFieldValue("Name","Access GE HQ 11");
    m_busComp.writeRecord();
    }//if
         if(m_busObject!=null)
    m_busObject.release();
    if(m_busComp!=null)
    m_busComp.release();
    if(picklistBC!=null)
    picklistBC.release();
    if(m_dataBean!=null)
    m_dataBean.logoff();
    catch(Exception e)
    System.out.println(e);e.printStackTrace();
    if(m_busObject!=null)
    m_busObject.release();
    if(m_busComp!=null)
    m_busComp.release();
    if(picklistBC!=null)
    picklistBC.release();
    try
    if(m_dataBean!=null)
    m_dataBean.logoff();
    }catch(Exception e1){System.out.println(e1);}
    Can any body please help us.
    Thanks

    From the error code, it looks like you have a scripting error in the BusComp_SetFieldValue event on the Position
    business component in your application.
    Have you tried to look at that code or to turn of scripting for the application as a total?
    Axel

  • Please help me in this tough problem in Java...im just new in Java program

    my teacher give this as a problem. so tough. we are just starting and we are now in control structures. please help me to finish this problem. And my problem is...
    Write an astrology program. The user types in his or her birthday(month,day,year),
    and the program responds with the user's zodiac sign, the traits associated with each sign
    the user's age(in years,months,day), the animal sign for the year(e.g., Year of the Pig,
    Year of the Tiger), the traits associated with each animal sign, and if the year is a leap
    year or not. The dates covered for each sign can be searched through the horoscope section
    of a newspaper or through the internet. Then enhance your program so that if the user is one
    or two days away from the adjacent sign, the program outputs the nearest adjacent sign as well
    as the traits associated with the nearest sign. The month may be entered as a number from 1 to 12
    or in words, i.e.,January to December. Limit the year of the birthday from 1900 to 2010 only.
    The program should allow the user to repeat the entire process as often as desired.
    You can use:
    import java.text.DateFormat;
    import java.util.Date;
    import java.util.Calendar;
    please...those who are genius out there in java program...help us to pass this project. Im begging! thanks!

    Frowner_Stud wrote:
    According to the second commandment: Thou shall not use the name of the Lord in vain.Is this not the definition of ironic, Mr. Morality?
    i am not cheating. And more of the same.
    we all know that an assignment is an assignment. a homework. homework means you can raise other help from somebody so that you will know the answer.You're not asking for "help" bucko, because you've been given decent help but have chosen to ignore it. No, you're asking for someone to do the work for you, and you may call it what you want, but in anyone else's book, that's cheating.
    dont be fool enough to reply if you dont know the reason why i am typing here Don't be fool enough to think that you can control who can or can't respond.
    because if you are in my part and if i know the answer there is no doubt that i will help you as soon as possible! Just because you have low morals doesn't mean that the rest of us do.
    Thanks for time of reading and God bless you including you family!and to you and yours. Have a blessed day.

  • Execute an external java program with Runtime, problem with classpath

    Hi,
    I m calling an external java program by the command:
    Runtime.getRuntime().exec("java -classpath \"library/*\" org.mypackage.TestMainProgram param1 c:/input/files c:/output/files");All my classes are stored in the relative directory "library", and it contains ONLY .jar files. However, I keep getting errors like:
    "java.lang.NoClassDefFoundError: library/antlr/jarCaused by: java.lang.ClassNotFoundException: library.antlr.jar     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)     at java.security.AccessController.doPrivileged(Native Method)     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)Could not find the main class: library/antlr.jar. Program will exit.Exception in thread "main" where "antlr.jar" is a jar file in "library". It is there but still the program keeps complaining it cannot be found. The problem applies to any jars in "library", ie.., if i have "mylib.jar" then it will complain "NoClassDefFoundError: library/mylib/jar".
    Could anyone give some pointers please?
    Many thanks!
    Edited by: 836590 on 14-Feb-2011 09:03

    836590 wrote:
    Hi,
    I m calling an external java program by the command:
    Runtime.getRuntime().exec("java -classpath \"library/*\" org.mypackage.TestMainProgram param1 c:/input/files c:/output/files");All my classes are stored in the relative directory "library", and it contains ONLY .jar files. However, I keep getting errors like:
    "java.lang.NoClassDefFoundError: library/antlr/jarCaused by: java.lang.ClassNotFoundException: library.antlr.jar     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)     at java.security.AccessController.doPrivileged(Native Method)     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)Could not find the main class: library/antlr.jar. Program will exit.Exception in thread "main" where "antlr.jar" is a jar file in "library". It is there but still the program keeps complaining it cannot be found. The problem applies to any jars in "library", ie.., if i have "mylib.jar" then it will complain "NoClassDefFoundError: library/mylib/jar".
    Could anyone give some pointers please?
    Many thanks!
    Edited by: 836590 on 14-Feb-2011 09:03First, if you run from the command line
    java -classpath "library/*" org.mypackage.TestMainProgram param1 c:/input/files c:/output/filesfrom the parent directory of library, does it work?
    Despite what I said to Kayaman about Runtime.exec not expanding the asterisk, it looks like that's what's happening, so that you're getting
    java -claspath library/aaaa_something_before_antlr.jar library/antlr.jar library/bbb.jar library/ccc.jar  org.mypackage.TestMainProgram param1 c:/input/files c:/output/filesThat is, it *is* expanding the asterisk to a list of files in the directory, and the first one is being taken as the classpath, and the second one--library/antlr.jar is being taken as the class to execute. I'm certain this doesn't happen on Linux, so it must be a Windows thing.
    Two suggestions:
    1) Try single quotes instead of double.
    2) Try the exec that takes an array
    Runtime.getRuntime().exec(new String[] {"java", "-classpath", "'library/*'", "org.mypackage.TestMainProgram", "param1", "c:/input/files", "c:/output/files");Edited by: jverd on Feb 14, 2011 9:41 AM

  • Problem with running java program

    Hey again!
    I missed out some information in last posting.. here is the full description
    I have just installed 1.5.0_06 and have set paths and what otherwise is necessary to run the java programs. I was testing the install and run a standard HelloWorld.java program
    I got the following error:
    Exception in thread main java.lang.NoClassDefFoundError: HelloWorld
    what is wrong...
    Here is the entire HelloWorld.java
    public class HelloWorld
    public HelloWorld()
    System.out.println("Hello World");
    public static void main(String[] args)
    HelloWorld hw = new HelloWorld();
    I have checked that the path is correct too..
    Hopefully someone can help me!
    Anders

    Your Path is set, probably the problem is classpath.
    Change the cmd/command prompt to the directory that contains your HelloWorld.class file, verifying that it exists. If it does, issue this command from that directory:
    java -cp . HelloWorld
    Important: include the period and surrounding spaces
    If that works, you can learn about setting and using the classpath here:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#general
    By the way, just add a reply to your original post with the additional information, rather than creating another post. That eliminates duplication of replies.

Maybe you are looking for