RMI -How to use JFileChooser to see remote computer FileSystem

i hav made a program in RMI which uses JFileChooser to show remote-machine File System. i have made my own FileSyatemView class (MyFileSyatemViewClient which extends FileSystemView) and override all the methods of FileSystemView Except getFileSystemView.
Similarly i have made my own FileView(MyFileViewClient).
i fed these to the JFileChooser. And object of JFileChooser i am recieving from the server through remote method getFileChooser(). Thus the code is like:
                         MyFileSystemViewClient mfsvc; //Defined Globally
                         MyFileViewClient mfvc; //Defined Globally
public void actionPerformed(ActionEvent ae)
if(ae.getActionCommand().equals("Open"))
                         mfsvc = new MyFileSystemViewClient();
                         mfvc = new MyFileViewClient();
try
JFileChooser jfc=fi.getFileChooser();
// "fi" is the FileInterface through which we access server-side methods.
                              jfc.setFileSystemView(mfsvc);
                              jfc.setFileView(mfvc);                              
                              int retval = jfc.showOpenDialog(null);
                              if(retval==JFileChooser.APPROVE_OPTION)
                                   getf = jfc.getSelectedFile();
                         catch(Exception e)
                              System.out.println("Error Occurred In OPEN :"+e);
MyFileSystemViewClient class looks as :
public class MyFileSystemViewClient extends FileSystemView
               public MyFileSystemViewClient()
                    //super();
                    try{
                    fi.invokeMyFileSystemViewCons();
                    }catch(Exception e){
                         System.out.println("Error in invokeMyFileSystemViewCons : "+e);
               public File[] getFiles(File file,boolean tr)
                    try{
                    return fi.getFiles(file,tr);
                    }catch(Exception e){
                         System.out.println("Error in getFiles : "+e);
                         return null;}
               public File getHomeDirectory()
                    try{
                    return fi.getHomeDirectory();
                    }catch(Exception e){
                         System.out.println("Error in getHomeDirectory : "+e);
                         return null;}
               public File getParentDirectory(File dir)
                    try{
                    return fi.getParentDirectory(dir);
                    }catch(Exception e){
                         System.out.println("Error in getParentDirectory : "+e);
                         return null;}
               public File[] getRoots()
                    try{                         
                    return fi.getRoots();                    
                    }catch(Exception e){
                         System.out.println("Error in getRoots : "+e);
                         return null;}
               public File getDefaultDirectory()
                    try{
                    return fi.getDefaultDirectory();
                    }catch(Exception e){
                         System.out.println("Error in getDefaultDirectory : "+e);
                         return null;}
               public File createNewFolder(File containingDir)
                    try{
                    return fi.createNewFolder(containingDir);
                    }catch(Exception e){
                         System.out.println("Error in createNewFolder : "+e);
                         return null;}
               public String getSystemDisplayName(File f)
                    try{
                    return fi.getSystemDisplayName(f);
                    }catch(Exception e){
                         System.out.println("Error in getSystemDisplayName : "+e);
                         return null;}
               public String getSystemTypeDescription(File f)
                    try{
                    return fi.getSystemTypeDescription(f);
                    }catch(Exception e){
                         System.out.println("Error in getSystemTypeDescription : "+e);
                         return null;}
               public File getChild(File parent, String fileName)
                    try{
                    System.out.println("Child FIle : "+fi.getChild(parent,fileName));
                    return fi.getChild(parent,fileName);
                    }catch(Exception e){
                         System.out.println("Error in getChild : "+e);
                         return null;}
               public boolean isParent(File folder,File file)
                    try
                         return fi.isParent(folder,file);
                    catch(Exception e)
                    System.out.println("Error in isParent : "+e);
                         return false;     
               public Icon getSystemIcon(File f)
                    try{
                    return fi.getSystemIcon(f);
                    catch(Exception e)
                    System.out.println("Error in getSystemIcon : "+e);
                         return null;     
               public boolean isDrive(File dir)
                    try{
                    return fi.isDrive(dir);
                    catch(Exception e)
                    System.out.println("Error in isDrive : "+e);
                         return false;     
               public boolean isFileSystem(File f)
                    try{
                    return fi.isFileSystem(f);
                    catch(Exception e)
                    System.out.println("Error in isFileSystem : "+e);
                         return false;     
               public boolean isFileSystemRoot(File dir)
                    try{
                    return fi.isFileSystemRoot(dir);
                    catch(Exception e)
                    System.out.println("Error in isFileSystemRoot : "+e);
                         return false;     
               public boolean isFloppyDrive(File dir)
                    try{
                    return fi.isFloppyDrive(dir);
                    catch(Exception e)
                    System.out.println("Error in isFloppyDrive : "+e);
                         return false;     
               public boolean isRoot(File f)
                    try{
                    return fi.isRoot(f);
                    catch(Exception e)
                    System.out.println("Error in isRoot : "+e);
                         return false;     
               public Boolean isTraversable(File f)
                    try{
                    return fi.isTraversable(f);
                    catch(Exception e)
                    System.out.println("Error in isTraversable : "+e);
                         return null;     
//.....................................................End of the MyFileSystemViewClient.......................
Thus each method in the class MyFileViewClient brings the required information from the server. BUT we are getting two problems:
1) so many folders at the server-side are shown as files in the dialogbox.
2)dialog box shows all "folders of the desktop" of the local filesystem and some more "local drives without any name". when i click a folder in the dialog box which is on my local machine, nothing happens. they are just the icon with the name but don't show the content. although i can easily see the drives of the remote filesystem and browse through except for the problem stated above at no.1.
ok guys now its your turn to speak up.....
plz give some suggestions and comments..
ciao!!

sry to all friends there who can't read the code clearly. as per the suggestion i am putting the code afresh..
the main client class which binds to the server contains following piece of code :
MyFileSystemViewClient mfsvc; //Defined Globally
MyFileViewClient mfvc; //Defined Globally
public void actionPerformed(ActionEvent ae)
     if(ae.getActionCommand().equals("Open"))
          mfsvc = new MyFileSystemViewClient();
          mfvc = new MyFileViewClient();
          try
               JFileChooser jfc=fi.getFileChooser();//Requesting JFileChooser object from server.
               // "fi" is the FileInterface through which we access server-side methods.
               jfc.setFileSystemView(mfsvc);
               jfc.setFileView(mfvc);
               int retval = jfc.showOpenDialog(null);
               if(retval==JFileChooser.APPROVE_OPTION)
               getf = jfc.getSelectedFile();
          catch(Exception e)
          System.out.println("Error Occurred In OPEN :"+e);
}i again like to convey that, "fi" is the FileInterface through which we access server-side methods.
MyFileSystemViewClient class looks as :
public class MyFileSystemViewClient extends FileSystemView
               public MyFileSystemViewClient()
                    //super();
                    try{
                    fi.invokeMyFileSystemViewCons();
                    }catch(Exception e){
                         System.out.println("Error in invokeMyFileSystemViewCons : "+e);
               public File[] getFiles(File file,boolean tr)
                    try{
                    return fi.getFiles(file,tr);
                    }catch(Exception e){
                         System.out.println("Error in getFiles : "+e);
                         return null;}
               public File getHomeDirectory()
                    try{
                    return fi.getHomeDirectory();
                    }catch(Exception e){
                         System.out.println("Error in getHomeDirectory : "+e);
                         return null;}
               public File getParentDirectory(File dir)
                    try{
                    return fi.getParentDirectory(dir);
                    }catch(Exception e){
                         System.out.println("Error in getParentDirectory : "+e);
                         return null;}
               public File[] getRoots()
                    try{                         
                    return fi.getRoots();                    
                    }catch(Exception e){
                         System.out.println("Error in getRoots : "+e);
                         return null;}
               public File getDefaultDirectory()
                    try{
                    return fi.getDefaultDirectory();
                    }catch(Exception e){
                         System.out.println("Error in getDefaultDirectory : "+e);
                         return null;}
               public File createNewFolder(File containingDir)
                    try{
                    return fi.createNewFolder(containingDir);
                    }catch(Exception e){
                         System.out.println("Error in createNewFolder : "+e);
                         return null;}
               public String getSystemDisplayName(File f)
                    try{
                    return fi.getSystemDisplayName(f);
                    }catch(Exception e){
                         System.out.println("Error in getSystemDisplayName : "+e);
                         return null;}
               public String getSystemTypeDescription(File f)
                    try{
                    return fi.getSystemTypeDescription(f);
                    }catch(Exception e){
                         System.out.println("Error in getSystemTypeDescription : "+e);
                         return null;}
               public File getChild(File parent, String fileName)
                    try{
                    System.out.println("Child FIle : "+fi.getChild(parent,fileName));
                    return fi.getChild(parent,fileName);
                    }catch(Exception e){
                         System.out.println("Error in getChild : "+e);
                         return null;}
               public boolean isParent(File folder,File file)
                    try
                         return fi.isParent(folder,file);
                    catch(Exception e)
                    System.out.println("Error in isParent : "+e);
                         return false;     
               public Icon getSystemIcon(File f)
                    try{
                    return fi.getSystemIcon(f);
                    catch(Exception e)
                    System.out.println("Error in getSystemIcon : "+e);
                         return null;     
               public boolean isDrive(File dir)
                    try{
                    return fi.isDrive(dir);
                    catch(Exception e)
                    System.out.println("Error in isDrive : "+e);
                         return false;     
               public boolean isFileSystem(File f)
                    try{
                    return fi.isFileSystem(f);
                    catch(Exception e)
                    System.out.println("Error in isFileSystem : "+e);
                         return false;     
               public boolean isFileSystemRoot(File dir)
                    try{
                    return fi.isFileSystemRoot(dir);
                    catch(Exception e)
                    System.out.println("Error in isFileSystemRoot : "+e);
                         return false;     
               public boolean isFloppyDrive(File dir)
                    try{
                    return fi.isFloppyDrive(dir);
                    catch(Exception e)
                    System.out.println("Error in isFloppyDrive : "+e);
                         return false;     
               public boolean isRoot(File f)
                    try{
                    return fi.isRoot(f);
                    catch(Exception e)
                    System.out.println("Error in isRoot : "+e);
                         return false;     
               public Boolean isTraversable(File f)
                    try{
                    return fi.isTraversable(f);
                    catch(Exception e)
                    System.out.println("Error in isTraversable : "+e);
                         return null;     
//--------------------------------------------------------------------

Similar Messages

  • Can someone tell me how to use 2 ipods on one computer

    well when anyone can ill be waiting for the answer i want to know cuz since im buying the ipod video i want to see if i can use the same computer that im uploading stuff to my ipod mini

    There is no limit to how many iPods can run on a single PC. Or how many PCs a single iPod can connect to. Either by Apple design or by any legal issues.
    These links should help:
    Natalie Beresford: Multiple iPods/iTunes Installations
    How to use multiple iPods with one computer
    How to share music between different accounts on a single computer

  • How to get hostname of a remote computer by ip

    how to get hostname of a remote computer by ip

    In InetAddress class we have a method
    public String getHostName() which returns the name of the host. If applet security prevents the name, the same ipaddress entered is returned back.
    This program is the implementation of this method:
    import java.net.*;
    public class ipdemo
    public static void main(String arg[])
    try
    InetAddress add=InetAddress.getByName("207.228.236.39");
    System.out.println(add.getHostName());
    catch(UnknownHostException e)
    System.out.println("Exception raised");
    This will help you.
    Regards.
    Deepa Datar

  • How to use my apple tv remote on my macbook?

    Hello, I have an Macbook pro 15 inch retina from 2013 (model number A 1398) and I want to use my apple tv remote on my macbook. But it won't work. When I look on the internet, they say I have to go to system preference -> security and privacy and then you can find your infrared but mine don't show the infrared.
    So can somebody help me to use my remote on my macbook please?

    I do not believe that the newer Mac's support this. You should look at the front bezel and see if it has an IR sensor. If it does, follow the instructions here:
    http://support.apple.com/kb/ht1619
    or
    http://support.apple.com/kb/PH14075

  • How to use JFileChooser to get filename of mutifile???

    Hi,
    I tryed to use JFileChooser to open multiple files and I want to save name of selected files in to array of String
    I have writen some code but it doesn't work
    My question is how can I get the filenames as a string array from
    "getSelectedFiles". Any comments are highly welcomed! Thanks a lot. If yes pls give to me some code
    Nguyen Thanh Ba

    hope this will help
    http://java.sun.com/developer/JDCTechTips/2004/tt0316.html

  • How to use JNDI to lookup remote EJB Home?

    Hello,
    I am writing a servlet to call a remote EJB on another machine.
    I use JNDI to lookup remote EJBHome (not) but fail.
    Any advice?
    Any trick to configure application-client.xml?
    Thanks!

    Use com.evermind.server.rmi.RMIInitialContextFactory instead
    Here an example
    // EmployeeClient.java
    package mypackage5;
    import javax.ejb.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import java.io.*;
    import java.util.*;
    import java.rmi.RemoteException;
    import com.evermind.server.ApplicationClientInitialContextFactory;
    import com.evermind.server.rmi.RMIInitialContextFactory;
    * A simple client for accessing an EJB.
    public class EmployeeClient
    public static void main(String[] args)
    System.out.println("EmployeeClient.main(): client started...");
    try
    * initialize JNDI context by setting factory, url and credential
    * in a hashtable
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    //env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
    env.put(Context.PROVIDER_URL, "ormi://koushikm:23791/application4");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "admin");
    * or set these properties in jndi.properties
    * or use container defaults if that's where client got launched from
    Context context = new InitialContext(env);
    * Lookup the EmployeeHome object. The reference is retrieved from the
    * application-local context (java:comp/env). The variable is
    * specified in the assembly descriptor (META-INF/application-client.xml).
    Object homeObject =
    context.lookup("HelloEJB");
    System.out.println("EmployeeClient.main(): bean found...");
    // Narrow the reference to EmployeeHome.
    HelloEJBHome home =
         (HelloEJBHome) PortableRemoteObject.narrow(homeObject,
    HelloEJBHome.class);
    System.out.println("EmployeeClient.main(): home narrowed...");
    // Create remote object and narrow the reference to Employee.
    HelloEJB remote =
         (HelloEJB) PortableRemoteObject.narrow(home.create(), HelloEJB.class);
    System.out.println("EmployeeClient.main(): remote created...");
    String message=remote.helloWorld("SUCCESS");
    System.out.println(message);
    } catch(NumberFormatException e) {
    System.err.println("NumberFormatException: " + e.getMessage());
    } catch(RemoteException e) {
    System.err.println("RemoteException: " + e.getMessage());
    } catch(IOException e) {
    System.err.println("IOException: " + e.getMessage());
    } catch(NamingException e) {
    System.err.println("NamingException: " + e.getMessage());
    } catch(CreateException e) {
    System.err.println("CreateException: " + e.getMessage());
    Hello,
    I am writing a servlet to call a remote EJB on another machine.
    I use JNDI to lookup remote EJBHome (not) but fail.
    Any advice?
    Any trick to configure application-client.xml?
    Thanks!

  • Help wanted - step by step process on how to use two ipods on one computer

    I'm just in the process of getting an ipod (waiting on delivery!) and want to know how it is possible to have two ipods using the same computer but synchronizing differently. I don't want to risk losing my partners music (he'll be very upset!) and I don't want to end up with his music on my ipod. I'd appreciate it if someone could give me a step by step guide or tell me where the best place to look for the answer is. Is it possible somehow to have two different libraries on one computer? Is that how it works?

    There are a couple of methods for using more than one iPod on a single computer. Have a look at the article linked below. Method one is to have two Mac or Windows user accounts which by definition would give you two completely separate libraries. Method two as Chris has already described above is to set your preferences so each iPod is updated with only certain playlists within one library. Have a look anyway and see what you think and go for whichever you feel suits your needs best: How To Use Multiple iPods with One Computer

  • How to get Mac Address of Remote Computer

    Hi All,
    I tried to find out a solution for finding Mac Address of a remote system, then first i tried with finding it with local address using the following code it works fine for me.
    public class MacAddressFinder {
         public static void main(String[] args) {
              try
                   InetAddress ipAddr = InetAddress.getLocalHost();
                   System.out.println("Current IP address : " + ipAddr.getHostAddress());
                   NetworkInterface nwIntf;
                   try
                        nwIntf = NetworkInterface.getByInetAddress(ipAddr);
                        byte[] hwAddr = nwIntf.getHardwareAddress();
                        System.out.print("Current MAC address : ");
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i < hwAddr.length; i++)
                             sb.append(String.format("%02X%s", hwAddr, (i < hwAddr.length - 1) ? "-" : ""));          
                        System.out.println(sb);
                   } catch (SocketException e) {
                        e.printStackTrace();
              catch (UnknownHostException e) {
                   e.printStackTrace();
    But when i tried this piece of code in jsp with the following code i am getting NeworkInterface object value as null and there by i am unable to get the Mac Address of a remote computer.
    InetAddress ipAddr = InetAddress.getByName(request.getRemoteAddr());
    NetworkInterface nwIntf = NetworkInterface.getByInetAddress(ipAddr);Can you please suggest me how to find out the Mac address of remote system?
    Thanks,
    Uday

    first of all, NetworkInterface only exposes the NetworkInterfaces of the local computer. secondly, you cannot find the mac address of an arbitrary remote computer. that information is not available outside of the local subnet. and java doesn't expose a way to discover it even for computers on the local subnet.

  • How to use multiple tape drive for single filesystem on single client.

    Hello All.
    I want to backup single filesystem with multiple tape drive.
    Incase of Symantec veritas netbackup "NEW_STREAM" for multi-stream backup.
    Backup client has a  single backup filesystem like /data1  directory with 4 LTO6 drives.
    /data1 directory doesn't have a sub-direcotry, just present a files.
    If /data1 directory has a sub-directory like /data1/aaa, /data1/bbb, /data1/ccc , Is it possible to use multiple drives?
    Please anybody answer the questions.
    Thanks advanced.

    See how to use multiple tape drive from single client when I want to backup single filesystem?

  • How to use an Aggregate in a Computation on an Interactive Report?

    version 4.0.2.00.07
    Hello,
    I'm trying to create a computation on an Interactive Report from the Actions menu to compute a percentage.
    I have two Status columns, one for open and one for closed. I have to count the number of open and count the number of closed and then divide the two.
    I created an aggregate, count, on the open status and closed status, but how to use them in the computation? There's no 'count' in the Function list in the Compute box.
    I was hoping that those aggregated columns would be displayed in the Compute sub-menu on the Actions button but they don't appear to be.
    Can someone help me with this?
    Thanks,
    Joe

    Maybe an alternative would be to put this logic into the select.
    select u.object_name,
           u.object_type,
           count(case when u.object_type = 'TABLE' then 1 end) over () count_tables,
           count(case when u.object_type = 'VIEW' then 1 end) over () count_views
    from user_objects u;This would count the number of tables and views in the data dictionary. And it is returned as a column value.

  • How to use 2 iPods in 1 computer

    How can I use 2 iPods in one computer using the same library but using different playlists?

    Hello JoeBonsai here is a article that should help you out with this question.
    http://docs.info.apple.com/article.html?artnum=300432
    - Nathanm
    MacBook | 2.0 Ghz | 2 GB Ram   Mac OS X (10.4.8)  

  • How to use JFileChooser to select only hard drive?

    I am doing CD update. I am using a component called "JFileChooser". I use this component to let user choose a Hard Drive or Floopy. When I try this component, and if I choose a hard drive and a folder/file, it works. If I only choose hard drive, it will return "My Documents"??? I cann't get hard drive. How to set up JFileChooser so user only choose hard drive and it will return this hard drive. Thanks for help.
    Gary

    Easiest (and maybe most portable) way is to have a specific file in your root directory of the CDROM. You could use java.io.File.listRoots() to get all drives and then pick the one that has your file.
    This will enable the user to copy the CDROM to a hard drive (easier for testing also) or mount a remote CDROM.

  • How to use iPhone as a remote?

    Okay I have a first generation Apple TV and I am almost sure that I can use my iPhone to control my ATV as a remote. I know I have done it with my iPod touch a few years ago but can't remember how to set it up. I have the iPhone 4S. I do have Home Sharing turned on but I am not sure if that is compatible on the first generation. I also have the Remote App on both devices but again I am not sure if that is compatible or not.

    http://support.apple.com/kb/HT1947

  • How to use JFileChooser

    Hi friends.. I developed my entire java application in an exe. If i click that exe,a JFrame window opened in that JFileChooser dialog box opened.Using that JFileChooser iam selecting a folder.In that folder i need to save my jar file which is encapsulated with exe.i need to store that jar file in that selected location.can anyone know how to save the jar file within the exe to the required location of the hard disk.Thanks in advance...

    I guess he want to write the jar-file ... and don't know how to get this.
    When the app is only an exe.
    By the way for storing only some kind of file-object you can
    use a FileOutputStream as bsampieri wrote.
    Olek

  • How to use new aluminum apple remote with an imac

    How does it work?  Menu button doesn't seem to do anything.  I paired it io and got the linking chain icon.  The volume up down works, and sometimes the left right buttons move itunes to the next selection, but that's it.  I was not able to find an online articel

    You can load your RAW images to any iPad either using the Camera Connection kit that comes with two dongles. One for inserting an SD card from your camera to load the images. Or the USB dongle which you can connect the USB cord for your camera to the iPad to load the images. There are a few CF card readers that will work with the iPad if your camera uses those a Google search will feret them out for you. Additionally, you can also load images to iPad, iPhone or iPod touch (as well as laptops and desktop cumputers) using WiFi as you capture them using an EyeFi SD card.
    http://www.eye.fi/
    A good app for working with EyeFi on the iPad is Shuttersnitch (though, it does not coordinate with Lightroom)
    http://www.shuttersnitch.com/
    Unfortunately their isn't any RAW processing image editing software for the iPad that Lightroom can make use of the edits. Though there is an app called Photosmith that will allow you to rate, label, add keywords etc. then you can upload that info to Lightroom on your laptop or desktop cimputer and have that info synced to the images. You do have to transfer the image files themselves from the iPad to your workstation seperately.
    http://www.photosmithapp.com/

Maybe you are looking for

  • Transfer of PIR from ECC to APO - Time stamp

    Hi Friends, We are transferring Planned Independent requirements from ECC to APO through CIF. In APO Product view Forecast requirements Date is sync fine with ECC date however the time is setting default to 03:00:00 am. we want the time to be set to

  • Sybase iq data source for essbase

    Hi, We're trying to build cube from sybase IQ. Since I cannot find a specific SYBASE IQ driver, i used the sybase driver (ARase22.so) to create a SYBASE IQ data source in the odbc.ini file. Below is the error message I got when tried to do a query us

  • Dynamic - Web Service Call

    Hi All I am working on 12.2.3 build 165. I am trying to call web service dynamically providing url at the run time.. I tried using wizard way- giving url, then selecting operation and it works fine. But is it possible to give url as input at run time

  • Change in the behaviour of the value assignment type after the ECC upgrade

    Hello Team, We have recently upgraded our system to ECC 6. In the older version of SAP whenever we try to open a phrase related property (in a particular substance specification) it used to give a warning message upfront in case any of the phrases us

  • Partner with Partner role AP  cannot be converted

    Hi, When order are getting created in CRM, we are getting an error 'Partner with partner role AP cannot be converted'. We have checked the R/3 contact person and it is empty.   We have checked the table CRMC_BUT_CALL_FU  and tried removing the entry