Application Design,Java Read Files,Merging Files,Outresults

Read all files from a folder in the same directory
Files with the same name but different extension
On .txt extensions,count the number of words,the start and end offset of each word,output into a textfiles
Merge a1,a2,ann,rel(other file extensions),on read each line,and store it into a data-structure
Join results of 3,4 and output into a new folder <previousfolder>_result
What are the operations that I can use to achieve this with java?
How can I achieve this with java?

Welcome to the forum!
When you post your class assignments you should provide the class name, teacher name, textbook used and the exact instructions for the lesson as presented by your teacher.
>
Read all files from a folder in the same directory
Files with the same name but different extension
On .txt extensions,count the number of words,the start and end offset of each word,output into a textfiles
Merge a1,a2,ann,rel(other file extensions),on read each line,and store it into a data-structure
Join results of 3,4 and output into a new folder <previousfolder>_result
What are the operations that I can use to achieve this with java?
How can I achieve this with java?
>
Have you covered all of those concepts in your class?
Did you ask you instructor to explain any of the steps you did not understand?
Have you written, compiled and run any Java classes at all yet?
Post the code you have written so far, explain what it does and what it does wrong and you will get advice about how to find and fix the problem.
Break the problem into pieces. Start by writing code that
>
Read all files from a folder in the same directory
Files with the same name but different extension
>
Post the code and the results it gives you.
Good luck with your assignment. Remember, the teacher is there to help you if you get stuck.

