Where to put the .txt file in order to read it

think ur prog can read the data.. but it said
java:9: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
FileInputStream sStream = new FileInputStream("data.txt");
so where to paste the .txt file if i want to read it
same folder with my .java file?

u must put the .txt file in order to read it as an
argument to java command at runtime this code may help
u out
import java.io.*;
class Demofin     
{public static void main(String[] args) throws
IOException
     int i;
     FileInputStream fin;
          try
               fin=new FileInputStream(args[0]);
          catch (FileNotFoundException e)
          {System.out.println(" file not found");
          return;
          catch (ArrayIndexOutOfBoundsException e)
               System.out.println("usage demofin filename.txt");
               return;
          do
          {i=fin.read();
          if(i!=-1)System.out.print((char) i);
          while (i!=-1);
               fin.close();
}Use tags..

Similar Messages

  • Where to kept the txt file........

    hello friends
    i am using netBeans 4.0 for developing a demo
    application. Here is the directory structure created
    by netBeans for my project.
    Inventory (main folder)
    -------build (sub folder)     
    -------dist
    -------nbproject
    -------src
    -----------------Inventory (in the src folder      
              |
    Under Inventory folder (just above one), I am storing
    (rather netBeans) all my .java files.
    Now coming to the question, I am using a text file as a
    property file for the Project. I kept it with all other .java
    files but the following code of line is not reading from
    the line (this also happened with the images kept in
    "images" folder in the same Inventory folder)
         f = new FileReader("lookNfeel.txt");Please tell me where should I kept this file (and images
    folder too)
    have a nice day
    thnks in advance
    anandScreen

    hi there
    if full path of txt file given, then it works
    same with images under images folder
    ............If you're not going to be redeploying your app on different computers, possibly in different locations, then that's fine.
    A more general solution is to put the properties file on the classpath, and then use Class.getResource or getResourceAsStream to find it.
    Say you have the following structure
    C:\myprojects\proj1\foo\Bar.class
    C:\myprojects\proj1\foo\Baz.class
    C:\myprojects\proj1\config\config.propertiesAnd Bar and Baz are both in package proj1.foo
    Then you might run it like this, if Bar is your main class java -cp C:\myprojects proj1.foo.Bar You classpath is c:\myprojects. The packages in that classpath are proj1.foo and proj1.config.
    In your Java code, when you want to load the props file, you'd do something like this: package proj1.foo;
    import java.io.*;
    public class Bar {
        private static void loadConfig {
            InputStream in = Bar.class.getResourceAsStream("/proj1/config/config.properties");
            Properties props = new Properties();
            props.load(in);
            // etc.
    } You could also look into java.util.ResourceBundle. Its rules are more complex though, and probably more than you need here.

  • Where to put the properties file

    I am a new user of NetBeans6.0, I am making a simple application for user registration. I have coded everything but when I run project I get error caused by the dao.properties file load problem.
    I have put the dao.properties file inside the classes directory(where all java class files are build after running the project) of my web application directory( I didn't create this directory though, it is automatically created by IDE), I think there is a problem with its path.
    where should I put the dao.properties file so that when I run the project the Tomcat automatically find it and also, what the settings I should do?
    actually, I have referred to BalusC'd  DAO tutorial: the data layer but that comes in use when we are working off the IDEs, In my case since I am using Netbeans so it may be different from that one.
    if someone already done that then please let me know

    ok, but will it work if I upload the project in a remote host?
    lets talk besides IDE, as in your DAO tutorial you have instructed to put the properties file somewhere in root of the classpaths. ok, it will work on a local computer cause there is classpath setting but since remote host doesn't know about that property file and we cant set classpath at remote host(I am not sure though if we can) then how will it work at remote host.
    how the server at remote host comes to know about that property file?
    In my case since I have made the project using IDE and everything regarding classpaths have been set automatically(IDE done itself), but at remote host these sort of settings are not done then how the project will run?
    if I have described my problem incorrectly then please consider it as it is supposed to be.

  • Where to put the dll file

    hi everyone
    i have a dll file and i want to use it through a java file
    so i wrote a native method and load the directory when the dll is found
    but
    how to set up the library path in my in my environment

    i found the answer i don't have to set up any
    environment variable just put the dll file near the
    java file

  • Where to put custom .jar-files in order to use them in scripting QPAC?

    Hi,
    For testing purposes, I wrote a simple class and put it in a .jar-file to use in scripting QPAC. Unfortunately, I get the following error message in JBOSS:
    Class: FooBar not found in namespace
    Where do I have to put custom library (jar-)files in order for JBOSS to find them? I already tried
    [...]\jboss\lib as well as
    [...]\jboss\server\all\lib.
    Regards,
    Steve

    Hi Steve
    You need to put them in two places:
    1. In the server classpath, so that they can be found at runtime. jboss\server\all\lib should work, or you can even drop them into the server/all/deploy directory. I think if you put them in the lib directory, you need to restart Jboss, whereas if you put them in the deploy directory, they should be dynamically picked up.
    2. For testing purposes, the extra jars need to be in the classpath of the Workflow Designer. Please download our SQLPlus QPAC from:
    http://www.avoka.com/avoka/qpac_library.shtml
    It includes a document that describes a technique for adding extra jars to the classpath.
    Regards,
    Howard
    http://www.avoka.com

  • Where to put the class file

    i am using tomcat 4.1.27 server and i created a UserData.java file as a bean; i have placed the class file in the WEB-INF/classes folder. still i get the following error:
    ==============================================================
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 21 in the jsp file: /ics334/Javanese/name7.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\ics334\Javanese\name7_jsp.java:60: cannot resolve symbol
    symbol : class UserData
    location: class org.apache.jsp.name7_jsp
    UserData user = null;
    ^
    An error occurred at line: 21 in the jsp file: /ics334/Javanese/name7.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\ics334\Javanese\name7_jsp.java:62: cannot resolve symbol
    symbol : class UserData
    location: class org.apache.jsp.name7_jsp
    user = (UserData) pageContext.getAttribute("user", PageContext.SESSION_SCOPE);
    ^
    An error occurred at line: 21 in the jsp file: /ics334/Javanese/name7.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\ics334\Javanese\name7_jsp.java:65: cannot resolve symbol
    symbol : class UserData
    location: class org.apache.jsp.name7_jsp
    user = (UserData) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "UserData");
    ^
    3 errors
    Apache Tomcat/4.1.27
    ===============================================================
    the structure of the jsp file is as
    <%@ page contentType="text/html" %>
    <%@ page import="java.sql.*,java.util.*" %>
    <%@ page import ="javax.servlet.*"%>
    <%@ page import ="javax.servlet.http.*"%>
    <html dir="rtl">
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    </head>
    <body>
    <p dir="ltr">
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <font size="5">Your Name is :<%= user.getUsername() %> <BR></font>
    </p>
    </body>
    </html>
    can anyone help plz?

    I am also facing the same problem. Try placing ur
    class files in tomcat's /common/classes folder.
    Sometimes it works. How ever it did not work in my
    case. Hope it works in your!!This ain't a right way of doing it... when creating a web-app, the files should be contained in it.
    The problem is can be resolved by packaging the class in say beans. Then place that class in WEB_INF/classes/beans.
    Cheers!
    ***Annie***

  • Where to retrieve the downloaded files?

    Hi All,
    I m E61i user. I have no ideas where to find the downloaded files? I m appreciate that someone from the forum help me on this matter.

    Hi deenesh,
    I assumed you are using iPlanet Application Server.You can put jsp file in
    ..war file and deployed it.
    just go thru fortune sample it will give you the better Idea.
    please get back to me if it you have any question.
    thanks
    Deepak
    deenesh wrote:
    hi everyone,
    when installing iplanet, i am not able to figure out where to put the jsp
    files such that the iplanet can recognise it. I know this may seem a sillty
    question, but i need the answer urgent.
    thanks in advance

  • Where do I put the .jar file for the database connection?

    I am trying to connect to an Oracle 11g database. I see under the coldfusion settings summary that the java version is 1.7.0_55. So I downloaded the ojdbc7.jar file from Abode.com. Now the question is where do I put it so that coldfusion can access it?
    Of course I need to set up the database connection (which I still don't have the connection string for), but I still need to know where to put the ojdbc.jar file.
    Thanks.

    jasonwryan wrote:What does the man page say?
           The  program  has builtin defaults and temperature thresholds but users
           can   specify   their   own    settings    in    configuration    files
           /etc/default/i8kmon  and  ~/.i8kmon.   The daemon defines 4 states with
           different fan speeds ({0 0}, {1 0}, {1 1}, {2 2}) and  for  each  state
           are  defined  the temperature thresholds which cause the switching to a
           higher or lower  state.  Furthermore  each  state  can  have  different
           thresholds  for operation on ac power or battery.  For example the fol‐
           lowing configuration:
    I've put the following file in /etc/default/i8kmon:
    # Run as daemon, override with --daemon option
    set config(daemon) 0
    # Automatic fan control, override with --auto option
    set config(auto) 1
    # Report status on stdout, override with --verbose option
    set config(verbose) 1
    # Status check timeout (seconds), override with --timeout option
    set config(timeout) 1
    # Temperature thresholds: {fan_speeds low_ac high_ac low_batt high_batt}
    set config(0) {{-1 0} -1 50 -1 50
    set config(1) {{-1 1} 50 70 50 70}
    set config(3) {{-1 2} 70 128 70 128}
    But it doesn't seem to do anything. I'm running a Dell Inspiron 3521 with no dedicated GPU, so it only has one fan. I was somehow able to get i8kmon to work in Ubuntu by putting this config in /etc/i8kmon, but can't get it to work in Arch. Putting it in /etc/i8kmon and /etc/default/i8kmon doesn't do anything.

  • Where to put the GIF/JPG files so they show up in Forms Developer

    Hi:
    This refers to Forms 10gR2; Forms Builder running on Windows XP......
    Where do I put the GIF and JPG files referenced by the "iconic filename" property so that they show up in Forms Builder? By placing them in the jar file, I can get them to appear at runtime, but NOT in development!
    I have tried putting the files in the same directory as the FMB, as well as in C:\DevSuiteHome_10g\forms\java (where the image jar file resides).
    In each case, I have included the path in the FORMS_PATH environment variables.
    Thanks

    Hi,
    For design time, you need to use the UI_ICON and UI_ICON_EXTENSION environment variables. Set them in the registry.
    UI_ICON=location where you have the image files.
    UI_ICON_EXTENSION=Extension of your image files (ICO / GIF / JPG)
    Edit :
    Refer : http://www.oracle.com/technology/products/forms/pdf/10g/frm10gnewfeatures.pdf
    Search for UI_ICON and UI_ICON_EXTENSION
    -Arun
    Edited by: Arunkumar Ramamoorthy on Jan 26, 2010 6:26 PM

  • Where to put the Transform.xsl File

    Good evening!
    I am trying to execute a bpel:doXslTransform(xslURI,$a) and i dont know where to put the transform.xsl file for this operation.
    Can anybody tell me?
    Greetz,
    RaRu

    It needs to be in the same folder as the .bpel process - the bpel folder of your project.
    Hope this helps,
    Shanmuhanathan Thiagaraja

  • Where should I put the configuration file?

    Hi
    I'm developping a web application using IBM's websphere as my application server. My application reads configuration information from a properties file.
    My question is: what's the right location to put the configuration file? Should I provide a fixed path, or should I just put in the webserver's execute directory?
    Thanks in advance
    Pedro

    I'd consider what the configuration file is cheifly
    tied to.
    If there are only a small number of parameters then
    put them into the web.xml as initial parameters and
    access then via servlet cotext.
    If they are tied to some class, then I'd put the
    properties file next to the relevant class file and
    use getClass().getResourceAsStream().
    If they relate to the web-app as a whole, I'd put
    them in the WEB-INF directory and access then using
    getServletContext().getResourceAsStream("WEB-INF/xxx.p
    roperties");The one thing you definitely shouldn't do is use an
    absolute file path.Thanks for the reply.
    Forgive my ignorance, but how can I access getServletContext from my web application?
    Thanks again!

  • LSMW update vendor account just if the actual (old) is in the txt file

    I want to update the vendor account but just if it is the same I have in the txt file.
    My txt file is the fllowing for example:
    Vendor - Old Account - New Account
    A2
    A123
    A321
    A1
    A133
    B321
    A3
    A144
    C321
    So, for each vendor if the actual bank account number is (old account in the file) replace the actual (old account) with the new account.
    In the CODE text for LSMW (check my attach) I have this:
    IF FK02A-BANKN_01 = CTAS-BANKN. FK02A-BANKN_01 = CTAS-BANKNNUEVO. ENDIF.
    Where:
    FK02A-BANKN_01 is the FK02 text for vendor account
    CTAS-BANKN is in my file and structure defined the OLD ACCOUNT
    CTAS-BANKNUEVO in my file and structure defined the NEW ACCOUNT (the one should be now)
    But it is not replacing, if i check converted data, this field is empty. So the if is not working. Ideas?
    I changed it by
    FK02A-BANKN_01 = CTAS-BANKN
    or
    FK02A-BANKN_01 = CTAS-BANKNNUEVO
    and it works, but put the old or the new code of course, not doing the comparation with the old and replacing with the new.

    exact, similar to what I showed and described in my blog LSMW Long text load by Direct Input method
    and you must not forget that the account in the database is stored with leading zeros in case of numeric account and less than 10 long, so there is another potential risk that it wont match without doing an extra conversion of your source field content.

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • I changed my iPhone lately but i can't restore my last backup since it keeps saying "itunes could not restore backup because the password was incorrect" but I don't know where to put the password to make it happen... Any suggestions?

    Hey guys,
    I just bought a new iPhone but i can't restore my backup files beacuse it keeps saying "itunes could not restore backup because the password was incorrect" but I really don't know where to put the password to restore it. I really have some files that are meaningful for me so I really need help. Any suggestions anyone?

    Select your iDevice in the iTunes.
    Choose the Summary screen (tab) and scroll to the bottom of the screen.
    Then un-select Encrypt iPhone backup.
    iTunes will then prompt you to “Enter the password to unlock your iPhone backup”, enter the password you set originally.

  • Hello there, am new here and very stressed, i have an Imac core i3 which is logging off itself after a few seconds of login, it goes back to the login menu where i put the password. I have tried to repair the os but my pioneer rom is not reading the disk.

    Hello there, am new here and very stressed, i have an Imac core i3 which is logging off itself after a few seconds of login, it goes back to the login menu where i put the password. I have tried to repair the os but my pioneer rom is not reading the disk. I press the :c" button on startup but its not picking up the disk in the rom, i have tried to put the disk in an external rom but same answer, am starting to think that my os disk is bad. Please help me.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of this exercise is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login. Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, or if a firmware password is set, you can’t boot in safe mode.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

Maybe you are looking for

  • Oracle Security Implementation in JDev 10.1.2.0.0

    Dear J Dev Fellows I am New to J dev. Having version mentioned in title. I want to implement oracle security for multiple users. Please guide me to achieve this. Aamer

  • How to know what files to import?

    Basically, I know how to import packages into the script, but how do you find out what packages does what, is there a list or like any table showing this, for example what would you need to import to draw graphics such as rectangles triangles ets. Th

  • Part 1: Instrument Not Found

    Hi At start up I get this message. In three songs actually. I don´t seem to miss any instruments in the songs. What is it? JanD

  • Regarding Enterprise Portal Page

    Hi All, In the portal, I have a role called "Repository", which has some 5 pages. For example if there is a page called "project". I want the "project" page to be displayed for only some users and not for some users. How can i customize the pages ins

  • Lion Causing App Issues - Gestures

    Hi, After installing Lion I found that 90% of my apps would crash within the 1st 20 seconds, i went to the Apple Store & spoke to a tech guy there & he said for me to re-install Lion again, which I've done. All was fine until I reset, now the problem