FileManager Class

Hey,
I'm trying to use FileManager to work on manipulating my text file, but I have a problem. I have this code:
FileManager fm = new FileManager();
However, I keep getting an area saying "cannot resolve symbol -- class FileManager." Why does this keep happening? Do I have to import something or am I missing something here?
Thank you for all your help

The class that provides a mechanism for the user to choose a file is: [url http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFileChooser.html]javax.swing.JFileChooser.
There is a simple example in the class documentation.
To read a text file line by line you could do as following: [url http://javaalmanac.com/egs/java.io/ReadLinesFromFile.html]Reading Text from a File
Don't forget the import statements:import javax.swing.JFileChooser;
import java.io.BufferedReader;
...Regards

Similar Messages

  • File i/o problem

    iam trying to copy file so i made class it's name filemanager and i made static method called
    copy and i used the low level streames without filtering, to read and write, but i found the copy proccess it too too slow, and when i used the BufferedInputStream classes in reading and writing i found the copy proccess is fasterbut the output file is smaller than the input file by littel bytes
    //this is the code for the filemanager class
    //i compiled it and put it in my classes library
    public class FileManager{
         static public void copy(File file1,File file2){
              try{
              FileInputStream f1=new FileInputStream(file1);
              FileOutputStream f2=new FileOutputStream(file2);
              BufferedInputStream ino=new BufferedInputStream(f1);
              BufferedOutputStream outo=new BufferedOutputStream(f2);
              boolean eof=false;
              while (! eof) {
              int c=ino.read();
              if (c==-1)
              {eof=true;}
              else{outo.write(c);}
              catch(IOException e) {
                   System.out.println(e);
    //and in my application i imported it used it
    public static void main(String args[]) {
              System.out.println("Starting Copy...");
              File file11 = new File( "g:\\hazzem.jpg" );
              File file22=new File("g:\\copy2.jpg");
              FileManager.copy(file11,file22);

    Try copying a byte array, it will go much faster, use a larger byte array say of size 1024 for example.

  • [SOLVED]systemd and make a camera visible GUI-wise in your filemanager

    After reading a lot about systemd in the wiki and in this forum I understand there are different opionons about systemd. Anyway, I have a adapted all the changes to rc.conf leaving out only a few daemons to start there. So why not give systemd a try? If you dont want to read the full posting I finally got it to work, basically by reading carefully and checking the suggested tests in the systemd wiki. (loginctl)
    As suggested by the wiki, I tried the systemd yesterday. Enabled via systemctl some services to "replace" my rc.conf daemons. I got what I thought everything to work, including autologin directly to my Xfce4 desktop. Everything except the digital camera.
    When starting Arch traditionally via initscripts I immediately can see the camera in the filemanager (Nautilus) when the camera is attached via USB.
    Some minutes later, after adding "init=/usr/lib/systemd/systemd" to the APPEND line in Syslinux and rebooting, my machine reboots
    fine.But when connecting the camera again it is not visible graphically.
    The camera is there because when using gphoto2 (the commandline) as root I can transfer pictures etc.
    Even if I am no happy CLI user I can handle it when necessary. Handling pictures a graphical view of them is much easier...
    As the wiki about systemd says one can try it out. I have not removed anything from the system and when starting Arch again, the initscript way, I can see the camera again in my filemanager, gthumb works again and pictures can be transferred to my machine.
    In the wiki again, this time about digital cameras
    Permission issues
    Camera devices should be granted permission using ACLs. For this to work, users need to have consolekit or systemd running and the user session must be registered with them accordingly.
    Check this using /usr/bin/ck-list-sessions to verify a value of "TRUE" should be returned for both the "active" and "is-local" fields:
    $ ck-list-sessions | grep TRUE
    active = TRUE
    is-local = TRUE
    ACL=Atlantic Container Line is what first comes into my mind. I have had some connections to transport business...I admit I had to google it to find the correct interpretation of this mumbo-jumbo.
    The wiki also gives a "hint", if this is not working try to use the obsolete camera group and edit some udev rules.
    Should not be necessary when it has worked before systemd and earlier experiences
    But what is this about "Permission issues"?  Here is my listings relative the wiki hints. All seems OK.. or why the heck are there two sessions??
    [leif@krasaki ~]$ ck-list-sessions | grep TRUE
    is-local = TRUE
    active = TRUE
    is-local = TRUE
    [leif@krasaki ~]$ ck-list-sessions
    Session1:
    unix-user = '1000'
    realname = '(null)'
    seat = 'Seat1'
    session-type = ''
    active = FALSE
    x11-display = ''
    x11-display-device = ''
    display-device = '/dev/tty1'
    remote-host-name = ''
    is-local = TRUE
    on-since = '2012-10-24T07:12:56.499847Z'
    login-session-id = '1'
    idle-since-hint = '2012-10-24T07:13:26.994037Z'
    Session2:
    unix-user = '1000'
    realname = '(null)'
    seat = 'Seat1'
    session-type = ''
    active = TRUE
    x11-display = ':0'
    x11-display-device = '/dev/tty7'
    display-device = '/dev/tty1'
    remote-host-name = ''
    is-local = TRUE
    on-since = '2012-10-24T07:13:02.361157Z'
    login-session-id = '1'
    [leif@krasaki ~]$
    As one can see, the ACTIVE values are here as the wiki says. But no camera. Those values are the same, wheter which way the machine is started. But 2 sessions??
    Further reading in the systemd wiki article and consolekit vs systemd.logind gives a clue.
    From the wiki:
    In order to check the status of your user session, you can use loginctl. To see if your user session is properly set up, check if the following command contains Active=yes. All polkit actions like suspending the system or mounting external drives with Udisks should then work automatically.
    So when started via systemd and running logintctl, it gives this surprising result. Does not matter wheter as normal user, nor as root....
    [leif@krasaki ~]$ loginctl
    SESSION UID USER SEAT
    1 1000 leif seat0
    1 sessions listed.
    [leif@krasaki ~]$ loginctl show-session 1
    Id=1
    Timestamp=Wed, 24 Oct 2012 10:57:03 +0200
    TimestampMonotonic=20040019
    DefaultControlGroup=name=systemd:/user/leif/1
    VTNr=1
    TTY=tty1
    Remote=no
    Service=login
    Leader=315
    Audit=1
    Type=tty
    Class=user
    Active=no
    State=online
    KillProcesses=no
    IdleHint=yes
    IdleSinceHint=1351069009642296
    IdleSinceHintMonotonic=6664433
    Name=leif
    [leif@krasaki ~]$
    Surprising? Should it not have been Active=Yes? So something is wrong in my settings although it had worked "before" starting using systemd..
    OK, so far. Lost? Not yet. Double check again everything and I found the culprit, my  ~/.bash_profile which had worked before seemed a bit different to what is suggested in the wiki. The old one, actually started 2 sessions, as also could be seen here above checking ck-list-sessions. That was the problem
    Using a fresh edited ~/.bash_profile as suggested here, the camera is visible graphically
    Finally, just for fun, start again the old initscipt way. Enabling daemon and so on. Still 2 sessions going on....Here it was the "/.xinitrc, which also had some old fashions and I removed the ck-launch-session from the exec line. So even here, now only 1 session..
    Anyway, now the camera is visible, both starting with initscripts, naturally also some daemons active in rc.conf and by starting with systemd.
    I rest my case and it seems systemd works with everything on my machine which is just a normal desktop used by an old man.
    Thanks for reading...

    Solved now! Boot times are as fast as posssible on my HDD I think. Only thing after uninstalling initscripst and initscripts-systemd was that locale was not set inspite of a correct /etc/locale.conf. I had to make /etc/profile.d/locale.sh with this content;
    if [ -s /etc/locale.conf ]; then
    . /etc/locale.conf
    fi
    export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
    export LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
    export LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION

  • Invalid Class Exception problem

    Hi whenever i try to run this method from a different class to the one it is declared in it throws invalid class exception, (in its error it says the class this method is written in is the problem) yet when i run it from its own class in a temporary main it works fine, perhaps someone can see the problem in the method code. All its doing is reading from a few different txt files, deserializing the objects and putting them into arraylists for future access.
    public void readCourseData()
              CourseArrayLengths cal;
              try
                   FileInputStream fis = new FileInputStream("arraylengths.txt");
                   ObjectInputStream ois = new ObjectInputStream(fis);
                   cal = ((CourseArrayLengths) ois.readObject());     
                   ois.close();
                   FileInputStream fis1 = new FileInputStream("units.txt");
                   ObjectInputStream ois1 = new ObjectInputStream(fis1);
                   for(int i=0;i<cal.getUnitArrayLength();i++)
                        units.add((Unit) ois1.readObject());
                   ois1.close();
                   FileInputStream fis2 = new FileInputStream("sections.txt");
                   ObjectInputStream ois2 = new ObjectInputStream(fis2);
                   for(int i=0;i<cal.getSectionArrayLength();i++)
                        sections.add((Section) ois2.readObject());
                   ois2.close();
                   FileInputStream fis3 = new FileInputStream("files.txt");
                   ObjectInputStream ois3 = new ObjectInputStream(fis3);
                   for(int i=0;i<cal.getFileArrayLength();i++)
                        files.add((Filetype) ois3.readObject());
                   ois3.close();
              catch(FileNotFoundException exception)
              System.out.println("The File was not found");
              catch(IOException exception)
              System.out.println(exception);
              catch(ClassNotFoundException exception)
              System.out.println(exception);
         }

    import java.util.ArrayList;
    import java.io.*;
    import javax.swing.*;
    public class Unit implements Serializable
    ArrayList units = new ArrayList();
    ArrayList sections = new ArrayList();
    ArrayList files = new ArrayList();
    String unitName;
    int sStart=0,sEnd=0,sIndex=0,fIndex=0,subIndex=0;
         public Unit(String unitNamec,int sStartc,int sEndc)
              unitName = unitNamec;
              sStart = sStartc;
              sEnd = sEndc;
         public Unit()
         public String getUnitName()
              return unitName;
         public Unit getUnit(int i)
              return (Unit)units.get(i);
         public Section getSection(int i)
              return (Section)sections.get(i);
         public ArrayList getUnitArray()
              return units;
         public int getSectionStart()
              return sStart;
         public int getSectionEnd()
              return sEnd;
         public void setSectionStart(int i)
              sStart = i;
         public void setSectionEnd(int i)
              sEnd = i;
         public void addUnit(String uName)
              units.add(new Unit(uName,sections.size(),sIndex));
              sIndex++;
         public void addSection(String sName,Unit u)
              //problem lies with files.size()
              sections.add(new Section(sName,files.size(),files.size()));
              u.setSectionEnd(u.getSectionEnd()+1);
              //fIndex++;
         public void addFile(String fName,File fPath,Section s)
              files.add(new Filetype(fName,fPath));
              s.setFileEnd(s.getFileEnd()+1);
         public void display(Unit u)
              System.out.println(u.getUnitName());
              for(int i=u.getSectionStart();i<u.getSectionEnd();i++)
                   System.out.println(((Section)sections.get(i)).getSectName());
                   for(int j=((Section)(sections.get(i))).getFileStart();j<((Section)(sections.get(i))).getFileEnd();j++)
                        System.out.println(((Filetype)files.get(j)).getFileName());
         public void writeCourseData()
         //writes 3 arrays to 3 different files
    try
    FileOutputStream fos = new FileOutputStream("units.txt");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
         for(int i=0;i<units.size();i++)
         oos.writeObject((Unit)units.get(i));
         oos.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
    try
    FileOutputStream fos = new FileOutputStream("sections.txt");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
         for(int i=0;i<sections.size();i++)
         oos.writeObject((Section)sections.get(i));
         oos.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
    try
    FileOutputStream fos = new FileOutputStream("files.txt");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
         for(int i=0;i<files.size();i++)
         oos.writeObject((Filetype)files.get(i));
         oos.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
    try
    FileOutputStream fos = new FileOutputStream("arraylengths.txt");
    ObjectOutputStream oos = new ObjectOutputStream(fos);
         oos.writeObject(new CourseArrayLengths(units.size(),sections.size(),files.size()));
         oos.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
         public void readCourseData()
              CourseArrayLengths cal;
              try
                   FileInputStream fis = new FileInputStream("arraylengths.txt");
                   ObjectInputStream ois = new ObjectInputStream(fis);
                   cal = ((CourseArrayLengths) ois.readObject());     
                   ois.close();
                   FileInputStream fis1 = new FileInputStream("units.txt");
                   ObjectInputStream ois1 = new ObjectInputStream(fis1);
                   for(int i=0;i<cal.getUnitArrayLength();i++)
                        units.add((Unit) ois1.readObject());
                   ois1.close();
                   FileInputStream fis2 = new FileInputStream("sections.txt");
                   ObjectInputStream ois2 = new ObjectInputStream(fis2);
                   for(int i=0;i<cal.getSectionArrayLength();i++)
                        sections.add((Section) ois2.readObject());
                   ois2.close();
                   FileInputStream fis3 = new FileInputStream("files.txt");
                   ObjectInputStream ois3 = new ObjectInputStream(fis3);
                   for(int i=0;i<cal.getFileArrayLength();i++)
                        files.add((Filetype) ois3.readObject());
                   ois3.close();
              catch(FileNotFoundException exception)
              System.out.println("The File was not found");
              catch(IOException exception)
              System.out.println(exception);
              catch(ClassNotFoundException exception)
              System.out.println(exception);
         /*public static void main(String args[])
              Unit u1 = new Unit();
              u1.addUnit("Cmps2a22");
              u1.addSection("Section1",u1.getUnit(0));
              //u1.addSubSection("Subsect1",u1.getSection(0));
              u1.addFile("File1",null,u1.getSection(0));
              u1.addFile("File2",null,u1.getSection(0));
              u1.addSection("Section2",u1.getUnit(0));
              u1.addFile("NF",null,u1.getSection(1));
              u1.addFile("NF2",null,u1.getSection(1));
              u1.addFile("NF3",null,u1.getSection(1));
              u1.addSection("Section3",u1.getUnit(0));
              u1.addFile("NF",null,u1.getSection(2));
              u1.addFile("NF2",null,u1.getSection(2));
              u1.addFile("NF4",null,u1.getSection(2));
              u1.display(u1.getUnit(0));
              u1.writeCourseData();
              u1.readCourseData();
              u1.display(u1.getUnit(0));
    import java.util.ArrayList;
    import java.io.*;
    public class Section implements Serializable
    private String sectName,subSectName;
    private int fpStart=0,fpEnd=0,subSectStart=0,subSectEnd=0;
    private Section s;
    private boolean sub;
         public Section(String sectNamec,int fpStartc,int fpEndc,int subSectStartc,int subSectEndc,Section sc,boolean subc)
              sectName = sectNamec;
              fpStart = fpStartc;
              fpEnd = fpEndc;
              subSectStart = subSectStartc;
              subSectEnd = subSectEndc;
              s = sc;
              sub = subc;
         public Section(String sectNamec,int fpStartc,int fpEndc)
              sectName = sectNamec;
              fpStart = fpStartc;
              fpEnd = fpEndc;
         public Section getParent()
              return s;
         public boolean isSub()
              return sub;
         public String getSubName()
              return subSectName;
         public int getSubStart()
              return subSectStart;
         public int getSubEnd()
              return subSectEnd;
         public void setSubStart(int i)
              subSectStart = i;
         public void setSubEnd(int i)
              subSectEnd = i;
         public int getFileStart()
              return fpStart;
         public int getFileEnd()
              return fpEnd;
         public String getSectName()
              return sectName;
         public void setFileStart(int i)
              fpStart = i;
         public void setFileEnd(int i)
              fpEnd = i;
         public void addSection(String sectName)
         /*public static void main(String args[])
    import java.io.*;
    public class Filetype implements Serializable
         private String name;
         private File filepath;
         public Filetype(String namec, File filepathc)
              name = namec;
              filepath = filepathc;
         public String getFileName()
              return name;
         public File getFilepath()
              return filepath;
    import java.io.*;
    public class CourseArrayLengths implements Serializable
    private int ul,sl,fl;
         public CourseArrayLengths(int ulc,int slc,int flc)
              ul = ulc;
              sl = slc;
              fl = flc;
         public int getUnitArrayLength()
              return ul;
         public int getSectionArrayLength()
              return sl;
         public int getFileArrayLength()
              return fl;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.ArrayList;
    import java.io.*;
    public class OrganiserGui implements ActionListener
    int width,height;
    JFrame frame;
         public OrganiserGui()
              width = 600;
              height = 500;
         public void runGui()
              //Frame sizes and location
              frame = new JFrame("StudentOrganiser V1.0");
    frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
              frame.setSize(width,height);
              frame.setLocation(60,60);
              JMenuBar menuBar = new JMenuBar();
              //File menu
              JMenu fileMenu = new JMenu("File");
              menuBar.add(fileMenu);
              fileMenu.addSeparator();
              JMenu addSubMenu = new JMenu("Add");
              fileMenu.add(addSubMenu);
              JMenuItem cwk = new JMenuItem("Coursework assignment");
              addSubMenu.add(cwk);
              JMenuItem lecture = new JMenuItem("Lecture");
              lecture.addActionListener(this);
              addSubMenu.add(lecture);
              JMenuItem seminar = new JMenuItem("Seminar sheet");
              addSubMenu.add(seminar);
              //Calendar menu
              JMenu calendarMenu = new JMenu("Calendar");
              menuBar.add(calendarMenu);
              calendarMenu.addSeparator();
              JMenu calendarSubMenu = new JMenu("Edit Calendar");
              calendarMenu.add(calendarSubMenu);
              JMenuItem eventa = new JMenuItem("Add/Remove Event");
              eventa.addActionListener(this);
              calendarSubMenu.add(eventa);
              JMenuItem calClear = new JMenuItem("Clear Calendar");
              calClear.addActionListener(this);
              calendarSubMenu.add(calClear);
              JMenu calendarSubMenuView = new JMenu("View");
              calendarMenu.add(calendarSubMenuView);
              JMenuItem year = new JMenuItem("By Year");
              year.addActionListener(this);
              calendarSubMenuView.add(year);
              JMenuItem month = new JMenuItem("By Month");
              month.addActionListener(this);          
              calendarSubMenuView.add(month);
              JMenuItem week = new JMenuItem("By Week");
              week.addActionListener(this);
              calendarSubMenuView.add(week);
              //Timetable menu
              JMenu timetableMenu = new JMenu("Timetable");
              menuBar.add(timetableMenu);
              timetableMenu.addSeparator();
              JMenu stimetableSubMenu = new JMenu("Social Timetable");
              timetableMenu.add(stimetableSubMenu);
              JMenu ltimetableSubMenu = new JMenu("Lecture Timetable");
              timetableMenu.add(ltimetableSubMenu);
              frame.setJMenuBar(menuBar);
    frame.setVisible(true);
         public void actionPerformed(ActionEvent e)
              JMenuItem source = (JMenuItem)(e.getSource());
              System.out.println(source.getText());     
              Calendar c = new Calendar();
              if(source.getText().equalsIgnoreCase("By Year"))
                   System.out.println("INSIDE");
                   c.buildArray();
                   c.calendarByYear(Calendar.calendarArray);     
              if(source.getText().equalsIgnoreCase("Add/Remove Event"))
                   c.eventInput();
              if(source.getText().equalsIgnoreCase("clear calendar"))
                   c.buildYear();
                   c.writeEvent(Calendar.calendarArray);
                   c.buildArray();
              if(source.getText().equalsIgnoreCase("lecture"))
                   System.out.println("Nearly working");
                   //JFileChooser jf = new JFileChooser();
                   //jf.showOpenDialog(frame);
                   FileManager fm = new FileManager();
                   //choose unit to add file to
                   JOptionPane unitOption = new JOptionPane();
                   Unit u = new Unit();
                   u.readCourseData();
                   //u.display(u.getUnit(0));
                   System.out.println((u.getUnit(0)).getUnitName());
                   String[] unitNames = new String[u.getUnitArray().size()];
                   for(int i=0;i<unitNames.length;i++)
                        //unitNames[i] = (((Unit)u.getUnitArray().get(i)).getUnitName());
                        //System.out.println(unitNames);
                        System.out.println((u.getUnit(i)).getUnitName());
                   //unitOption.showInputDialog("Select Unit to add lecture to",unitNames);
                   //needs to select where to store it
                   //fm.openFile(jf.getSelectedFile());
         public static void main(String args[])
              OrganiserGui gui = new OrganiserGui();
              gui.runGui();
    java.io.invalidclassexception: Unit; local class incompatible: stream classdesc serialversionUID = 3355176005651395533, local class serialversionUID = 307309993874795880

  • Ranger, a textbased filemanager

    Update:
    There's now an IRC channel, #ranger on freenode!
    Update:
    Check out ranger's github page too: http://github.com/hut/ranger
    There's all the information you need: The README, the source code, a download link.
    Ranger, a filemanager made for comfortable browsing with a text-based user interface. Multiple columns show you a preview and backview, VIM users will find the hotkeys intuitive, though most actions can also be done with arrow keys etc.
    Everything's written in python and licensed under the GNU GPL v3.
    Features:
    * Multi-column display
    * Preview of the selected file/directory
    * Common file operations (create/chmod/copy/delete/...)
    * Quickly find files or text inside files
    * VIM-like console and hotkeys
    * Open files in external programs
    * Mouse support
    * Change the directory of your shell after exiting ranger
    * Bookmarks
    Dependencies:
    * A Unix-like Operating System
    * Python 2.6 or 3.1
    * Python curses module  (often but not always included with Python)
    And here's a screenshot:
    Check out the project page!
    http://nongnu.org/ranger/
    Submit bug reports here (or just post at this forum):
    https://savannah.nongnu.org/bugs/?func= … oup=ranger
    Get the git repository by typing:
    git clone git://git.sv.gnu.org/ranger.git
    Or use the PKGBUILD
    I advise you to read the README and INSTALL file, but for the lazy, here's a download link and quickstart instructions:
    http://git.savannah.gnu.org/cgit/ranger … ter.tar.gz
    cd /the/download/path/
    tar xf ranger-master.tar.gz && cd ranger-master
    ./ranger.py --clean
    (the --clean option makes it leave no traces on your system.)
    There you go. Press ? for help.
    Thanks for reading. Of course I would appreciate any comments and contributions.
    Last edited by hut (2014-10-15 20:10:09)

    JohannesSM64 wrote:how do i get it to open text files in vim ($EDITOR) instead of it asking for which program to use every time?
    It's hard to decide whether a file is a "text file" or not . Now you can either implement some efficient way of doing that, or open all "unknown" files in vim. The latter can be done easily, just change
    if f.document:
    return self.app_editor(c)
    to
    return self.app_editor(c)
    at the end of app_defaults()
    Alternatively, use this as your ~/.ranger/apps.py
    from ranger.defaults.apps import CustomApplications as DefaultApps
    from ranger.api.apps import *
    class CustomApplications(DefaultApps):
    def app_default(self, c):
    return DefaultApps.app_default(self, c) or self.app_editor(c)
    It's not as complicated as it seems. I'm just making a subclass of the original class in apps.py, calling the original method, but in case it returns a zero value ("None", which means it found no suitable application), it falls back to app_editor.
    Runiq wrote:This reminds me of the Mac file manager thingy I've used at work. It was atrocious to work with it using a one-button mouse, but looks very, very promising when using a keyboard.
    In fact, when all I need to do is browse around and start files, I frequently find myself using the mouse ^^. Click where you want to go, click on the preview to execute the file.
    Last edited by hut (2010-03-13 11:32:46)

  • Javac = "cannot find symbol" when compiling class referencing other classes

    I have several Java files in a directory which is declared as a package at the start of the files
    package filemanager;
    This program works perfectly in an IDE, however I'm having problems with compiling in command line.
    I have set the classpath as I understand to be right for my computer to:
    C:\Program Files\Java\jdk1.6.0_02\bin
    I can compile a class that references no other classes in this package/directory.
    However files which reference other classes bring up such errors:
    javac AllFiles.javaAllFiles.java:174: cannot find symbol
    symbol : variable Bob
    location : class filesmanager.AllFiles
    Bob.getItem(itemRef);
    Where Bob is an example of another class. Even though I can say, compile Bob on it's own as it doesnt have any such reference.
    I've tried:
    javac -cp "C:\Program Files\Java\jdk1.6.0_02\bin" AllFiles.javaThis also failed.
    Any ideas?
    Edited by: ajr87 on Feb 8, 2008 10:26 AM

    I've tried spoon_'s suggestion, but I'm still getting the error ("cannot find symbol"). Here is my code:
    File Hello/Fred.java:
    package Hello;
    public class Fred
        public int age;
        public Fred()
            this.age = 1;
    } // public class FredFile Hello/Hello.java:
    package Hello;
    public class Hello
        public static void main(String args[])
            Fred fred = new Fred();
            System.out.println("Fred is " + fred.age);
    } // public class HelloAnd here is my attempt to compile Fred.java and Hello.java:
    C:/Users/levner/programs[219]javac -cp c:\users\levner\programs\hello Hello\Fred.java
    C:/Users/levner/programs[220]javac -cp c:\users\levner\programs\hello Hello\Hello.java
    Hello\Hello.java:14: cannot find symbol
    symbol  : class Fred
    location: class Hello.Hello
            Fred fred = new Fred();
            ^
    Hello\Hello.java:14: cannot find symbol
    symbol  : class Fred
    location: class Hello.Hello
            Fred fred = new Fred();
                            ^
    2 errorsI am doing this work on a PC running Vista using javac 1.6.0_10. I've tried various combinations of upper and lower case names for the package and file names, and I always get the same errors.
    Thanks in advance for your help. David

  • How do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA certfificate i can't open web pages with this, how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC CA certfificate i can't open web pages with this

    how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA ?

    Hi
    I am not suprised no one answered your questions, there are simply to many of them. Can I suggest you read the faq on 'how to get help quickly at - http://forums.adobe.com/thread/470404.
    Especially the section Don't which says -
    DON'T
    Don't post a series of questions in  a single post. Splitting them into separate threads increases your  chances of a quick answer.
    PZ
    www.pziecina.com

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

  • Previewing an image before uploading it using the FileReference class in flex 3

    Previewing an image before uploading it using the FileReference class in flex 3 ?

    hai,
              when this code is used in my application ,i got the name of image and new frame is added each time .But image is not displayed.....
    The code  starts like this
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()"   backgroundColor="white" width="100%" height="100%">
        <fx:Script>
    <![CDATA[ 
                    import mx.controls.Alert;
                    import mx.messaging.Channel;
                    import mx.messaging.ChannelSet;
                    import mx.messaging.channels.AMFChannel;
                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Image;
                    import spark.events.IndexChangeEvent;
                    import mx.managers.DragManager;
      <mx:DataGridColumn headerText="Dimension Value"  width="10" dataField="dimensionValue"/>
                                                   <mx:DataGridColumn headerText="Unit Nmae"  width="10" dataField="dimensionUnitName"/>
                                                   </mx:columns>
                                           </mx:DataGrid>
                                           <mx:Spacer width="2%"/>
                                       </mx:HDividedBox>
                                       </mx:VBox>
                   <mx:Spacer height="0"/>
                <mx:VBox width="100%">
                    <s:HGroup height="90" top="0" left="0" right="0" verticalAlign="justify" gap="10" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5">
                        <s:Button id="btn_loader" top="5" bottom="24" width="100" label="load" click="loadImages()"/>
                        <s:Group width="100%">
                            <s:Group name="cl" top="0" left="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/left.jpg')" top="0" left="0" bottom="0" right="0" fillMode="scale"/>   
                            </s:Group>
                            <s:List id="imgList" skinClass="skins.ListSkin" top="-3" left="27" right="28" bottom="10"
                                    dataProvider="{ImageCollection}" itemRenderer="Image_Render">
                                <s:layout>
                                    <s:HorizontalLayout gap="0"/>
                                </s:layout>
                            </s:List>
                            <s:Group name="cr" top="0" right="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/right.jpg')" top="-1" left="0" bottom="0" right="0" fillMode="scale"/>
                            </s:Group>
                        </s:Group>
                    </s:HGroup>
                    <s:SkinnableContainer id="dropCanvas" top="100" left="5" right="5" bottom="5" backgroundAlpha="1.0" alpha="1.0"
                                          dragEnter="dropCanvas_dragEnterHandler(event)"
                                          dragDrop="dropCanvas_dragDropHandler(event)" contentBackgroundColor="#914E4E" backgroundColor="#F7F7F7">
                    </s:SkinnableContainer>
                </mx:VBox>
                <mx:Spacer height="5"/>
                                      </mx:VDividedBox>
        </mx:Panel>
    </mx:Canvas>

  • Get the values from the bean class?

    Hi Praveen and all can u please suggest in this,
    I have developped an application In that Create One java class that Extends PageProcesscomponenet and utilizing the Bean That have the Connetion method and retriving the query Based on the Logon customer and spoof customer.
    this functionality I have developped in Pageprocessor component.
    The same functinality I am utilizing another java Class that Extends AbstractPortalcomponent  and utilizing the same Bean.
    But the problem both java classes for I used one Jsp only Dynmic spoof customer will come from the JSP Input filed.
    In the new Java Class How can I capture the Event When I click the Buttong the InputField value capturing into the AbstractPortalcomponent Class.
    I tried like this but It comes as Null Value.
    Event event = myContext.getCurrentEvent();
                              if(event!=null)
                                  InputField ip= (InputField) myContext.getComponentForId("spoofCust");
                                  String spoofCust=ip.getValue().toString();
    Please suggest me in this.
    What is wrong with this.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

    Lohitha,
    Try replacing your two lines of code:
    InputField ip= (InputField) myContext.getComponentForId("spoofCust");
    String spoofCust=ip.getValue().toString();
    with:
    InputField ip = (InputField) getComponentByName("spoofCust");     
    String spoofCust = ip.getValueAsDataType().toString();
    Let me know how that works for you.
    -John

  • Get the values from Exception class

    Hi all ..
    In class i have raised one exception
    when i catch this exception in my program i m able to get the
    error message but i need to get all the parameters that i pass
    when i raise the exception ...
    i have raised like this
          RAISE EXCEPTION TYPE cx_bapi_error
            EXPORTING
              textid = cx_bapi_error=>cx_bo_error
              class_name = 'ZHS_'
              log_no = wa_bapi_return-log_no
              log_msg_no = wa_bapi_return-log_msg_no
              t100_msgid = wa_bapi_return-id
              t100_msgno = wa_bapi_return-number
              t100_msgv1 = wa_bapi_return-message_v1
              t100_msgv2 = wa_bapi_return-message_v2
              t100_msgv3 = wa_bapi_return-message_v3
              t100_msgv4 = wa_bapi_return-message_v4
              STATUS = lt_status
    and caught the exception like this in my program
        CATCH cx_bapi_error INTO go_error.
          gd_text = go_error->get_text( ).
          EXIT.
      ENDTRY.
    in this i m just getting the class name which i have passed in exception
    i need all other parameters that i have passed ..
    if u have any idea pls let me know ..
    Thanks in advance ...

    Hello Jayakumar
    Usually the attributes of standard exception classes are defines as <b>public</b> and <b>read-only</b>. Thus, you should be able to use the following coding:
    DATA:
      go_error   TYPE REF TO cx_bapi_error.  " specific exception class !!!
    TRY.
    RAISE EXCEPTION TYPE cx_bapi_error
    EXPORTING
    textid = cx_bapi_error=>cx_bo_error
    class_name = 'ZHS_'
    log_no = wa_bapi_return-log_no
    log_msg_no = wa_bapi_return-log_msg_no
    t100_msgid = wa_bapi_return-id
    t100_msgno = wa_bapi_return-number
    t100_msgv1 = wa_bapi_return-message_v1
    t100_msgv2 = wa_bapi_return-message_v2
    t100_msgv3 = wa_bapi_return-message_v3
    t100_msgv4 = wa_bapi_return-message_v4
    STATUS = lt_status.
    CATCH cx_bapi_error INTO go_error.
    gd_text = go_error->get_text( ).
    WRITE: go_error->t100_msgid,  " perhaps the attributes have different name
                go_error->t100_msgno, " check attribute names in SE24
    EXIT.
    ENDTRY.
    Regards
      Uwe

  • Problem with setContentPane() in JFrame class

    I recently discovered a problem with the setContentPane method in the JFrame class. When I use setContentPane(Container ..), the previously existing contentPane remains in the stack. I have tried nullifying getContentPane(), and all manner of things, but, each time I use setContentPane, I have another instance of a JPanel in the stack.
    I'm using code similar to setContentPane(new CustomJPanel()); and each time the user changes screens, and a similar call to that is made, the old CustomJPanel instance remains in the stack. Can anyone suggest a way around this? On their own the panels do not take up very much memory, but after several hours of usage, they will build up.

    I tried what you suggested; it only resulted in a huge performance decrease. The problem with memory allocation is still there.
    Here is the method I use to switch screens in my app:
    public static void changeScreen (JPanel panel){
              try{
                   appFrame.setTitle("Wordinary : \""+getTitle()+"\"");
                   appFrame.setContentPane(panel);
                   appFrame.setSize(appFrame.getContentPane().getPreferredSize());     
                   appFrame.getContentPane().setBackground(backColour);
                   for (int i = 0; i < appFrame.getContentPane().getComponents().length; i++)
                        appFrame.getContentPane().getComponents().setForeground(textColour);
                   //System.out.println("Background colour set to "+backColour+" text colour set to "+textColour);
                   appFrame.validate();
              catch (Exception e){
                   //System.out.println("change");
                   e.printStackTrace();
    And it is called like this:
    changeScreen(new AddWordPanel());The instantiation of the new instance is what is causing the memory problems, but I can't think of a way around it.

  • Problem with Outer and Inner Classes....or better way?

    Right now I'm trying to create an Inner class.
    My .java file compiles ok, and I create my jar file too.
    But when I try to instantiate the Inner class, it fails:
    java.lang.NoClassDefFoundError: com/myco/vlXML/vlXML$vlDocument.
    Here's the class code:
    public class vlXML{
        private ArrayList myDocList=new ArrayList(); //holds documents
        public vlXML(){
        private class vlDocument{
            public vlDocument(){
            //stuff goes here
        public vlDocument vlDOC(){
            return new vlDocument();
        public void addDocument(){
            vlXML xxx=new vlXML();
            vlDocument myDoc=xxx.vlDOC();
            myDocList.add(myDoc);
        public int getNumDocs(){
            return myDocList.size();
    }Then, from a jsp page, I call:
    vlXML junk1=new vlXML();
    junk1.addDocument();...and get the error...
    Can someone help me figure out why it's failing?
    Thanks....

    You nailed it - thanks....(duh!)
    While I have your attention, if you don't mind, I have another question.
    I'm creating a Class (outer) that allows my users to write a specific XML file (according to my own schema).
    Within the XML file, they can have multiple instances of certain tags, like "Document". "Document"s can have multiple fields.
    Since I don't know how many "Documents" they may want, I was planning on using an Inner Class of "Document", and then simply letting them "add" as many as necessary (thus the original code posted here).
    Does that seem like an efficient (logical/reasonable) methodology,
    or is there there something better?
    Thanks Again...

  • JBO:33001 bc4j.xcfg file not found in class path

    Hi,
    I am yet another victim of the age-old error JBO:33001 bc4j.xcfg file not found in class path, When i have my BC4JApp.jar in Tomcat Web-inf/lib directory. All the other jar files and class files in my webserver-application web-inf classes and lib directory works.
    But Tomcat server is not able to read this bc4j.xcfg file. I can see in my jar file that this bc4j.xcfg exists and in the specified package directory. still the problem persists. My BC4JApp.jar is perfectly working when i use JDeveloper. but not when i use tomcat4.0 and call a JSP using BC4JApp.jar from browser (My environment is Jdeveloper3.2, Tomcat4.0+IIS in middle tier and oracle 8i as DB, everything on windows2k)
    I have gone through almost all the threads possible that relates to this error in this form. None of them have a answer except to say "put the file in classpath". and last reply is "will fix in jDeveloper 9i. So what happens to us who are working in Jdeveloper 3.2?
    1. I have this file in my jar file.
    2. I also tried creating a seperate directory manually, with the same name as my package under web-inf/classes, web-inf/lib , just under web-inf directory and atlast under approot directory also. I tried having my package directory containing bc4j.xcfg in these folders one at a time and also tried having this directory in all these folders at the same time.
    Still no solution.
    Itz frustrating that neither proper documentation nor a right url page nor i am aware of available addressing this. page links given in above threads only gives me the wonderful page of ie's "Page cannot be displayed".
    Is there a answer to this error and my problem. If this doesn't work, then i have to all the way develop from scratch creating my jsp using JDBC calls and Stored packages etc.
    I don't want to give up on this Jdeveloper at this final moment because if this bc4j.xcfg file is found, my application will work perfectly. on these final moments, if this doesn't work, i am frightened to imagine to develop my application in standard way. Atlast, if thatz the option left,we have to do that bcos our production date is close by.
    Please can some one in this forum or Jdeveloper help me to solve this problem. I am desperate and very urgent.
    Waiting for a reply from Jdev team very much...
    ( I just posted in the other thread which is pretty old, dated backto May 2001, which was relevant to this error. Just to make sure it is noticed, I am posting it seperately too)
    Thanks
    Hari(2/3/02)

    Hi All,
    For those who are following this thread, I got a solution for this error with the help of Jdev Team.
    This solution may work, if you have deployed your application in Tomcat4.0.1. This is the environment in which I work and tested.
    As you may be aware, Tomcat ignores value in CLASSPATH variable.
    To see any files that are existing or newly deployed, it has it own way of detecting it.
    Addition information on Tomcat working, you can follow this link,
    http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html
    Coming to point, Tomcat has got five classloaders and each classloader invoked, looks in their related directories for files in following order.
    1. /WEB-INF/classes of your web-application
    2. /WEB-INF/lib/*.jar of your web application
    3. BootStrap classes of your JVM (Tomcat's $JAVA_HOME/jre/lib/ext)
    4. System class loader classes($CATALINA_HOME/bin/bootstrap.jar,CATALINA_HOME/lib/tools.jar)
    5. $CATALINA_HOME/common/classes
    6. $CATALINA_HOME/common/lib/*.jar
    7. $CATALINA_HOME//classes
    8. $CATALINA_HOME/lib/*.jar
    So All your individual application related files should be deployed in your application's WEB-INF/classes or WEB-INF/lib directory accordingly.
    If your application files are unpacked, they should be deployed or copied under WEB-INF/classes directory
    if the files are within a jar, they should be under WEB-INF/lib directory.
    If your Jar-files contains bc4j components, then those jar files should be deployed under WEB-INF/lib directory. Also,do the next step to copy all relavant BC4J runtime libraries under lib directory.
    IMPORTANT: Please remember to copy and paste all the required BC4j runtime libraries in the Same WEB-INF/lib directory along with your application jar files. This is the real reason which can solve this JBO:33001 to disappear. It worked for me.
    To configure your directory for tag-lib uri's, use web.xml to set the taglib-uri attribute.
    Put your web.xml and DataTags.tld in the WEB-INF directory.
    Your simple web.xml may look like as follows.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
         <taglib>
              <taglib-uri>
                   /webapp/DataTags.tld
              </taglib-uri>
              <taglib-location>
                   /WEB-INF/DataTags.tld
              </taglib-location>
         </taglib>
    </web-app>
    You may then modify this web.xml to suit further requirements of your application.
    Remember to stop and restart the Tomcat Server (service) by using shutdown and startup scripts after updating any jar files/class files/ JSP or source files deployed in Tomcat.
    Sometimes, only this helps even though your context's reloadable attribute is set to true in Tomcat Server's server.xml file.
    Hope this above information helps you to solve this error in Tomcat environment. My Sincere thanks once again to Juan and Jdev team for their help and efforts to solve this problem.
    Thanks
    Hari

  • Help Counting Vowels and Consonants using a class

    I'm currently working on a class project where I need take a user inputed string and count how many vowels and/or consonants are in the String at the user discretion. I have the main logic program working fine. However, the trouble I'm running into is how to take the string the user inputed and pass that data into the class method for counting.
    Here is the code for the program:
    package vowelsandconsonants;
    import java.util.Scanner;
    public class VowelConsCounter {
        public static void main(String[] args) {
            String input; //User input
            char selection; //Menu selection
            //Create a Scanner object for keyboard input.
            Scanner keyboard = new Scanner(System.in);
            //Get the string to start out with.
            System.out.print("Enter a string: ");
            input = keyboard.nextLine();
            //Create a VowelCons object.
            VowelCons vc = new VowelCons(input);
            do {
                // Display the menu and get the user's selection.
                selection = getMenuSelection();
                // Act on the selection
                switch (Character.toLowerCase(selection)) {
                    case 'a':
                        System.out.println("\nNumber of Vowels: " +
                                vc.getNumVowels());
                        break;
                    case 'b':
                        System.out.println("\nNumber of consonats: " +
                                vc.getNumConsonants());
                        break;
                    case 'c':
                        System.out.println("\nNumber of Vowels: " +
                                vc.getNumVowels());
                        System.out.println("Number of consonants: " +
                                vc.getNumConsonants());
                        break;
                    case 'd':
                        System.out.print("Enter a string: ");
                        input = keyboard.nextLine();
                        vc = new VowelCons(input);
            } while (Character.toLowerCase(selection) != 'e');
         * The getMenuSelection method displays the menu and gets the user's choice.
        public static char getMenuSelection() {
            String input;  //To hold keyboard input
            char selection;  // The user's selection
            //Create a Scanner object for keyboard input.
            Scanner keyboard = new Scanner(System.in);
            //Display the menu.
            System.out.println("a) Count the number of vowels in the string.");
            System.out.println("b) Count the number of consonants in the string.");
            System.out.println("c) Count both the vowels and consonants in the string.");
            System.out.println("d) Enter another string.");
            System.out.println("e) Exit the program.");
            //Get the user's selection
            input = keyboard.nextLine();
            selection = input.charAt(0);
            //Validate the input
            while (Character.toLowerCase(selection) < 'a' ||
                    Character.toLowerCase(selection) > 'e') {
                System.out.print("Only enter a,b,c,d or e:");
                input = keyboard.nextLine();
                selection = input.charAt(0);
            return selection;
    class VowelCons {
        private char[] vowels;
        private char[] consonants;
        private int numVowels = 0;
        private int numCons = 0;
        public VowelCons(String str) {
        public int getNumVowels() {
            return numVowels;
        public int getNumConsonants() {
            return numCons;
        private void countVowelsAndCons() {
            for (int i = 0; i < total; i++) {
                char ch = inputString.charAt(i);
                if ((ch == 'a') || (ch == 'A') || (ch == 'e') || (ch == 'E') || (ch == 'i') || (ch == 'I') || (ch == 'o') || (ch == 'O') || (ch == 'u') || (ch == 'U')) {
                    numVowels++;
                } else if (Character.isLetter(ch)) {
                    numCons++;
    }The UML given to me by my instructor calls for the counting method to be private. Being that I'm not too familiar with Java syntax I did not know if that may cause a problem with passing the user's input into that method.

    Well the only compilers i get are due to the code:
    private void countVowelsAndCons() {
            for (int i = 0; i < total; i++) {
                char ch = inputString.charAt(i);
                if ((ch == 'a') || (ch == 'A') || (ch == 'e') || (ch == 'E') || (ch == 'i') || (ch == 'I') || (ch == 'o') || (ch == 'O') || (ch == 'u') || (ch == 'U')) {
                    numVowels++;
                } else if (Character.isLetter(ch)) {
                    numCons++;
        }However, that is due to the fact that i have no data for those variables to use. I'm pretty much stuck on how to get the string the user inputs into that method shown above so the code can perform the task of counting the vowels and consonants.
    If i comment out the code within that function the program compiles and will allow me to enter the string and use the options but since i can't figure out how to pass the input to the counting method the program returns 0 for everything.

Maybe you are looking for

  • Just few issues left for a full complete Gnome-Arch :D.

    This is the first time with arch, actually i did try earlier, but could never get it to boot. Never figured out how to handle a seperate /boot. This time everything in single "/". I am using thinkpad T61, with nvidia quadro 140NVS, T9300, intel 4635

  • Windows Vista Beta

    HomeSite and Windows Vista Beta: I have used homeSite almost from its initial release many years ago. Version 5.0 has been loaded and reloaded on I think 3 platforms now, maybe four. I have recently installed windows Vista Beta and was deeply distres

  • Can not find xslt mapper

    Hi , I need to use the xslt mapper to transform the xml from site A to the xml structure that site B can accept. The documents mention that the xslt mapper is the new featrue for JDeveloper. I download the 11GR2 from Oracle and can not find the tool

  • FTP link for SAP NetWeaver 7.0 - Java Trial Version on Linux - VMware Editi

    Is there a FTP url I can use to download SAP NetWeaver 7.0 - Java Trial Version on Linux - VMware Edition? TIA

  • N 95 KEYPAD NOT FUNCTIONAL

    I am facing a peculiar problem as none of my keypad buttons including call answer/reject, d pad, menu and short buttons are responding. I've tried hard rsetting couple of times but to no avail. However I am able to answer incoming calls by sliding th