Similar Messages

  • Manual patch application for java/xml files

    Hi,
    I am searching for a utility similar to FNDLOAD (which is used for applying a ldt file on an environment) which i can use if i need to apply a single or multiple java and xml files onto an environment. The environment that i am referring to here is a dev instance and waiting for the patching windows for testing integration with the R12 applications is very time consuming.
    Thanks,
    Ankit

    Ankit,
    A little bit of clarification here: FNDLOAD is a necessary program which loads flat files as data objects in the system whereas in case of java classes, it requires to be copied. Again, page and region, xml will need the import process for upload to MDS, while VO, EO just needs to be copied.
    So in all, you can write a script to copy the relevant java class files and XMLImport command for xml files.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Bex Web Application designer - Java communication error

    I was trying to use the Web template to displayed in the Web browser when this error occured, "RSBOL. 017. Java communication Error: An unknown error occured during portal communication"
    Would like to get help and know how to solve this error. Thank you.

    Emily,
      use my blog which will really help you understand the communication flow and help you resolve your issue !!
    restarting is not even an option in this case as the problem still exists and the way to determine the problem is described in my blog
    check it out..
    The Cloak and Dagger about Portal and BI Connectivity
    hope that helps..

  • Auto Open Java .jnlp Files

    Users on my website are prompted to "open" or "save" .jnlp files. Is there a way that I can force it to automatically open without prompting the user? I have already added this to my .htaccess file:
    AddType application/x-java-jnlp-file .jnlp
    And it doesn't seem to do the trick...
    Any help would be great, thanks!

    Select the text on the line below by dragging across it. Don't include the blank space at the end of the line. Only the text should be highlighted.
    java -jar
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V), then press the space bar.
    Now switch to the Finder and and select one of the items that are causing the problem. Drag it into the Terminal window. More text will be added to what you entered.
    Click in the Terminal window to activate it, then press return.
    The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear.
    Post any lines of output that appear below what you entered — the text, please, not a screenshot.

  • 'Unable to Launch Application Error' - Java Web Start Running Under MS IIS.

    I am attempting to render the following .jnlp in MS IE:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File for LottoMadness Application -->
    <jnlp
       codebase="http://localhost/LottoMadness/"
       href="LottoMadness.jnlp">
       <information>
         <title>LottoMadness Application</title>
         <vendor>Rogers Cadenhead</vendor>
         <homepage href="http://localhost/LottoMadness/"/>
         <icon href="lottobigicon.gif"/>
       </information>
       <resources>
         <j2se version="1.5"/>
         <jar href="LottoMadness.jar"/>
       </resources>
       <application-desc main-class="LottoMadness"/>
    </jnlp>I've deployed the .jnlp, .gif, and .jar to MS IIS, running locally on my PC.
    When I attempt to render the .jnlp in IE I obtain an 'Application Error' window stating 'Unable to Launch Application'. Clicking details gives me:
    com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost/LottoMadness/LottoMadness.jnlp
         at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
         at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
         at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
         at com.sun.javaws.Launcher.launch(Unknown Source)
         at com.sun.javaws.Main.launchApp(Unknown Source)
         at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
         at com.sun.javaws.Main$1.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)I have configured MS IIS for Web Start, by setting the Extension/Content Type fields to .jnlp and application/x-java-jnlp-file.
    (The .jnlp is basically from 'Programming with Java in 24 Hours', as this is the book I am learning Java from.)

    AndrewThompson64 wrote:
    I am not used to seeing references to a local server that do not include a port number.
    E.G. http://localhost:8080/LottoMadness/
    I have deployed the following HTML (HelpMe.html) to the web server:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
         <title>Untitled</title>
    </head>
    <body>
    Help Me!
    </body>
    </html>When I attempt to render the URL in IE, I see the page just fine. The URL is use is:
    http://localhost/LottoMadness/HelpMe.htmlSo, I think my web server setup and usage is ok.
    >
    As an aside, what happens if (your MS IIS is running and) you click a direct link to..
    [http://localhost/LottoMadness/LottoMadness.jnlp|http://localhost/LottoMadness/LottoMadness.jnlp]
    When I click this link I get the error and exception I cited in my previous post.

  • How to read the java class file to convert it in java.

    hello all,
    i m developing the java application which generated the java code from the java 'class file' .
    Can anybody please help me, Is any java support for reading the class file? or how to know the class file format?
    I know the application javad, jad, javap which is doing the same thing.
    thanks for reply,
    - Jayd

    do you mean decompiling? there are tons of java decompilers available out there, what exactly are you trying to do here?

  • How to read files on server from a java program?

    Hello,
    I am fairly new to JSP programming. I have an issue with reading files. I am trying to call method of a normal java file from a jsp program. The method I am trying to call does some IO operation on Files. I have the files in the same directory as my class files on server that is in WEB-INF/classes folder. In my java program, I am giving just the file name to open because the files and the classes are in the same directory. But this is not working.
    What exactly should I do to read a file from a java program, that is running on the server?
    Any help is appreciated.
    Thanks,
    Krishna

    String realFilePath = application.getRealPath("/WEB-INF/myFile.txt");
    File fileToOpen = new File(realFilePath);
    out.println(fileToOpen.getAbsolutePath() + ": exists? " + fileToOpen.exists());in this case "application" is a reference to the ServletContext.
    It is an implicit variable in a JSP. In a servlet:
    ServletContext application = getServletConfig().getServletContext();

  • Reverse-Engineer Java Class Files ---- Launch Java Application From Icon

    hi,
    is there a way to prevent java class files from being interpreted back into java source files (jad.exe does exactly that) ?
    i have a batch file to compile my java application and another to run the application. the application is run by invoking the batch file from dos window.
    i'd like to be able to double-click on some icon to launch the application.
    how do i accomplish this?
    thank you.

    s there a way to prevent java class
    files from being interpreted back into
    java source files (jad.exe does exactly that) ?There are two ways to prevent that:
    1. Use an obfuscator. Look at this page for
    explanation of what is that, and then search google
    "java obfuscator" for products.
    http://www.devx.com/tips/Tip/13580
    2. Compile your application to native code (google
    for "excelsior jet" or "gcj"). Look at this page for
    more details:
    http://www.excelsior-usa.com/jetprotection.html
    i'd like to be able to double-click on some
    icon to launch the application.
    how do i accomplish this?Do you want to do that on your computer only, or you
    need a solution to make the clickable icon on
    computers of your end-users?
    Denis.thanks to all,
    i'll see suggest sites for more details on obfuscator.
    I'd like to have the application doulbe-clickable on end-users' computers.

  • Read file gives java.lang.Nullpointer exception

    I am reading to read a ".txt" file created by "python code" and stored in my directory.
    If i comment the python code and store the file ("statusfile.txt') in the directory, the code is able to read the file. but when i uncomment and run the python code to generate the file ..it gives java.lang.NullPointerException.
    the two functions for reading the file and running the python code are separate but in the same class and are also called in one JSP. Does anyone have any suggestions.
    Someone did suggest me to use getResourceAsStream.. but i do not understand where to use it .. in the class (where i am doing the readfile function or where in the runpython function which basically generates the file) I did tried using it in JSP and also in the class.. but nothing seems to work. Also as i saw the examples.. getResourceAsStream is used for uploading properties or config files. I just want to simplying read the simpel text file which is already stored in the directory and return a boolean to JSP if reading file was a success.
    in short the algo is
    ON JSP:
    1) call class function to run python code
    2) call class function to read the generated in step 1.
    CLASS
    1) function runpython()
    // store generated files in the specified directory
    2) function readFile()
    //read file from specified directory
    //return boolean
    Any suggestions
    Thanx

    The problem is where is "your directory"?
    Creating a file by new File("myFile.txt") just puts it in the current working directory.
    Sometimes this is something like the bin directory.
    Most web applications use ServletContext.getRealPath("/")
    This turns a website relative reference into a file reference on the local machine.
    So you can say getRealPath("/index.html") and it will return the file (for example) C:\tomcat\webapps\root\index.html
    On to suggestions:
    Null pointer exception?
    Where is it coming from? Catch the exception and print a stack trace, to see if you can determine which line of code is causing it - which variable is null. Is it the actual file, or something you use to create the file?

  • How to read non-java binary file?

    Hello Team,
    I have problem to read non-java binary file.
    Let me explain.... I have one binary file created in vc++ having fix structure. Structure of file is like String,int,int,int.
    Now I have to read this file in my java application. I am failed to identify length of String value of Structure in java.
    Can any body help me to solve this problem?
    Thanks in advance.
    - Pathik

    Thanks for guide me,
    I have try using 0x00. And its working.
    Now I have another problem:
    in file.ext , I have written one record having structure string,int and int.
    I have enter data as "HelloWorld", 100 and 111.
    To read first record from file file.ext, following code I am using:
    try
         FileInputStream fis = new FileInputStream("file.ext");
         DataInputStream in = new DataInputStream(fis);
         char ch;
         while((ch=(char)in.readByte()) != 0x00)
              System.out.print(ch+"");
    System.out.println();
         System.out.println("Integer 1 --> " + in.readInt());
         System.out.println("Integer 2 --> " + in.readInt());
         in.close();
         fis.close();
    catch(Exception ex)
         System.out.println(ex.toString());
    And I am getting following output:
    HelloWorld
    Integer 1 --> 0
    Integer 2 --> 0
    File file.ext is created in vc++
    I am not getting integer data. Plz guide me for this problem.
    Thanks in advance
    - Pathik

  • Pass return code from Java application to a .bat file.

    I have a .bat file which will execute a Java application. I want to pass the return code from the java application to the ".bat" file.
    Could you please let me know, how can I accomplish this.

    I tried that, but it doesn't return the value...
    In my Java app, I had System.exit(returnCode) and in the '.bat' file
    I have
    @echo off
    java <myApp>
    set returnCd=%?%
    echo %returnCd
    and it didn't return any value. What should I specify in set returnCd=%?% instead of ?

  • Making '.exe' file/application using JAVA

    Hi,
    Is it possible to make an application(an exe file) using just Java, just as we in VB.If yes can you please give some idea how can we do that.
    Thanks.....

    To make a java application run from a click on an icon
    you must create a Jar file as I've explained below:
    Create a separate folder and place all the source code programs needed to run the application in it. You just need the ones with the .class extension. You don't need the ones with the .java extension.
    Open up 'Notepad' and type in this line:
         Main-Class: your class that has the main method
    You don't need the .class extension.
    ex. If your main method is in a program called HelloWorld.class
    type in :
    Main-Class: HelloWorld
    Make sure you hit the RETURN key at the end of the line. I forgot to do that which is why I spent four hours trying to get this to work!
    Save this as: manifest.mf
    and put in the same folder as above. Make sure it doesn't save as manifest.mf.txt
         Open MS-DOS.
    CD change to the directory and folder you are in.
    Type this in exactly as I have written:
    jar cvfm0 myprogram.jar manifest.mf *.class
         This should put a Jar file in your folder. Just click on it and it should work.
    Make sure the program doesn't need to take input from a command line, like DOS.
    Otherwise it will do nothing. As long as your program creates a frame, window, button or something, it should work.
         To run the Jar file from DOS(for testing purposes) type:
    java -jar myprogram.jar
         If you get an error stating that it can't find the main method class(like mine did), right click on the 'myprogram.jar' file that was created,
    click on properties, then ZipMagic.
    Open the 'manifest.mf' file and make sure
    that 'Main-Class: yourprogramname' is in there.
         If you followed these directions you should be able to create an executable java file.
    Below I've explained what the commands to create the Jar file mean.     
    jar: means you are creating a java archive file which acts like a ZIP file
    c: means create a new jar file
    v: means verbose which tells DOS to show the action it is doing
    f: means that the files to choose are going to be typed in by a user(you at the Dos prompt)
    m: means to use the manifest file that you specify
    0: means that the file won't be compressed
    To make a JAR file you only need the cfm letters.

  • Unable to read file from application server

    Hi guys,
    I am reading file(could be any extension) from application server,but some time i am successfuly able to read file and sometime unable to read,why its happening .
    my code is here
    OPEN DATASET E_FILE FOR INPUT IN  BINARY MODE . "
      IF SY-SUBRC = 0.
        DO .
          READ DATASET E_FILE INTO GS_PDF_TAB.
          IF SY-SUBRC = 0.
            APPEND GS_PDF_TAB TO GT_PDF_TAB.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
        CLOSE DATASET E_FILE.
      ENDIF.
    Thanks
    Ankur Sharma

    Hi,
    What actually happens?  Do you get a short dump?  Do you get a return code ne 0?  Does it run fine but you get no data in your table?
    We aren't mind-readers and can't help much without more information.
    Try using transaction AL11 to see if you access the files you are trying to open.
    Gareth.

  • Uploading and reading file from application server

    Hi
    My problem is when am uploading a file to application server it is getting stored in
    usr/sap/transyp1/prod/in   directory
    after that i want to read that file from application server to update database
    when  using below code it is showing some other directory in f4 help
    DATA: lv_hostname TYPE msxxlist-name.
    DATA: lv_server TYPE bank_dte_jc_servername.
    PARAMETERS: p_file TYPE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
    IMPORTING
    e_server = lv_server.
    lv_hostname = lv_server.
    CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
    EXPORTING
    dynpfield_filename = 'P_FILE'
    dyname = sy-cprog
    dynumb = '1000'
    filetype = 'P'
    location = 'A'
    server = lv_hostname.
    experts could you please help me out
    Thanks & Regards
    Nagesh.Paruchuri

    User Transaction file. You will get all logical file path names.
    used following fucntion module to read file name and use command open dataset to read the file.
    CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
                CLIENT           = SY-MANDT
                LOGICAL_FILENAME = C_LOGICAL_FILENAME
                OPERATING_SYSTEM = SY-OPSYS
                PARAMETER_1      = P_IN_FILENAME
           IMPORTING
                FILE_NAME        = P_OUT_FILENAME
           EXCEPTIONS
                FILE_NOT_FOUND   = 1
                OTHERS           = 2.
    OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
      IF SY-SUBRC <> 0.
        MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
      ENDIF.

  • Static lookup lists:read data from a Java *.properties file

    Hi
    i need to make static lookup lists i am using read data from a Java *.properties file
    i am using the Class "PropertyFileBasedLookupViewObjectImpl" that wrote by Steve Muench in ToyStore.
    but i need to use the default language for that i update the loadDataFromPropertiesFile()
    method to find the correct properties file
    String temp=Locale.getDefault().getLanguage();
    String propertyFile =
    getViewDef().getFullName().replace('.', '/')+"_"+temp+ ".properties";
    the problem:
    For English(TEST_en.properties) it is good and working
    For Arabic(TEST_ar.properties) read from correct file _ar.properties
    but the dispaly character is wrong
    When Debug
    In the File 1=&#1583;&#1605;&#1588;&#1602;
    In debug 1=/u32423

    Depending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
    http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html

Maybe you are looking for

  • Idoc execution in Scheduling Agreement with Delivery Schedule

    Hi all, Can anybody please explain the importance of the field name "LABKY" in Idoc execution for Forecaste/JIT Delivery Schedule. My requirement is that when i send a new Idoc i do not want the old schedule line which are not yet released , to be de

  • Environment Question. How to send to external midi devices

    Hi All, I used to be able to do this but now can't remember. Basically, I'd like to control an external synth from logic..... Edit an instrument performance then run it to say a moog and record the audio back in. What do I need to do in the environme

  • Fireworks CS3 doesn't work in windows 7

    Hi Guys, I have used a version 9.0.0.1188 of Fireworks CS3 for a while in my PCs with OS Windows XP and Vista Home without any problem, but now I have a new PC with windows 7, and I can open Fireworks CS3, but then I can't open old files, and I can't

  • Can I enable 5.1 sound in the browser?

    Well, theres not much to tell. I have MIcrolab 7-730 speakers, sound card that supports those speakers. When I listen to music in winamp, the sound comes wrom all the speakers. When using web, the sound comes only from front ones and the subwoofer. C

  • Is there any reason to not install the firmware 1.6 update?

    Should everyone install the firmware SMC 1.6 update?