NewInstance from variable class(Please Help)

I want to generate an object from xml
example :
<com.toto.titi.variable>
     <name>tata</name>
     <age>20</age>
</com.toto.titi.variable>
my java code :
str = "com.toto.titi.variable" ;
int idx0 = str.lastIndexOf(".");
String testObj = str.substring(idx0+1);
Class cls = Class.forName(str);
o_ = (testObj)cls.newInstance(); //testObj it's variable, i dont now origin class or Interface
this code is not work
Please help
Thanks

do a search on here for "beanbox"....that shows how to do object persistence and creation using xml.

Similar Messages

  • I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks

    I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks

    - If you used PhotoStream then try getting some of them from your PhotoStream. See that topic of:
    iOS: Importing personal photos and videos from iOS devices to your computer
    - Maybe from the restored iPod via
    How to perform iPad recovery for photos, videos
    Wondershare Dr.Fone for iOS: iPhone Data Recovery - Wondershare Official     
    http://www.amacsoft.com/ipod-data-recovery.html

  • Timemachine only opens a finder window even when I'm in iPhoto or mail. I am trying to retrieve a deleted book project from iPhoto. Please help

    Timemachine only opens a finder window even when I'm in iPhoto or mail. I am trying to retrieve a deleted book project from iPhoto. Please help

    jon199 wrote:
    Timemachine only opens a finder window even when I'm in iPhoto or mail. I am trying to retrieve a deleted book project from iPhoto. Please help
    If you have iPhoto '09, you cannot browse or restore seleted items from your backups.  See the pink box in #15 of Time Machine - Frequently Asked Questions.
    Mail should work, however, per the blue box there. 

  • Ksenija     Pretraživanje     Slike     Karte     Gmail     Disk     Kalendar     Prevoditelj     Blogger     Više      ksenija josipovic      Dijeli     ksenija josipovic     ksenija josipovic  Prevoditelj Greetings from the Croatian, please help me

    Greetings from the Croatian, please help me, I applied, create an account, but they keep telling me to confirm the account with your support, and we simply do not succeed, do not let me go to the store, or iTunes, so I can not download application, please tell me where I'm wrong, thanks a lot
    Novo! Držite pritisnutu tipku Shift, kliknite i povucite riječi prema gore kako biste ih preuredili. Ukloni
    Google Prevoditelj za tvrtke:Translator ToolkitPrevoditelj web-lokacijaGlobalna tražilica tržišta
    Isključi neposredan prijevodO usluzi Google PrevoditeljMobilni uređajiPrivatnostPomo

  • Iweb doesn't see my old domains under 10.9 after the upgrade from 10.7 Please help

    Hi everybody,
    iweb doesn't see my old domains under 10.9 after the upgrade from 10.7 Please help
    It gives me an option to choose a domain but when I go to "sites" it doesn't recognize none of them.
    Thanks :-)

    In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion, Mountain Lion or Mavericks or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks

    I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks

    If you had find my iphone enabled follow the steps in the article below:
    http://support.apple.com/kb/ph2701

  • HT1349 "Sync session failed to finish"---keeps me from syncing. Please Help!

    "Sync session failed to finish"---keeps me from syncing. Please Help!

    Quit iTunes, reboot your PC, and then try again.

  • I purchased a macbook pro 13' 3 days back. As per apple, customers purchasing their macbook after 21 july2011 will get a free upgrade to OS X LION. I've submitted the required steps online and i haven't recieved any sort of reply from apple. Please help.

    I purchased a macbook pro 13' 3 days back. As per apple, customers purchasing their macbook after 21 july2011 will get a free upgrade to OS X LION. I've submitted the required steps online and i haven't recieved any sort of reply from apple. Please help.

    When I clicked the following link:
    http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?partNumber=MD202Z/A
    and filled out the info, i got a code from apple on the web which i used to download Lion free from the appstore.

  • HT203167 Hi. 2 days ago I bought a cd ATB. And yesterday I deleted everything from iTunes. Please help in recovering all purchased cd

    Hi. 2 days ago I bought a cd ATB. And yesterday I deleted everything from iTunes. Please help in recovering all purchased cd

    Did you just delete them from iTunes, or did you also tell it to delete the music files from your Mac ? If just from iTunes then they might still be stored under /Users/username/Music - if they are then you can add them back via File > Add To Library
    If not, then whether you can redownload music depends upon what country that you are in. If you can redownload music (and if you haven't changed countries since buying it and it's still in your country's store) then it should show under the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage :
    If you can't redownload music then do you have a copy of it on your backup of your downloads/library that you can copy it back from ?

  • My apple store is deleted completely from my mac, please help

    i cannot update my mac book pro because my app store is deleted from my mac, please help.

    Change App Store back to Malaysia
    1. Tap "Settings"
    2. Tap "iTunes & App Stores"
    3. Tap on your Apple ID
    4.Tap "View Apple ID"
    5. Enter your user name and password.
    6. Tap "Country/Region."
    7. Tap "Change Country/Region"
    8. Select the country/region where you are located; re-select country/region even if it is correct
    9. Tap "Done".
    Note: If the change doesn't take effect, sign out of account and sign in again.

  • How can I call a ABAP proxy class from BADI? PLease help

    hi Experts,
        I have a scenario where I have to call a ABAP proxy class from a BADI. How can I do this? Does anybody has sample code for the same?
    Please help.
    Thanks
    Gopal

    Hi,
       You can call a method of a class from BADI. Here are the steps.
       1) In the BADI implementation create a object for the proxy class.
       2) Call the Execute_Synchronous method.
        You can define a BADI by using SE18 and you can implement it by using SE19.
    Sample code...
    ================================================
      METHOD ZIF_EX_VBADI~CONVERTUPPER.
      DATA: OBJ TYPE REF TO ZTESTCLASS.
      DATA: IT_DATA  TYPE ZIN_MT,
                IT_RES   TYPE ZOUT_MT,
                SEXCEPTION TYPE REF TO CX_AI_SYSTEM_FAULT.
      TRY.
          CREATE OBJECT OBJ
             EXPORTING
                 LOGICAL_PORT_NAME = 'TESTPORT'.
      CATCH CX_AI_SYSTEM_FAULT INTO SEXCEPTION.
      ENDTRY.
    ENDMETHOD.
    ================================================
    Thanks,
    Vivek LR

  • Accessing a thread from a main class, please help!

    Hi, I have a thread, T1, that I need to access from my main class. I cannot use runnable, it's got to be done with extands thread. I can start it alright, but I cannot stop it;
    MAIN CLASS
    public class Uppgift1 {
    public static void main(String args[]) throws InterruptedException {
    // Start Thread 1
         Thread trad1 = new T1( );
         trad1.start( );
         //Wait for 5 seconds
         Thread.sleep(5000);
         //Stop the Thread
         trad1.stopIt();
    public class T1 extends Thread {
         boolean go = true;
    public void run ( ) {
    while(go){
         System.out.println("T1: Trad 1");
    try{
    Thread.sleep(1000);
    } catch( InterruptedException e ) {
    public void stopIt(){
    go = false;
    Why can't I run stopIt from my main class?
    Please help me.

    manswide wrote:
    The reason I have to use Thread is that it's for a school thing; I guess I gotta learn to do it the bad way in order to learn why to love the good way later on.Good plan. Making mistakes is a fantastic learning tool
    How do I declare a reference to my own class?
    T1 t1 = new T1();

  • Error in creating a process using runtime class - please help

    Hi,
    I am experimenting with the following piece of code. I tried to run it in one windows machine and it works fine. But i tried to run it in a different windows machine i get error in creating a process. The error is attached below the code. I don't understand why i couldn't create a process with the 'exec' command in the second machine. Can anyone please help?
    CODE:
    import java.io.*;
    class test{
    public static void main(String[] args){
    try{
    Runtime r = Runtime.getRuntime();
         Process p = null;
         p= r.exec("dir");
         BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
         System.out.println(br.readLine());
    catch(Exception e){e.printStackTrace();}
    ERROR (when run in the dos prompt):
    java.io.IOException: CreateProcess: dir error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:63)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:550)
    at java.lang.Runtime.exec(Runtime.java:416)
    at java.lang.Runtime.exec(Runtime.java:358)
    at java.lang.Runtime.exec(Runtime.java:322)
    at test.main(test.java:16)
    thanks,
    Divya

    As much as I understand from the readings in the forums, Runtime.exec can only run commands that are in files, not native commands.
    Hmm how do I explain that again?
    Here:
    Assuming a command is an executable program
    Under the Windows operating system, many new programmers stumble upon Runtime.exec() when trying to use it for nonexecutable commands like dir and copy. Subsequently, they run into Runtime.exec()'s third pitfall. Listing 4.4 demonstrates exactly that:
    Listing 4.4 BadExecWinDir.java
    import java.util.*;
    import java.io.*;
    public class BadExecWinDir
    public static void main(String args[])
    try
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("dir");
    InputStream stdin = proc.getInputStream();
    InputStreamReader isr = new InputStreamReader(stdin);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    System.out.println("<OUTPUT>");
    while ( (line = br.readLine()) != null)
    System.out.println(line);
    System.out.println("</OUTPUT>");
    int exitVal = proc.waitFor();
    System.out.println("Process exitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
    A run of BadExecWinDir produces:
    E:\classes\com\javaworld\jpitfalls\article2>java BadExecWinDir
    java.io.IOException: CreateProcess: dir error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Unknown Source)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at BadExecWinDir.main(BadExecWinDir.java:12)
    As stated earlier, the error value of 2 means "file not found," which, in this case, means that the executable named dir.exe could not be found. That's because the directory command is part of the Windows command interpreter and not a separate executable. To run the Windows command interpreter, execute either command.com or cmd.exe, depending on the Windows operating system you use. Listing 4.5 runs a copy of the Windows command interpreter and then executes the user-supplied command (e.g., dir).
    Taken from:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • JWindow class please help me

    sir<br>
    i design a splash window by the use of JWindow class
    i use the following constructor
    public class splash extends JWindow
    //get content pane and set by the setContentPane method
    and add the three panels in it.
    One JPanel have a JTextField
    but JTextField is not accept the input or focus
    means i try to write text in it but it not work
    the code as follows
    //Create Jwindow
    import javax.swing.*;
    import java.awt.*;
    public class SplashScreen extends JWindow
    public static void main(String args[])
    new SplashScreen().setVisible(true);
    //define Variables
    Toolkit tk=Toolkit.getDefaultToolkit();
    Container cp=getContentPane();
    SplashScreenPanel1 p1;
    SplashScreenPanel2 p2;
    SplashScreenPanel3 p3;
    SplashScreen()
    Dimension d=tk.getScreenSize();
    p1=new SplashScreenPanel1(d.getWidth(),d.getHeight());
    p2=new SplashScreenPanel2(d.getWidth(),d.getHeight());
    p3=new SplashScreenPanel3(d.getWidth(),d.getHeight());
    this.setSize(d);
    this.setContentPane(cp);
    this.getContentPane().setLayout(null);
    cp.setBackground(new Color(47,168,122));
    p1.setBounds(new Rectangle(0,(int)(d.getHeight()-100),(int)d.getWidth(),100));
    p2.setBounds(new Rectangle(0,0,(int)d.getWidth(),100));
    p3.setBounds(new Rectangle(0,100,(int)(d.getWidth()),400));
    this.getContentPane().add(p1);
    this.getContentPane().add(p2);
    this.getContentPane().add(p3);
    p1.b1.requestFocus();
    }//end of spalshscreen
    create JPanel
    public class spashscreenpanel3 extends JPanel
    JTextField t=new JTextField();
    splashscreenpanel3
    this.setSize(200,100);
    this.setLayout(null);
    t.setBounds(10,20,100,20);
    this.add(t);
    }//end of JPanel
    Please help me i am very thankful to u

    Some helpful information is here:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html
    import javax.swing.*;
    import java.awt.*;
    public class hamad extends JFrame
      public static void main(String args[]) 
        new hamad();
      //define Variables
      SplashScreenPanel1 p1;
      SplashScreenPanel2 p2;
      SplashScreenPanel3 p3;
      JWindow window;
      public hamad()
        createWindow(this);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(300,200);
        setLocation(500,300);
        setVisible(true);
      private void createWindow(JFrame frameReference) {
        window = new JWindow(frameReference);
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension d=tk.getScreenSize();
        p1=new SplashScreenPanel1();
        p2=new SplashScreenPanel2();
        p3=new SplashScreenPanel3();
        window.getContentPane().add(p1, "North");
        window.getContentPane().add(p2, "Center");
        window.getContentPane().add(p3, "South");
        window.setSize(d.width/4, d.width/4);
        window.setLocation(100,100);
        window.setVisible(true);
      private class SplashScreenPanel1 extends JPanel
        JTextField field;
        public SplashScreenPanel1()
          setBackground(new Color(200,150,190));
          setPreferredSize(new Dimension(100,50));
          field = new JTextField();
          field.setPreferredSize(new Dimension(100, 20));
          add(field);
      private class SplashScreenPanel2 extends JPanel
        JTextField field;
        public SplashScreenPanel2()
          setBackground(new Color(220,90,180));
          field = new JTextField();
          field.setPreferredSize(new Dimension(75,20));
          add(field);
      //create JPanel
      private class SplashScreenPanel3 extends JPanel
        JTextField t=new JTextField();
        public SplashScreenPanel3()
          setBackground(Color.pink);
          setPreferredSize(new Dimension(100,50));
          setLayout(null);
          t.setBounds(10,20,100,20);
          add(t);
      }//end of JPanel
    }//end of spalshscreen

  • Remove the key listener from JTable problem please help

    Hi
    I�m trying to remove the key listener from my table, it doesn�t work,
    I�m pressing the enter key it still goes to the next row from the table,
    hear is my code
    KeyListener[] mls = (KeyListener[])(table.getListeners(KeyListener.class));
    for(int i = 0; i < mls.length; i++ )
    table.removeKeyListener(mls);
    Please help thanks

    Hm ...
    that should indeed remove all the KeyListeners from your table - the question is only, when does this happen?- Where in your code do you remove the KeyListeners?- I am quite sure, you remove them successfully, but after your have removed them, one or more KeyListeners are added to the table.
    greetings Marsian

Maybe you are looking for

  • Bug or feature? Button images prefixed with /i/

    Dear all - Several people have noticed that button images get prefixed with /i/, so that if you use #IMAGE_PREFIX#image.gif then the source reads /i//i/image.gif (and of course the image isn't displayed). Admittedly I can't prove that right now becau

  • I need to transfer information through firewire cable and could not remember how it works, please, help

    Please help, I need urgently to transfer information through firewire cable and I could not remember how it was that I do it. I've connected the computers and restarted one of them by pushing T on startup but it did not work.

  • How to color-correct / color-match a lot of photos to a certain target.

    Hi there, I have something like 1,850 photos, taken in RAW and later converted to DNG, to create a stop motion. All the photos were taken with the same camera (Canon 5D Mk II) and most of them with a 24-70L. All were taken in the same lighting condit

  • Numbers to iCal? Export to ICS

    I'm trying to simplify my calendar situation and use numbers to import a csv, make my changes and save. I can then get that to my phone and a work calendar. Imprting to iCal souldn't be any more difficult. Has anyone come up with a template for iCal

  • Error in GR(Enter S.loc) for Thrid party PO

    Dear Gurus, I have created PO with Acct assignment X & Item Catg: S, while doing GR, system is asking for Storage location(Error message). But for X & S combination, S.location should not ask...can you please help me??