Java code to list files in Windows O/S by FIFO sequence

Hi,
I am new to java and working on a project which needs to list files from Windows O/S by FIFO sequence.
Here is the scenario,
One of the application logs/stores files in Windows System. After that files has to be moved to another files system on AS/400 by FIFO sequence.
I need to write java program to list files in Windows (by FIFO) and then move to different application running on AS/400.
I am using java.io.File class and method list() and could able to list all files. But, not able to list files by FIFO sequence.
I would appreciate to receive any thoughts implementing FIFO for listing files using java.
Thanks,
Siva

Duplicate post, replied to here:
http://forum.java.sun.com/thread.jspa?threadID=5169767&messageID=9652068#9652068

Similar Messages

  • Java Code to List All Active Windows Process in the System

    hi
    i need to help to resolve the below given points:
    1. Mapping Windows Process with their application names.
    2. Owner of the Process
    3. Process Start time and end time.
    Thanks
    Pruthvi.

    This is actually not a java question but:
    the windows command to get the processes:
    WMIC PROCESSWhen you invoke the process store the details in a collection along with the system time.
    Do the above a number of times per second and when a process disapears you know it has ended.
    to calculate an aprox duration of process life cycle:
    Duration = endTime - startTimeDetail List:
    Caption
    CommandLine
    CreationClassName
    CreationDate
    CSCreationClassName
    CSName
    Description
    ExecutablePath
    ExecutionState
    Handle
    HandleCount
    InstallDate
    KernelModeTime
    MaximumWorkingSetSize
    MinimumWorkingSetSize
    Name
    OSCreationClassName
    OSName
    OtherOperationCount
    OtherTransferCount
    PageFaults
    PageFileUsage
    ParentProcessId
    PeakPageFileUsage
    PeakVirtualSize
    PeakWorkingSetSize
    Priority
    PrivatePageCount
    ProcessId
    QuotaNonPagedPoolUsage
    QuotaPagedPoolUsage
    QuotaPeakNonPagedPoolUsage
    QuotaPeakPagedPoolUsage
    ReadOperationCount
    ReadTransferCount
    SessionId
    Status
    TerminationDate
    ThreadCount
    UserModeTime
    VirtualSize
    WindowsVersion
    WorkingSetSize
    WriteOperationCount
    WriteTransferCount

  • Java code to connect to remote windows machine from local machine

    Hi,
    I have developed a code to connecting remote windows M/C from local M/C by using SSH2 (ganymed-ssh2-build209.jar) API. when I run the code its giving below error. Can any one please help me how to resolve it. And also please let me know, is there any other way to connect remote windows system using java code.
    Exception.
    java.io.IOException: There was a problem while talking to <host name>:22
      at ch.ethz.ssh2.Connection.connect(Connection.java:642)
      at ch.ethz.ssh2.Connection.connect(Connection.java:460)
      at Connect.RemoteServer.ConnectWindowsServer.runCommand(ConnectWindowsServer.java:55)
      at Connect.RemoteServer.ConnectWindowsServer.main(ConnectWindowsServer.java:27)
    Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(Unknown Source)
      at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at ch.ethz.ssh2.transport.TransportManager.initialize(TransportManager.java:299)
      at ch.ethz.ssh2.Connection.connect(Connection.java:591)
      ... 3 more
    JAVA Code
    import ch.ethz.ssh2.Connection;
    import ch.ethz.ssh2.Session;
    public void setAuthenticationInfo(String hostname, String username,String password) {
           this.host = hostname;
           this.userid = username;
           this.password = password;      
           this.recentCommand = "";     
           System.out.println("setting authentication info completed for host=" + host );
      public void runCommand() throws Exception {
    try{
            // Setup ssh session with endpoint
           System.out.println("starting connection with " + host);
           Connection connection = new Connection(host);
           System.out.println("connection object created..");
           connection.connect();
           System.out.println("Connect to connection");
           connection.authenticateWithPassword(userid,password);
           System.out.println(connection.isAuthenticationComplete());
           Session session = connection.openSession();
          System.out.println("connected");
      }catch (Exception e) {
      e.printStackTrace();
    Regards,
    Praveen

    Hi baftos,
    I tried to telnet remote windows machine from my local machine on port 23, its not connected and given error message like "Connect failed".
    As your response, if we can telnet to remote windows machine from local machine then we can connect from Java. Is it correct ?.
    Can you please help me to resolve this issue. And also please confirm the port (23) is correct, which I was used to connect remote machine from telnet.
    Regards,
    Praveen

  • Java code to exe-file

    Hi!
    I hope someone can help me with this.
    I have done a program in Java-code and now I want to convert that code into an executable file that can be run on most computers. I have tried to convert the code to a JAR-file and then, using the program JSmooth, transform it into a exe-file. But, sad to say...it failed. Is JSmooth the way to do it or is there another better way?
    Hope to get an answer.. :)
    / Berenur

    add a Main-Class: yourclass line to a manifest file, and specify your manifest when you create the jar.
    I.e.
    Manifest-Version: 1.4
    Main-Class: myClassSave that to manifest.mf or something like that.
    Then,
    jar -cvfm MyJar.jar manifest.mf [all files to include in jar]
    done.

  • Migration of JAVA code(JDK 1.2) from Windows NT to Solaris 8.0

    What are the issues while porting the code in JAVA code JDK 1.1.7 and JDK 1.2 from Windows NT to Solaris 8.0
    What are the considerations while porting the scripts of installshield from windows NT to solaris 8.0

    There is no special issues about running Java code created on NT on Solaris.
    I have met only one issue in JDK 1.2, when the original code was compiled using IBM Java Compiler and it was fixed by recompile with original Java Compiler from JDK.

  • Running the Java Code from Batch File

    Hi All,
    I have run a code sucessfully in Eclipse and it uses Logging API from Java
    When i try running the same program from batch file it throws error
    java.io.IOException: Couldn't get lock for log\Properties_Log_16Sep2009_150229
    at java.util.logging.FileHandler.openFiles(Unknown Source)
    at java.util.logging.FileHandler.<init>(Unknown Source)
    at com.adidas.SPM.LogMessage.<init>(LogMessage.java:26)
    at com.adidas.SPM.MainApplication.initialize(MainApplication.java:51)
    at com.adidas.SPM.MainApplication.main(MainApplication.java:102)
    I am working on a windows systems the folder log has all the permission i have provided with all
    Not sure why the code runs like this
    The batch file is like below
    set CURR_DIR=%CD%
    cd %CURR_DIR%\bin
    %CURR_DIR%\jre6\bin\java -classpath .;%CURR_DIR%\lib\FirstProject.jar com.test.MainApplication
    echo %ERRORLEVEL% The Error Level
    echo SUCCESS
    GOTO END
    :END
    pause
    Rgds
    Aditya

    Vikash.SunJava wrote:
    According to me the problem is that there are many instances trying to access the same property file. Nothing wrong with that since they only are reading it.
    The best way to do is that create a schedular in Windows that runs at some predefined interval (say 1 minute).Huh?
    >
    What will happen is if your program runs for more than a minute even then the new process will not start until old process is autaomatically killed. Please do not check this option if you want the program to exit normally.
    If the Task is still running stop at this time
    O_o

  • Java Code to Download files

    Dear Sir,
    I would kindly like to know whether any java classes are existent ,avliable for download ,which would provide the facility to
    download a file from the server to the client machine.If not,kindly advise me on how to perform this task and kindly send me sample code if possible.
    With regards
    Santosh.

    www.jscape.com has a great library for FTP as well as HTTP protocols. The library contains support for a host of other protocols as well. A trial version is available, but the licensed version is $95. I tried to find freeware for this type of functionality but none of them were very good. Shelling out the $95 ended up being a wise decision.
    JP

  • Java code to upload file and place file on server directory

    Hi,
    Am a relatively new Java programmer. I need to add a functionality to a struts web application to allow users UPLOAD a file (using browse button). I need to read the file name,, do some other checks and eventually, upload the file to a server directory.
    When do I start? Any good website for source code examples?
    Thanks

    See this http://jakarta.apache.org/commons/fileupload/

  • Java code for Compressing files in UNIX

    Hi ,
    i am trying to compress files in unix but not seeing any change in size of packed file .any code please help.

    Hi ,
    i am trying to compress files in unix but not seeing
    any change in size of packed file .any code please
    help.Does this question have anything to with Java whatsoever? If so how? And what types of files are you attempting to compress? If you are trying to compress a compress format the size difference will be... small if not actually worse then the originial.

  • Java Code - to upload files on https

    Hello:
    I am really looking for a bean to upload and download flat files to a https server.
    Thanks.

    Sanju,
    If you wann to do transformation, Validation..That is message mappping & if you get a text file then You need to use FCC in Sender File adapter,  If the Target system requires a different format example as text file and different structure then you need to use FCC in SOAP adapter and post to the webserver,  If no message mapping needed then you can go ahead without FCC and drop the file with the help of HTTP / SOAP Adapter
    Cheers
    Agasthuri

  • What tools can change Java application to .exe file(for Windows)?

    Thanks.

    would appreciate if u try searching the forum first
    this is one of the most frequently asked questions here
    i have used the suggestions here and found that it works
    regards

  • Regarding use of java code inside javascript

    Hi ,
    I have doubt regarding how to use java code inside javascript,
    i am giving my application code here
    <%@page import="java.util.*"%>
    <%@ page import="com.suuny.sard.pmt.pat.*"%>
    <SCRIPT LANGUAGE="JavaScript">
    function fun(){
         var ac=document.login.Projectname.options[document.login.Projectname.selectedIndex].value;
         var c = document.login.task1.value;
         alert(ac);
         alert(c);
         return true;
    </SCRIPT>
    <form name="login" action="/pmt/jsp/Leavemanagement/Leave_Ems_HomePage.jsp" method="get" encType="x-www-form-encoded" >
    <table width="100%" Align="Center" cellspacing="0" cellpadding="0" border="0">
    <tr class="tablerow"><td colspan="6" align="center"><font class="pagehead" align="center">Create Tasks</font></td></tr>
         <tr class="tableheader">
              <th>Project
              <th>Task-Id
              <th>TaskName
              <th>Assigned To
              <th>description
              <th>Milestone
         </tr>
         <%
              for(int i=1;i<2;i++){%>
                   <tr class="tablerow"><td align="center">
                   <select class="SELECT" NAME="Projectname" VALUE=" " onchange="return fun();" >
                   <!--<option value=""> </option>-->
                   <%
                        ArrayList ar =null;
                        ArrayList projectids=null;
                        Hashtable ht = new Hashtable();
                        ProjectNames pnames=new ProjectNames();
                   ht = pnames.getProjectNames();
                        ar=(ArrayList)ht.get("projects");
                        projectids=(ArrayList)ht.get("projectIds");
                        for(int j=0;j<ar.size();j++){
                        out.println("<option value=\""+projectids.get(j)+"\">"+ar.get(j)+"</option>");
                   %>
    </select>
         <%
                   out.println("<td align=\"center\"><input type=\"text\" name=\"task"+i+"\"value=\"\" size=\"25\"></td>");
                   out.println("<td align=\"center\"><input type=\"text\" name=\"taskname"+i+"\"value=\"\" size=\"25\"></td>");
              %>
              <td align="center">
                             <select class="SELECT" NAME="Projectname1" VALUE=" ">
                             <!--<option value=""> </option>-->
                             <%
                                  ArrayList ar1 =null;
                             ar1 = pnames.getProjectResource("VXML02");
                                  for(int j=0;j<ar1.size();j++){
                                  out.println("<option value=\""+ar1.get(j)+"\">"+ar1.get(j)+"</option>");
                             %>
    </select>
              <%
                   out.println("<td align=\"center\"><input type=\"text\" name=\"description"+i+"\"value=\"\" size=\"25\"></td>");
                   out.println("<td align=\"center\"><input type=\"text\" name=\"milestone"+i+"\"value=\"\" size=\"25\"></td><tr>");
              out.println("<tr class=\"tablerow\"><td colspan=\"6\" align=\"center\"><input class=\"txtbuttonsmall\" type=\"submit\" value=\"save\"></td>");
         %>
    </Table>
    </form>
    My question is :
    I selected one project from first combo box ,i need project members corresponding to the project.
    In my code "pnames.getProjectResource("VXML02");" in this function iam passing one static projrct value,but i need dynamically selected project from first combo box(<select class="SELECT" NAME="Projectname" VALUE=" " onchange="return fun();" >),so please help me guys.

    Hi Marco,
    I "executed" some java code within XSLs file. I have quoted the word executed because I didn't really run java code, but I used a simply trick that I describe you below.
    Into your XSLs put an iframe which is hided (it has an height of 0 pixel). As src of the iframe put the address of a portal component which execute your code (in my case calculate some PCD URL of some pages into a defined role). As result of component execution, I use the response.write method in order to execute some jscript code, which is able to interact with the HTML generated by XSLs files, for example in my case response.write put the PCD URL into a drop down list placed into the "edit" form.
    This works fine. I don't know if is suitable also for your case, anyway could be a hint, but pay attention to Roland's recommendations.
    Ciao
    Roberto

  • Use of Java Code within the generated XML Forms Stylesheets

    Hello,
    is the use of Java-Code possible with the XSL-Files generated by XML-Forms, as possible in standard XSLs? I know that this would mean a modification.
    kind regards,
    Marco

    Hi Marco,
    I "executed" some java code within XSLs file. I have quoted the word executed because I didn't really run java code, but I used a simply trick that I describe you below.
    Into your XSLs put an iframe which is hided (it has an height of 0 pixel). As src of the iframe put the address of a portal component which execute your code (in my case calculate some PCD URL of some pages into a defined role). As result of component execution, I use the response.write method in order to execute some jscript code, which is able to interact with the HTML generated by XSLs files, for example in my case response.write put the PCD URL into a drop down list placed into the "edit" form.
    This works fine. I don't know if is suitable also for your case, anyway could be a hint, but pay attention to Roland's recommendations.
    Ciao
    Roberto

  • How do you turn java code into an .exe or etc...

    I can't seem to figure out how to turn my java code into an executable in windows so that it runs by itself without a comipler, can someone help? (without using visual J++).

    I can't seem to figure out how to turn my java code
    into an executable in windows so that it runs by
    itself without a comipler, can someone help? (without
    using visual J++).I saw a tutorial on that, you might want to check it out.
    http://developer.java.sun.com/developer/onlineTraining/new2java/divelog/?frontpage-headlinesfeatures

  • Generate code from XMI files

    Hi,
    I want to generate Java code from XMI files. Is JMI the right way? If so: I found the JMI specification but not the classes. Can anybody tell me where they are hidden?
    Thanks in advance for your help.
    Phil

    you can find some info about a project (MDR) that uses jmi here:
    http://mdr.netbeans.org/architecture.html#jmi
    http://mdr.netbeans.org/docs.html
    As I understand it, jmi provides a standard way to generate java interfaces to MOF models. So code generation focused on jmi is usually only interesting for metamodel repository developers.
    If you like the idea of JMI, you could build on top of a tool that is JMI compliant. You could extend MDR. Or you could extend a template based tool like AndroMDA,http://www.andromda.org, which itself is built on MDR.
    Or, you could forget MOF and JMI and work with Eclipse EMF which provides java generation capabilities. http://www.eclipse.org/emf/
    If you want to generate from xmi directly then you are looking at building your own tool using DOM or XSLT etc. but it would be better to read the xmi into a metamodelling tool/repository and use the services they provide.
    Anyway you need to get your xmi from somewhere, and that source will restrict your choice for code generation.
    You could use/buy a tool like Together, but it doesn't look like you are interested in that.

Maybe you are looking for

  • No tax information exists for billing document

    Hi We have a problem. In our scenario, we create a service order followed by service confirmation and bill from service confirmation. All prices including taxes are maintained in r/3. prices and taxes are picked in the service confirmation also. When

  • Difficult to open files saved in the MAC PC when working on the network.

    Working on a network that has Mac and PC sharing and using the same file, but yesterday the illustrator went to the windows to open files saved in the MAC network. If I save the file on the hard drive it opens, but if you are not on the network. But

  • Which component I should choose to simulated a stepper motor's winding?

    Dear all, I'm now trying to design a chopper type stepper motor driver. In order to learn from basic, I build a simple circle with only one motor winding. I choose advanced inductor for motor winding. But some of the parameters required in this compo

  • Error - REP 1849

    Hi, I do have a problem printing my report, it gives me this error, It's not a user interface error.. can anybody help me on this.. thanks in advance Lilibeth

  • Work process trace level automatically increasing

    Hello All, MY env is SAP R3 4.6C (DB2 7.1.0) ,and suddenly many of the work process of all the appl.servers(4) trace level is increasing to level 2 . Which is causing FileSystem full (usr/sap/<sid>) ... Even after manually changing the trace level to