I am trying to read in a file, but I get a NullPointerException

I was just wondering what I need to do to fix a NullPointerException in line 9
import java.io.*;
import java.util.Scanner;
public class Driver {
     public static void main(String [] args){
          String input;
          InputStream as6in1 = Driver.class.getResourceAsStream("as6in1.txt");
          Scanner file = new Scanner(as6in1);
          input = file.nextLine();
          do{
               System.out.println(input);
               input = file.nextLine();
          while (file.hasNext() == true);
}EDIT: Nevermind, I fixed it...
Edited by: Volt01 on May 1, 2008 12:49 PM

what is Driver.class?

Similar Messages

  • I'm trying to open a PDF file but keep getting error message "Access denied."  Help.

    Every time I try to open a PDF attached to an email I get the error message "Access denied."  How do I fix this?

    Actually my son directed me to a help site run by a guy named Brian Stevenson.  Here is what I did --
    1.  Launch Adobe Acrobat Reader XI
    2. Go to Edit>Preferences
    3.  Click on Security (Enhanced)
    4. Uncheck "Enable Protected Mode at startup"
    5. Click Yes when dialog box open to remind closing of application
    6. Click OK to save
    7. Exit Adobe Reader
    Worked like a charm!!

  • Error 7 occurred when trying to read a spreadsheet file in LabVIEW

    Hi,
    I got the message (in bold) below when I was trying to read a text file type. I also include a snippet of my block diagram.
    Error 7 occurred at Open File+.vipen File
    Possible reason(s):
    LabVIEW:  File not found. The file might have been moved or deleted, or
    the file path might be incorrectly formatted for the operating system.
    For example, use \ as path separators on Windows, : on Mac OS X, and /
    on Linux. Verify that the path is correct using the command prompt or
    file explorer.
    I really appreciate if someone can help me. Thanks.
    Attachments:
    read from spreadsheet.png ‏70 KB

    Hi Ravens Fan,
    Thanks again for your valuable input. I replaced the string manipulation functions with a path control. I think it works coz I can see the waveform data, rms values etc. And then you said if it works, do a Path to String on that...and I'm not exactly sure how to do that. I attached a snippet of the modified vi. you may refer the original vi snippet in my previous email.
    I appreciate it if you could help me again.
    Thanks.
    Attachments:
    read from spreadsheet2.png ‏283 KB

  • When I try to install Itunes, I get this error: (translated from Norwegian) There was a network error while trying to read from the file: C: \ windows \ installer \ iTunes.msi I have tried many times to reinstall, but nothing helps, please help me.

    When I try to install Itunes, I get this error: (translated from Norwegian) There was a network error while trying to read from the file: C: \ windows \ installer \ iTunes.msi I have tried many times to reinstall, but nothing helps, please help me.

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Hi. I was trying to open some pdf files and got a message my adobe reader was deinstalled. I installed a new version of Adobe Reader for Mac and when trying to open a PDF file I am getting a message in a foreign language. Any suggestions?

    Hi. I was trying to open some pdf files and got a message my adobe reader was deinstalled. I installed a new version of Adobe Reader for Mac and when trying to open a PDF file I am getting a message in a foreign language. Any suggestions?

    Are you launching Pages from an icon in your Dock? Installing the update does not change the Dock icons & it does not remove the older versions. Go to your Applications folder & launch the new Pages from there.

  • Trying to read the text file via Flex FileStream.

    Hello,
    I am following the Flex Help and trying to read a text file.
    I have created project called test, and within test.mxml, I have
    created the <mx:script> tags and within I am pasting this
    code yet I get errors:
    What am I doing wrong? Please help.
    Please see the code:

    You cannot do all that complex assignment work outside of a
    function. Because of the way components are generated/compiled, the
    declared vars do not exist when called.
    Declare the vars in instance scope, but use an init()
    function to do the assignments.

  • Trying to read a csv file

    Created a java program to read a .csv file but receiving an error when I try to run it. Here is program:
    import java.io.*;
    class TestRead {
    public static void main(File file) throws FileNotFoundException
    {try
         {FileReader fr = new FileReader(file);
       StreamTokenizer st = new StreamTokenizer(fr);
       BufferedReader br = new BufferedReader(new FileReader("C:/upload/DS121002.csv"));
       String line = br.readLine();
       System.out.println(line);
       while (line != null)
          { line = br.readLine();
    } catch (Exception ex)
         { ex.printStackTrace(); }
    Here is the error I am receiving:
    C:\jakarta-tomcat-4.0.3\webapps\webdav\WEB-INF\classes>java TestRead
    Exception in thread "main" java.lang.NoSuchMethodError: main
    C:\jakarta-tomcat-4.0.3\webapps\webdav\WEB-INF\classes>
    What am I missing?

    public static void main(File file) throws
    FileNotFoundException a "main" must be:
    public static void main(String[] args)...

  • I am trying to install itunes 10.5 but I get an error message that says click ok to try again or enter an alternate path to a folder containing the installation package iTunes.msi...I try to point iTunes to the .msi file but that is not working.

    i am trying to install itunes 10.5 but I get an error message that says "click ok to try again or enter an alternate path to a folder containing the installation package iTunes.msi..." I try to point iTunes to the .msi file on my c drive but then it gives me  a message says "the file location is not a valid installation packaage for the product iTuness.  Try to find the installation package 'itunes.msi' in a folder from which you can install iTunes".  Any help, insight, guidance would be greatly appreciated!!

    "The feature you are trying to use in on a network resource that is unavailable. Enter alternate path to a folder containing the installation package itunes64.msi".
    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I am trying to save a mp3 file but firefox does not allow me to save it...it allows me to play the file but not download and asave it to my computer. How do I enable it to save mp3 files on my computer?

    I am trying to save a mp3 file but firefox does not allow me to save it...it allows me to play the file but not download and asave it to my computer. How do I enable Firefox to save mp3 files on my computer?

    Go to Options>Applications tab > search MPEG Layer 3 audio(audio/mpeg) > use "Save File" option on drop down menu.

  • Why is my diabled login greyed out after i unlock it? I have tried to remove the library file but it doesn't work

    Why is my diabled login greyed out after i unlock it? I have tried to remove the library file but it doesn't work. It worked the first time and than all of a sudden it was greyed out.

    Where do you see a disabled login? In system preferences? In Login screen?

  • I'm trying to compress a file but I get an error that "I don't have permission to access dovecot."  How do I get this permission?

    I'm trying to compress a file but I get an error that "I don't have permission to access dovecot."  How do I get this permission?

    I ended up doing just as you said and downloading the program seperately.  However, I'd like to point out that after I downloaded the server.app to my MBA it did allow me to compress it.  For some reason it wouldn't let me do it from the server so I could airdrop it over.  I'd only get the error previously mentioned.  Must be a server thing eh?

  • Trying to download some adobe files, but find that safari doesn't do it. Any ideas??

    Trying to download some adobe files, but find that safari doesn't do it. Any ideas??

    If you are trying to download flash player then you can't - it's not supported and probably never will be (http://www.apple.com/hotnews/thoughts-on-flash/ and Adobe have failed to create a version that works on iOS), and you can't download extensions/plug-ins via Safari anyway (you can only install what is available in the App Store).
    The Skyfire, iSwifter, and Puffin browsers work on some flash-based sites (but not judging by their reviews), or you could look to see if the sites have their own apps in the store.

  • HT201066 QuickTime: I'm trying to open a .WMV file and I get the following message.

    I'm trying to open a .WMV file and I get the following message.
    "The document “.wmv” could not be opened. The movie is not in a format that QuickTime Player understands.  You may need to download additional software.

    Two other possibilities.
    Video Player - Divx
    Video Player - VLC

  • After updating os to 10.9.1can't open pdf files.  I get a message saying It may be damaged or use a file format that Preview doesn't recognise. I can still read older saved files but no new ones arriving by email.  Any help would be appreciated.

    After updating os to OSX 10.9.1 I can't open any new pdf files.  I get a message saying It may be damaged or use a file format that Preview doesn’t recognise. I can still read older saved files but no new ones arriving by email.  Also can't attach a pdf to an email to send out.  Any help would be appreciated.

    Back up all data before making any changes. Please take each of the following steps until the problem is resolved.
    Step 1
    If Adobe Reader or Acrobat is installed, and the problem is just that you can't print PDF's displayed in Safari, you may be able to print by moving the cursor to the the bottom edge of the page, somewhere near the middle. A black toolbar may appear under the cursor. Click the printer icon.
    Step 2
    There should be a setting in its preferences of the Adobe application such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected.
    Step 3
    If you get a message such as ""Adobe Reader blocked for this website," then from the Safari menu bar, select
    Safari ▹ Preferences... ▹ Security
    and check the box marked
    Allow Plug-ins
    Then click
    Manage Website Settings...
    and make any required changes to the security settings for the Adobe PDF plugin.
    Step 4
    Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard by pressing the key combination command-C:
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, move to the Trash any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari.
    Step 5
    The "Silverlight" web plugin distributed by Microsoft can interfere with PDF display in Safari, so you may need to remove it, if it's present. The same goes for a plugin called "iGetter," and perhaps others — I don't have a complete list. Don't remove Silverlight if you use the "Netflix" video-streaming service.
    Step 6
    Do as in Step 4 with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari.

  • Cant use adobe reader to open file because i get a window saying i mush agree to the terms an condui

    Cant use adobe reader to open file because i get a window saying i must agree to the term and conditions before i use it.    no place to do this

    Mac HD/Applications
    Double click the Adobe Reader app and accept the agreement.

Maybe you are looking for

  • My entire address book has disappeared, and I don't know how to retrieve it. HELP!!!

    When I tried to address mail to a regular contact, no address appeared. I then opened the address book, and discovered that all my contacts were missing from both collected and personal addresses. How do I get them back??

  • Record video with built in iSight?

    My friend just got a new MacBook and we can't figure out if you can record video with the built in iSight. I know you can take pictures with Photo Booth, and from my research you can record video with the external iSight through iMovie. I figured you

  • Linking iweb within iweb

    I know I read it here but can't find the post. I have too many pages in my menu bar. I would like one photo page to link to another. I have the photos arranged by subject. Thanks for your help! You are terrific. This site is for my pet mission projec

  • Verify that you have access to that directory.

    I am getting the following error when trying to install iTunes 10.5.0.142 on a Windows 7 Professional computer. Error writing to file C:/java/jre1.6.0_05/lib/ext/dns_sd.jar.  Verify that you have access to that directory. How do I fix this? PS.  I do

  • If you clean the camera lenses on both sides of an iPod will it scratch the lenses?

    I have an iPod touch 5th and 4th generation, and I was worried that when I cleaned my camera lenses with my shirt, that the lenses would be ruined or scratched. Pleases help. Thanks a lot in advance.