I can't give my variable to the get method

Hello togheter
At the moment I work with JDOM. It is possible to get access to an XML File with JDOM, but I want to pass the String I get, to another Method in a different class. My problem is, that my getMethod doesn't get the variable. The variable is always "null". What is the problem, please help me.
I will also give you my code:
Here is the code for class 1, I take the String from this class. See the arrow
package FahrplanXML;
import java.io.File;
import java.io.IOException;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.xml.sax.InputSource;
public class FileAuswahl {
   private File filenames;
   private String scheduledtdversion;
   public void ablauf() throws JDOMException, IOException {
      FileAuswaehlen();
      saxwer();
      grundoberflaeche xmloberflaeche = new grundoberflaeche();
      xmloberflaeche.grundoberflaechen();
   public void FileAuswaehlen() {
   JFileChooser datei = new JFileChooser();
   datei.setFileFilter(new FileFilter()
            @Override public boolean accept (File f)
               return f.isDirectory() ||
               f.getName().toLowerCase().endsWith(".xml");
            @Override public String getDescription()
               return "XML-Files";
   int state = datei.showOpenDialog(null);
   if (state == JFileChooser.APPROVE_OPTION )
      filenames = datei.getSelectedFile();
      System.out.println (filenames);
      if (filenames != null)
               try {
                  System.out.print(filenames);
                  saxwer();
               } catch (JDOMException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
               } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
      else
         System.out.println("Kein File ausgew�hlt");
   else
   System.out.println("Auswahl abgebrochen");
   System.exit(0);
   //Ausgew�hlter Dateiname an saxwer �bergeben
   public File getNames() {
      System.out.println (filenames);
      return this.filenames;
   public void saxwer() throws JDOMException, IOException {
      //FileAuswahl filename = new FileAuswahl();
      File files = getNames();
      System.out.println (files);
         SAXBuilder builder = new SAXBuilder();
         Document doc = builder.build(files);
         Element schedulemessage = doc.getRootElement();
         //Root Element auslesen
         String sch_msg_dtdversion = schedulemessage.getAttributeValue ("DtdVersion");  // <---
         scheduledtdversion = sch_msg_dtdversion;
         new grundoberflaeche().grundoberflaechen();
         public String getDtdVersion() {
            System.out.println (scheduledtdversion);
            return this.scheduledtdversion;
   } Now, you will see the class in which I pass the String. See also arrow...
package FahrplanXML;
import java.awt.Component;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.text.Caret;
import org.jdom.Attribute;
import org.jdom.JDOMException;
public class grundoberflaeche {
//      Layout f�r Laender vorbereiten
      static void addComponent (Container cont,
            GridBagLayout diversemoegl,
            Component laenderdetails,
            int x, int y,
            int width, int height,
            double weightx, double weighty )
            GridBagConstraints grundoberflaechen = new GridBagConstraints();
            grundoberflaechen.fill = GridBagConstraints.BOTH;
            grundoberflaechen.gridx = x; grundoberflaechen.gridy = y;
            grundoberflaechen.gridwidth = width; grundoberflaechen.gridheight = height;
            grundoberflaechen.weightx = weightx; grundoberflaechen.weighty = weighty;
            diversemoegl.setConstraints(laenderdetails, grundoberflaechen);
            cont.add(laenderdetails);
      //Ausw�hlen des XML Files
      public void XMLAuswaehlen() {
         JFrame xmlauswahl = new JFrame("Fahrplan ausw�hlen");
         xmlauswahl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container laenderdetails = xmlauswahl.getContentPane();
         GridBagLayout diversemoegl = new GridBagLayout();
         laenderdetails.setLayout(diversemoegl);
         JButton dateiauswahl = new JButton ("Datei ausw�hlen");
         addComponent(laenderdetails,diversemoegl,dateiauswahl,1,1,1,1,1,1);
         ActionListener ersterdateiauswaehler = new ActionListener()
            public void actionPerformed( ActionEvent e)
                  try {
                     new FileAuswahl().ablauf();
                  } catch (JDOMException e1) {
                     // TODO Auto-generated catch block
                     e1.printStackTrace();
                  } catch (IOException e1) {
                     // TODO Auto-generated catch block
                     e1.printStackTrace();
         dateiauswahl.addActionListener(ersterdateiauswaehler);
         xmlauswahl.setSize(150,70);
         xmlauswahl.setVisible(true);
      //Layout machen
      public void grundoberflaechen() {
         JFrame fahrplan = new JFrame("Fahrplanauswahldetails");
         fahrplan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container laenderdetails = fahrplan.getContentPane();
         GridBagLayout diversemoegl = new GridBagLayout();
         laenderdetails.setLayout(diversemoegl);
         //Klassenobjekt aufbauen
         FileAuswahl fileauswahl = new FileAuswahl();
         // Labelsbauen und einbauen in den Fahrpl�nen
         String dtdversion = fileauswahl.getDtdVersion();   // <---
         System.out.println(dtdversion);
         JTextField DtdVersion = new JTextField(1);
         DtdVersion.setText(dtdversion);
         JTextField fahrplanzeit = new JTextField(1);
         fahrplanzeit.setText("123");
         JTextField fahrplanzeita = new JTextField(1);
         fahrplanzeita.setText("piips");
         //JButton oesterreich = new JButton("�sterreich");
         //JButton italien = new JButton("Italien");
         //JButton frankreich = new JButton("Frankreich");
         //JButton spanien = new JButton("Spanien");
         addComponent(laenderdetails,diversemoegl,new JLabel("Fahrplandetails"),0,0,1,1,0,0);
         addComponent(laenderdetails,diversemoegl,DtdVersion,1,0,1,1,0,0);
         addComponent(laenderdetails,diversemoegl,fahrplanzeit,2,0,1,1,0,0);
         addComponent(laenderdetails,diversemoegl,fahrplanzeita,3,0,1,1,0,0);
         //         Action Listener f�r Dateiauswahl
         //         Action Listener f�r das Speichern der Datei
         //addComponent(laenderdetails,diversemoegl,frankreich,2,1,1,1,0,0);
         //addComponent(laenderdetails,diversemoegl,spanien,3,1,1,1,0,0);
         fahrplan.setSize(600,750);
         fahrplan.setVisible(true);
}Thank you very much for your help....
Your Java Learner

Reposted here, rather than bumping up this topic:
http://forum.java.sun.com/thread.jspa?threadID=736492

Similar Messages

  • I can't over give my variable to the return in the get Method!

    Hello Java Cracks
    At the moment I am working with JDOM. I am able to get access to the XML File with JDOM, but when I want to send, the value of a variable, which I get from the XML File it is not possible. When I try to send the variable to the get Method (getDtdVersion), the value I over give is always �null�. Please help me, and say what the problem is?
    I also post you the second class, where I want to use the variable I over give.
    Here is my code:
    Class 1, I take the String from this class. See the arrow
    package FahrplanXML;
    import java.io.File;
    import java.io.IOException;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.FileFilter;
    import org.jdom.Attribute;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.input.SAXBuilder;
    import org.xml.sax.InputSource;
    public class FileAuswahl {
    private File filenames;
    private String scheduledtdversion;
    public void ablauf() throws JDOMException, IOException {
    FileAuswaehlen();
    saxwer();
    grundoberflaeche xmloberflaeche = new grundoberflaeche();
    xmloberflaeche.grundoberflaechen();
    public void FileAuswaehlen() {
    JFileChooser datei = new JFileChooser();
    datei.setFileFilter(new FileFilter()
    @Override public boolean accept (File f)
    return f.isDirectory() ||
    f.getName().toLowerCase().endsWith(".xml");
    @Override public String getDescription()
    return "XML-Files";
    int state = datei.showOpenDialog(null);
    if (state == JFileChooser.APPROVE_OPTION )
    filenames = datei.getSelectedFile();
    System.out.println (filenames);
    if (filenames != null)
    try {
    System.out.print(filenames);
    saxwer();
    } catch (JDOMException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    else
    System.out.println("Kein File ausgew�hlt");
    else
    System.out.println("Auswahl abgebrochen");
    System.exit(0);
    //Ausgew�hlter Dateiname an saxwer �bergeben
    public File getNames() {
    System.out.println (filenames);
    return this.filenames;
    public void saxwer() throws JDOMException, IOException {
    //FileAuswahl filename = new FileAuswahl();
    File files = getNames();
    System.out.println (files);
    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(files);
    Element schedulemessage = doc.getRootElement();
    //Root Element auslesen
    String sch_msg_dtdversion = schedulemessage.getAttributeValue ("DtdVersion"); // <---
    scheduledtdversion = sch_msg_dtdversion;
    new grundoberflaeche().grundoberflaechen();
    public String getDtdVersion() {
    System.out.println (scheduledtdversion);
    return this.scheduledtdversion;
    Now, you will see the class in which I pass the String. See also arrow...
    package FahrplanXML;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.text.Caret;
    import org.jdom.Attribute;
    import org.jdom.JDOMException;
    public class grundoberflaeche {
    // Layout f�r Laender vorbereiten
    static void addComponent (Container cont,
    GridBagLayout diversemoegl,
    Component laenderdetails,
    int x, int y,
    int width, int height,
    double weightx, double weighty )
    GridBagConstraints grundoberflaechen = new GridBagConstraints();
    grundoberflaechen.fill = GridBagConstraints.BOTH;
    grundoberflaechen.gridx = x; grundoberflaechen.gridy = y;
    grundoberflaechen.gridwidth = width; grundoberflaechen.gridheight = height;
    grundoberflaechen.weightx = weightx; grundoberflaechen.weighty = weighty;
    diversemoegl.setConstraints(laenderdetails, grundoberflaechen);
    cont.add(laenderdetails);
    //Ausw�hlen des XML Files
    public void XMLAuswaehlen() {
    JFrame xmlauswahl = new JFrame("Fahrplan ausw�hlen");
    xmlauswahl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container laenderdetails = xmlauswahl.getContentPane();
    GridBagLayout diversemoegl = new GridBagLayout();
    laenderdetails.setLayout(diversemoegl);
    JButton dateiauswahl = new JButton ("Datei ausw�hlen");
    addComponent(laenderdetails,diversemoegl,dateiauswahl,1,1,1,1,1,1);
    ActionListener ersterdateiauswaehler = new ActionListener()
    public void actionPerformed( ActionEvent e)
    try {
    new FileAuswahl().ablauf();
    } catch (JDOMException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    } catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    dateiauswahl.addActionListener(ersterdateiauswaehler);
    xmlauswahl.setSize(150,70);
    xmlauswahl.setVisible(true);
    //Layout machen
    public void grundoberflaechen() {
    JFrame fahrplan = new JFrame("Fahrplanauswahldetails");
    fahrplan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container laenderdetails = fahrplan.getContentPane();
    GridBagLayout diversemoegl = new GridBagLayout();
    laenderdetails.setLayout(diversemoegl);
    //Klassenobjekt aufbauen
    FileAuswahl fileauswahl = new FileAuswahl();
    // Labelsbauen und einbauen in den Fahrpl�nen
    String dtdversion = fileauswahl.getDtdVersion(); // <---
    System.out.println(dtdversion);
    JTextField DtdVersion = new JTextField(1);
    DtdVersion.setText(dtdversion);
    JTextField fahrplanzeit = new JTextField(1);
    fahrplanzeit.setText("123");
    JTextField fahrplanzeita = new JTextField(1);
    fahrplanzeita.setText("piips");
    //JButton oesterreich = new JButton("�sterreich");
    //JButton italien = new JButton("Italien");
    //JButton frankreich = new JButton("Frankreich");
    //JButton spanien = new JButton("Spanien");
    addComponent(laenderdetails,diversemoegl,new JLabel("Fahrplandetails"),0,0,1,1,0,0);
    addComponent(laenderdetails,diversemoegl,DtdVersion,1,0,1,1,0,0);
    addComponent(laenderdetails,diversemoegl,fahrplanzeit,2,0,1,1,0,0);
    addComponent(laenderdetails,diversemoegl,fahrplanzeita,3,0,1,1,0,0);
    // Action Listener f�r Dateiauswahl
    // Action Listener f�r das Speichern der Datei
    //addComponent(laenderdetails,diversemoegl,frankreich,2,1,1,1,0,0);
    //addComponent(laenderdetails,diversemoegl,spanien,3,1,1,1,0,0);
    fahrplan.setSize(600,750);
    fahrplan.setVisible(true);
    Thank you very much for your help....
    Your Java Learner

    I suspect you are setting the scheduledtdversion member in one instance of your FileAuswahl class, but are creating yet another instance of that class and printing the member of that instance, which is null. I notice you are creating a new FileAuswahl instance each time something happens, rather than reusing the same instance.
    FileAuswahl fileauswahl = new FileAuswahl();Ok, new object here. Not the same one that you previously set the scheduledtdversion member in
    String dtdversion = fileauswahl.getDtdVersion();It's null of course, for the reason above.

  • On my app store I what to update an app but the e-mail is my husband it in a light color making it so I can't change it to my e-mail address. It ask for a password can't give one because of the e-mail how do I change this I'm lock out?

    On my app store I what to update an app but the e-mail is my husband it in a light color making it so I can't change it to my e-mail address. It ask for a password can't give one because of the e-mail how do I change this I'm lock out?

    This is your husband's app, only your husband can update it. Apps are forever tied to the Apple ID that purchased them. No other Apple ID can update someone else's app.

  • How can I pass environment variables to the child process?

    How can I pass environment variables to the child process? This is what I tried and it didn't work.
         static public void main (String[] args) throws Exception {
              ProcessBuilder b = new ProcessBuilder("java", "-cp", ".", "Child");
              Map<String, String> map = b.environment();
              map.put("custom.property", "my value");
                 b.redirectErrorStream(true);
              Process p = b.start();
              BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
              String line = null;
              while (null != (line = reader.readLine())) {
                   System.out.println(line);
         public static void main(String[] args) {
              System.out.println("The value of custom.property is : " + System.getProperty("custom.property"));
         }and the result is:
    The value of custom.property is : null

    Complete test:
         static public void main (String[] args) throws Exception {
              ProcessBuilder b = new ProcessBuilder("java", "-Dcustom.property=my property value", "-cp", ".", "Child");
              Map<String, String> map = b.environment();
              map.put("custom.property", "my environment value");
                 b.redirectErrorStream(true);
              Process p = b.start();
              BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
              String line = null;
              while (null != (line = reader.readLine())) {
                   System.out.println(line);
         public static void main(String[] args) {
              System.out.println("Property value of custom.property is : " + System.getProperty("custom.property"));
              System.out.println("Environment value of custom.property is : " + System.getenv("custom.property"));          
         }

  • How can we give a placeholder to the complex table like "Please Select" in WPF

    How can we give a placeholder to the complex table like "Please Select" in WPF. Actually i have to give a default value like "please select" to the complex table in WPF. I tried with placeholder but its not working.
    Tags edited by: Michael Appleby

    Manu,
    What version of Agentry and WPF client?  If placeholder is not working, it is probably a WPF bug in your version.  There is no other way to do it.  Try it on a current release, and if still broken then file a bug ticket so this can be fixed.
    Jason Latko - Senior Product Developer at SAP

  • Can someone give a explan what the System Performance indicators mean?

    Can someone give a explan what the System Performance indicators mean?
    Audio & Disk I/O
    Thank you,
    Scott
    G5 Dual 2.0 - 2.5 Gigs Ram   Mac OS X (10.3.9)  

    Hi Scott!
    Audio is your CPU activity, and Disk i/o is the amount of bandwidth you're using when streaming files from the hard drive (audio files and sample streaming).

  • Can you see a image in the Get Info Window?

    After upgrading to Mt LIon and while using CS6, I can't see image previews in the Get Info window.  Can't see images in the upper left corner of the get info window, so I can't make a selection and then do a copy- paste like I could do before I upgraded to Mt Lion with CS6.  I want to be able to paste a image of the subjects in my folders..  IE folder of Panda Bears would have a image of a Panda showing on that folder.  Folder of The Great Wall would have a image of the Great Wall on the Folder of Great Wall pictures.  This has always worked for the past many years I have used a Mac and Photoshop.  I started with Photoshop 2.  All my photo folders are represented by images so I have a good idea of what is contained in each folder.  Now after 2 weeks in China, 20 folders are represented by 10-11-12, 10-12-12, 10-13-12, 10-14-12 and so on.  Shows me nothing but dates.  I have tried saving as Jpeg, Tiff, and PAD, and still can't  do a copy-paste in the Get Info window.   Apple says it is a Adobe problem, Yesterday Adobe told me it is because I am uusing a Nikon D800 and Adobe does not have a  patcdh for the NEW Nikon camera.  I then tried using my Nikon D2Xs, Nikon D3X, Nikon 800 and even my wife's D50 and none of these camera allow me to copy paste the thumbnail image to the clipoboard like I have been able to do for YEARS...   I can see images in a folder in Bridge, but the images dont show in my desktop folders.IE, a folder on my desktop with 200 pictures only show with words/ numbers/letters NO IMAGES appear in the folders on the desktop.  On some folders the folders in a folder don't show up as Folders either.
    Can Any one help me.  Same thing happens on my MACPRO w 16 GB Ram and on my 17" MacBook Pro.

    Allan Sicks wrote:
    Thanks for your input.  Problem might be with the EASTER BUNNY..... have to have someone to blame.
    I can't blame you for saying that.
    Adobe is the clear owner of the responsibility to make functional their product that they claim is compatible with your operating system.  Adobe is the one who sold you the product.
    I just went looking for what Adobe has said about Mountain Lion compatibility, and they both list Mountain Lion as compatible and include such language as that on this page (emphasis mine):
    Adobe and Apple have worked closely together to test Adobe® Creative Suite® 5, 5.5 and CS6 editions and individual products for reliability, performance and user experience when installed on Intel® based systems running Mac OS X Mountain Lion (v10.8). Earlier versions of Adobe Photoshop® (CS3 and CS4) software were also tested with Mountain Lion and there are currently no known issues.
    I suggest that Adobe needs to get on the ball and get this fixed.  The time for user patience is over.
    If someone from Adobe is saying "Adobe can't fix it" then that someone is at the wrong authority level and/or is thinking on the wrong level.
    This is business and the business is making products that have value and are sold to people who perceive that value.  Adobe doesn't get to keep selling products that don't work while standing on principles that "it's someone else's problem".   Customers don't care why it doesn't work. 
    It's obvious to a child that if Photoshop CS5 can write the proper things to the Apple OS so that the thumbnails are visible, that there's something Adobe could do to fix it.
    But EVEN IF this were something only Apple could fix, that Apple hasn't fixed it yet says pretty loudly that Adobe isn't making the right overtures to Apple for their mutual benefit.  Adobe, are your executives so greedy that they can't grease a few palms of their friends over at Apple to put some priority on this?  What's the problem here?  Has Adobe actually forgotten how to do business?
    -Noel
    P.S., You should know that I don't use a Mac and am personally having no issues with seeing proper thumbnails and previews on my Windows 7 and 8 systems, since the software that does that isn't from Adobe.

  • Can i save email addresses in the get a document signed section

    can i save email addresses in the get a document signed section

    Hello lkmaier,
    As of now, its  not possible to save the email addresses manually in EchoSign.They are automatically stored once you send the document out for signature. Later, when you start typing the email address in To field in Send page, the email address is automatically shown up.
    Regards,
    -Rijul
    EchoSign Support

  • Can anyone give some good sources to get placement papers of adobe.

    can anyone give some good sources to get placement papers of adobe.idk is it right place to ask

    adobe placement papers are based on c programming.to clear adobe placement u need strong deep concepts of c programming following are some good sources for placement papers and c programming tutorials.
    for placement
    http://www.placementpapers.in
    http://freshersworld.com
    for c programming
    http://www.miniwiki.tk/c/index.htm
    http://visualcplus.blogspot.com

  • Merge can't accept a variable in the select clause?

    oracle 10.2
    I have a stored procedure.
    I have a variable, vseq, which I set a sequence variable. With all other sql statements I can do
    insert into table a
    select vseq
    from dual;
    Apparently a merge can't handle variables in the select clause. I get an error. I can get it to work when I hard code a value.
    this is ridiculous...

    merge can't handle variables in the select clauseCare to prove?
    sql> DECLARE
      2   v_first_name varchar2(20) := 'BOSS';
      3  BEGIN
      4  MERGE INTO sun_employees se
      5  USING (SELECT * FROM employees WHERE department_id = 20) e
      6  ON (e.employee_id = se.employee_id)
      7  WHEN MATCHED THEN
      8    UPDATE SET salary = e.salary
      9  WHEN NOT MATCHED THEN
    10  INSERT(employee_id, first_name, last_name, department_id)
    11  VALUES (e.employee_id, v_first_name, e.last_name, e.department_id);
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    sql> select first_name from sun_employees;
    FIRST_NAME
    BOSS
    BOSS

  • Can we add a variable in the document title of SOFM..

    Hi,
    I am trying to use a variable in the document title as below:
    Approval by: &MANAGER&  =>  &DOCUMENTTITLE&
    But this does not work, the note is getting displayed as:
    Approval by: &MANAGER&, ideally should be "Approval by: Micheal John". Please let me know about this.
    Thanks,
    Sukumar.

    Hi,
    I have the variable "Manager" in the workflow container. In the document title of SOFM. I want to display the DOCUMENTTITLE as " Manager approval by: &Manager&. How can I use the concatenate function here?
    Thanks.
    Sukumar.

  • Weird one..  i can't return a variable from the extended to the super class

    Hey everyone, i hope i'm not annoying you guys :)
    So today's problem is to return a variable (int) from a method of the extended class and print it ont the super class.
    I'm just testing the super class , if it works fine.
    So the extended class ( FileIO) just read the file txt and return the integer or string ( from the txt file)
    I already did a main method to that class and tested it, it works fine.
    So now the problem is to print the integer ( that the extended class gets from the txt. ) inside the Super class. I mean , is the same thing but now im testing the Super class , just have to do the same thing, a super class method calls the extended class method and receive the integer from the txt file.
    i think the problem is when i create the instance of the FileIO object , maybe its constructor ...i don't know.
    The name of the txt file is passed from the super class to the extended class, but i think the error is not from there.
    this.aero_le = new BufferedReader(new FileReader(super.ficheiroleitura_aero()));  //  super calls ficheiroleitura_aero()  and receive the name of the txt file ( e.g "temp.txt")  so i think that is correct.
    here's the code of the Super class public class Aeroporto {
         private String filereader_voo = "temporary.txt";
         private String filereader_aero = "temp.txt";
         private String siglaAero = "";
         public FileIO file;
         public Aeroporto(){};
         public Aeroporto(String filereader_voo, String filereader_aero) throws IOException{
              this.filereader_voo = filereader_voo;
              this.filereader_aero =filereader_aero;     
              file = new FileIO();
         public String siglaAero() {
              return siglaAero; }
         public String filereader_aero(){
              return filereader_aero;
    public int nrLines() throws IOException{   // it was supose to retunr the number of lines ( integer) from the txt file .
              return Integer.parseInt(file.lerLinhaN(1,1));
    // main() {
    Aeroporto a = new Aeroporto();
              int v = a.nrLines();
              System.out.print(v);
    // ***********************************************************+
    // Extended Class
    public class FileIO extends Aeroporto{
         private String ficheiroescrita;
         private PrintWriter vooescreve, aeroescreve ;
         private BufferedReader voo_le, aero_read;
         public FileIO(){}
         public FileIO(String filereader_voo, String filereader_aero, String ficheiroescrita) throws IOException {
              super(filereader_voo, filereader_aero);
              this.ficheiroescrita = ficheiroescrita;
              //If file does not exists , create one.
              try{
                   this.aero_read = new BufferedReader(new FileReader(super.filereader_aero()));
                   aero_read.close();
              catch(IOException ex){
                   this.aeroescreve = new PrintWriter(new FileWriter(ficheiroescrita));
                   aeroescreve.close();
    public String lerLinhaN(int line, int column) throws IOException{  // this method works fine , i already tested this class.
              this.aero_read = new BufferedReader(new FileReader(super.filereader_aero()));
              for(int i = 0; i != line-1; ++i) aero_read.readLine();
              String linha = aero_read.readLine();
              String [] words = linha.split(" ");
              return words[column-1];
    Maybe the error is that i use to test the Super class a default contructor on both classes... i don't know where the error is, i also did two small classes ( super and another that extends ) and get the string "Hello" from the super and print it inside the extended..and it works, that's why i think the error is when i call the extended class .. need help.
    thanks.

    Ok,
    This one might actually work... atleast it compiles.import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.File;
    import java.io.PrintWriter;
    import java.io.FileWriter;
    import java.io.IOException;
    public abstract class FileIO {
         public static boolean CreateOutputFileIfNotExists(
              String outputFilename //the name of the file to ensure exists.
         ) throws IOException
              final String functionName = "FileIO.CreateOutputFileIfNotExists";
              boolean retVal = false;
              //If the output file does does not exist then create it.
              //post condition: output file exists or an IOException has been thrown.
              BufferedReader infile = null;
              try{
                   infile = new BufferedReader(new FileReader(outputFilename));
                   retVal = true;
              } catch(IOException ex) {
                   PrintWriter outfile = null;
                   try {
                        outfile = new PrintWriter(new FileWriter(outputFilename));
                        retVal = true;
                   } catch(IOException ex2){
                        throw new IOException(functionName + ": cannot create output file " + outputFilename, ex2);
                   } finally {
                        outfile.close();
                        if (outfile.checkError()) {
                             throw new IOException(functionName + ": error on output stream " + outputFilename);
              } finally {
                   try {
                        infile.close();
                   } catch(IOException ex){
                        throw new IOException(functionName + ": cannot close output file " + outputFilename, ex);
              return(retVal);
         public static String readLine(
                   String  inputFilename //the name of the file to read.
              , int     lineNumber    //1 based number of the line to read from.
         ) throws IOException
              final String functionName = "FileIO.readLine";
              String outputLine = null;
              // reads the numbered "lineNumber" from "inputFilename".
              BufferedReader infile = null;
              try {
                   infile = new BufferedReader(new FileReader(new File(inputFilename)));
                   for(int i=1; i<lineNumber; ++i) infile.readLine();
                   outputLine = infile.readLine();
              } catch(IOException ex){
                   throw new IOException(functionName + ": cannot read input file " + inputFilename, ex);
              } finally {
                   try {
                        infile.close();
                   } catch(IOException ex){
                        throw new IOException(functionName + ": cannot close input file " + inputFilename, ex);
              return(outputLine);
         public static String readWord(
                   String inputFilename  //the name of the file to read.
              , int lineNumber        //1 based number of the line to read from.
              , int wordNumber        //0 based number of the word to read.
         ) throws IOException
              final String functionName = "FileIO.readWord";
              String outputWord = null;
              // reads the numbered space-seperated "wordNumber" from the numbered "lineNumber" of "inputFilename"
              try {
                   String[] words = FileIO.readLine(inputFilename, lineNumber).split(" ");
                   if (wordNumber>0 && wordNumber<words.length) outputWord = words[wordNumber-1];
              } catch(IOException ex){
                   throw new IOException(functionName + ": cannot read input file " + inputFilename, ex);
              return(outputWord);
    }Design notes... FileIO is a generic helper class... there is nothing specific to Airports, flights, or any other "domain" specific stuff in it... so it's re-usable... you can keep it and reuse it on other projects, or even share it with your friends.
    So... The airport class will just call the static methods on FileIO like this    ....
        int lineNumber=1;
        int wordNumber=1;
        String airportCode = FileIO.readWord(airportsFilename, lineNumber, wordNumber);
        ....How's that?
    corlettk: my now mandatory edit.

  • CAN I PASS FORM VARIABLES TO THE DATABASE PROCEDURE IN PERSONALIZATION

    When I try to use form variable in the database procedure call from personalization I get the attached error.
    Under forms personalization
    From Actions tab --> builtin --> Execute Procedure when I call a database procedure and pass one of the form variable as parameter I get "ora-01008 couldn't be validate" error
    Can we pass on form variables to the database package using personalization ? If yes, then is this the right way?
    Message was edited by:
    omitchel

    I tried customizing the Quoting Form, it works.
    What you have done is correct, but this is how you call it
    ='begin
    db_proc('''||${item.qothddet_main.quote_name.value}||''');
    end'
    here
    qothddet_main : block name
    quote_name : item name
    Thanks
    Tapash

  • How to get the tag of the User Defined Variables using the Get Tag method%3F

    For the cRIO modules under a cRIO Chasis, a tag value can be obtained using the Get Tag method with crio.Type to the TagName input of the method. When it comes to the User Defined Variables, what should be fed to the TagName input?

    For the cRIO modules under a cRIO Chasis, a tag value can be obtained using the Get Tag method with crio.Type to the TagName input of the method. When it comes to the User Defined Variables, what should be fed to the TagName input?

  • Can an error be forced in the Post method of Create Purch. Req. ME51N

    Hello Developers,
    I need to prevent the Posting from ME51N after displaying errors in custom code.
    I created an enhancement at the beginning of the Post method to perform edits but even after a message type "E" occurs the PR number displays on the screen as though the PR was generated.
    Perhaps what I really need to know is, how does the error reporting work for ME51N and how can take advantage of this in custom code prior to post?
    Thank you,
    Terry

    Hello Terry
    Assuming that you are working at a simliar place like method POST of interface IF_EX_ME_PROCESS_REQ_CUST you may have a look at the sample coding of the dummy class CL_EXM_IM_ME_PROCESS_REQ_CUST:
    method IF_EX_ME_PROCESS_REQ_CUST~OPEN .
      INCLUDE mm_messages_mac.  " <<< Include with message handling macros !!!
      DATA l_null TYPE REF TO if_message_obj_mm.
    * IF ...
    *- handling for error messages -> see oss note 938007
        mmpur_business_obj l_null.
        mmpur_message_forced sy-msgty sy-msgid sy-msgno sy-msgv1 sy-msgv2
                             sy-msgv3 sy-msgv4.  " <<< send message using macros !!!
        ch_valid = mmpur_no.
    * ENDIF ...
    endmethod.
    I assume you have to apply the same logic in your enhancement.
    Regards
      Uwe

Maybe you are looking for

  • Install problem

    Hello SAP-Gurus, I have a Pack of SAP CD's to practice at home SolMan 3.2 e MS SQL. So I have some problems now. I have installed Central Instance, Database Instance and Dialog Instance. I have this problem: the dispacer's icon doesnt'n became green.

  • Why do my monitor stay in sleep mold?

     Monitor Status shows: I havea HP 2009 m monitor and Pavilion Slimline s5220f pc, when I turn on my monitor it keeps on say DVI: no signal, VGA:no signal, Auto-switch Sourcen,DefaultSource: DVI-DIGITAL and the  monitors reads, monitor going to sleep.

  • Flex 4, datagrid, checkboxes, and the impossible dream?

    I want to build a datagrid that has a column with checkboxes so the user can select a single record or multiple records (for deletion, for exporting, for whatever). But I also want to enable the user to click on anywhere in the row other than the che

  • Unable to access external drive.

    I'm a newbie to macs. Tried to use my Maxtor One Touch III USB external hard drive which had previously been my windows backup drive, on my new mac. Copied all the files to the mac, reformatted it with Mac Extended and then copied the files back over

  • Raw converters in Aperture technical help needed.

    my Nikon D80 produces NEF Raw files whilst in aperture it states it is using version 2 raw, however if i put the same photo into Photoshop Elements it is using Raw 4.3.1. Are these raw converters the same thing or has aperture got to catch up and mak