[b]Need to access a file which is not specified in the classpath[/b]

Hi everybody ,
I need your help to proceed with my application. I've tried accessing a file without setting it in Classpath using getResourceAsStream(..), but i'm getting an error.
error :
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:61)
at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
at abc.func(LoadProp.java:13)
at LoadProp.main(LoadProp.java:35)
Application :-
import java.io.* ;
class test
public void func(String file )
String thisLine ;
try
InputStream is = test.class.getClassLoader().getResourceAsStream(file);
System.out.println("File load successful");
BufferedReader myInput = new BufferedReader(new InputStreamReader(is));
while ((thisLine = myInput.readLine()) != null) {
System.out.println(thisLine);
catch (Exception e)
System.out.println("Inside Catch");
e.printStackTrace();
public class LoadProp
public static void main(String args[])
String testname = System.getProperty("propfile");
System.out.println(testname);
test t = new test() ;
t.func(testname) ;
System.out.println("End Main!") ;
Output:-
test.properties
File load successful
Inside Catch
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:61)
at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
at test.func(LoadProp.java:13)
at LoadProp.main(LoadProp.java:35)
End Main!
Anyone of you help me to get rid of this problem..
Thanks & Regards
BK

It has to be in the classpath for getResourceAsStream
to "get" it.So if your question is really about needing to read a file which is not in the classpath and won't be, then as long as you have the path to that file, just use FileInputStream to read it.
InputStream is = new FileInputStream(pathToFileHere);

Similar Messages

  • JUNIT test failure-Configuration file bc4j.xcfg not found in the classpath

    Hi All,
    As part of an ESS project,Im having a model project containing a VO(parameters VO).This VO is configured to have Read-only access through SQL query and have only one transient attribute each.For the model projects containing the VO for pre merge checker compliance I had to create JUNIT Test projects containing new AMs for testing the parametersVO. While running the JUNIT tests I got an exception like
    “oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.ConfigException, msg=JBO-33001: Configuration file /oracle/apps/hcm/goals/core/dataMigration/publicEssModel/test/applicationModule/common/bc4j.xcfg is not found in the classpath.”.—even though this file is contained in both the src/classes folder of the project.
    When i try to run the TestAM I'm getting an exception like 'configuration tester.xcfg not found in the calsspath.
    While debugging this error, we found that we are able to successfully run the JUNIT tests if we make some changes in the adf-config.xml file of the Application. The change required is to comment out the mdsC:adf-mds-config tag in the xml file.
    After doing this change Im also able to run my AM without any exception.
    Is this a known issue?.
    Since modifying the adf-config.xml is not a recommended practice is there any workaround that we can get rid of this exception.
    Regards,
    Ajin.

    Just checked but could only find this thread Unable to run ADFBC JUNIT Test Classes with JDEV11G 11.1.1.6
    As it's also dealing with junit and 11.1.1.6.0 you might want to read it.
    Timo

  • Configuration file bc4j.xcfg not found in the classpath.

    When i try to run an application that uses ADF BC i get an error telling me the bc4j.xcfg was not found.
    When i open my AppModule and click the bc4j.xcfg link it opens. When i look at the path it stored in, it is different from the path the error says.
    It's something like this:
    Configuration file /be/something/model/common/bc4j.xcfg is not found in the classpath
    but my appModule opens the bc4j.xcfg in a different folder:
    /be/something/utility/common/bc4j.xcfg
    It's a fact i modified the project and managed the packages a bit but i always used the refactor menu of jdeveloper in order to move or rename files.
    It appears that something has failed while moving/changing name.
    I looked inside my project to look for references for bc4j.xcfg but i can't find any so i can't see were to change the directory he needs to look for the bc4j file.
    How do i fix my project?

    John,
    In the DataBindings.cpx i can't find any reference to a datacontrol...
    This is my bindings:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Application xmlns="http://xmlns.oracle.com/adfm/application"
                 version="11.1.1.56.60" id="DataBindings" SeparateXMLFiles="false"
                 Package="be.usermanagementProv.portlets" ClientType="Generic">
      <definitionFactories>
        <factory nameSpace="http://xmlns.oracle.com/adf/controller/binding"
                 className="oracle.adf.controller.internal.binding.TaskFlowBindingDefFactoryImpl"/>
        <dtfactory className="oracle.adf.controller.internal.dtrt.binding.BindingDTObjectFactory"/>
      </definitionFactories>
      <pageMap>
        <page path="/UserManagement/view.jspx"
              usageId="be_usermanagementProv_portlets_viewPageDef"/>
      </pageMap>
      <pageDefinitionUsages>
        <page id="be_usermanagementProv_portlets_viewPageDef"
              path="UserManagement.viewPageDef"/>
      </pageDefinitionUsages>
    </Application>In the datacontrol section when i right click the DC the "edit definition" is grayed out. Probably because the DC comes from the library and is not created in the application.

  • I need to access a file which is present in LAN of our office.

    Hi,
    In windows I could access a remote file by giving the local IP address in the RUN command and then by giving the username and password I was able to access the files in the local server. But not able to do the same with my iPad?
    Ex: In windows in RUN Command I used to type // 192.168.1.100 ( my local server) after which I used to get a window showing username and password. Once I entered the username and password I was able to access the remote files on this IP and work accordingly.. This I'm not able to do in my IPad?
    Kindly give me a solution?

    There may be some apps in teh app store that would provide this, but no, you will not be able to do it with native iOS functionality.

  • Need to access a context_node in an another view of the same component

    Hi experts,
    I need to access a context_node which is not in my view but it exist in an another view of the same component.
    The component is ICCMP_BP_DETAIL.
    i need the context_node "CUSTOMER" from the view Bupadetail to view Bupacreate. so that i can make those context_node Attributes available in the configuration screen.
    regards,
    chella.

    Hi Chella,
    You can access the context node from other view using the custom controler or getting a context node from view that you are and use the method get_parent(to get predecessor objet) or get_related_entity(to get sucessor object).
    I think the second way is easier.
    Use transaction GENIL_MODEL_BROWSER and GENIL_BOL_BROWSER to know in wich object you are and where you have to go!
    Best regards,
    Caíque Escaler

  • Error: Configuration file /model/common/bc4j.xcfg is not found in the classpath???

    Hi Everyone,
    My Jdev version is 11.1.2.3.0.
    I have developed one ADF application and was working very fine.
    But the Jdev got crashed so i re-installed the same version but the application which was running earlier is not working now. I tried by installing different versions of Jdevelopers but none seems worked for me.
    Error is given below:
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Configuration file /model/common/bc4j.xcfg is not found in the classpath.
    oracle.jbo.ConfigException: JBO-33001: Configuration file /model/common/bc4j.xcfg is not found in the classpath.
    at oracle.jbo.client.Configuration.loadFromClassPath(Configuration.java:471)
    at oracle.jbo.common.ampool.PoolMgr.loadConfiguration(PoolMgr.java:600)
    What is this error about?
    How can i solve this error t make my application to run?
    Please give ur valuable suggestions...
    Thanks.

    Configuration file bc4j.xcfg not found in the classpath.

  • I have a new Apple TV which is working fine except that I cannot access .mov files which are in my iTunes Library. How can I get to these? I can run them on my computer and select Apple TV on the screen, but the Apple TV goes to a black screen

    I have a new Apple TV which is working fine except that I cannot access .mov files which are in my iTunes Library. How can I get to these? I can run them on my computer and select Apple TV on the screen, but the Apple TV goes to a black screen

    Mov is a container format, you'd need to look at the codec used by the movie file inside the container to know whether it will work with the Apple TV or not.

  • The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? is there a cable i can connect to another mac that will let me transfer the file?

    The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? The mac turns on the screen freezes as bright blue.  Is there a cable i can connect to another mac that will let me transfer the file?

    There is another option if the Macbook will start up in Target Disk Mode.
    Restart the computer while holding down the T key. If you see the firewire symbol moving around on the screen you can connect this one to another one in TDM. You will need a suitable cable to connect the two Macs.
    http://support.apple.com/kb/ht1661
    Firewire symbol:

  • HT3702 Why can't I download my already purchased music and other files from iCloud, even though I owe money to iTunes for my most recent purchases.  Doesn't seem right that they keep me from accessing those files which I've already paid for!

    Why can't I download my already purchased music and other files from iCloud, even though I owe money to iTunes for my most recent purchases.  Doesn't seem right that they keep me from accessing those files which I've already paid for!

    - Are you saying that they are not listed in your Purchased section?
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    - Are they listed in your Puchases history when you log into your account on your computer?
    - Are they still available now for purchase? If not then you are out of luck
    If they are still available and listed in your Puchase History then contact iTunes
    http://www.apple.com/support/itunes/

  • Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer? Then can i access these files only on the time capsule without connecting it?

    Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer? Then can i access these files only on the time capsule without connecting it?

    igonneau wrote:
    Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer?
    You can, but how are you going to back up those other files?  When (not if) your Time Capsule fails, you risk losing them.  See #Q3 in Using Time Machine with a Time Capsule for details.
    Then can i access these files only on the time capsule without connecting it?
    Not sure what you mean.  You have to connect a computer, either via Ethernet cable or wirelessly, to read or write to the disk. 

  • I need my application to be able to open a .pdf file which was previously synced to the iBooks PFDs Collection. I then wish to remove the file from the collection and send it to email.

    I need my application to be able to open a .pdf file which was previously synced to the iBooks PFDs Collection. I then wish to remove the file from the collection and send it to email.

    I opened one of the PDF files in notepad and these are the first couple lines:
    瀖ᕁމጿ␠씴豈䧉筩롈ꓳ劏ꎯ僪뚢頟뻏즏谀㿃夑퀉꟠鲲쮂⫉笿褡밤籞冁탁ӓ轸뿐笼ⵆ횰䄌ඁ淥ة寨闤⬅鳦팥링빨嬄敎უ婏㣴ً鮓ࣿꢚ㑀녲莒඼ိȆ䕇纍쉉籶뺝갞伐쮠᥏﯒넉釖ȓ겴☧ ἣ秵駻�䣞띰㖔流羀籔朼敨ꢉ糶당⬤俉膇䄐惡�ಹꛖ鍡恡ⱶᶜ�堷﹑ﱌ僿걄뎔æ䋷귪⛢⫐䅪䉙὿烶ꖆ႟ᗔ瘞狻틫儩六잶覱낵듘盋崾�ᦜ㺆௹뻹燴ឋ騙쬄ꏿ뽒煹�钼뇲腎稦ꃲ㈃沒ꔈ뺐뛽첑䘶畱䍣紻 ⁜哠鳾

  • Unable to access pdf files which were previously accessable.

    I have discovered a direcotry of PDF files that are archives of documents produced and accessable normally with even a reader version of Adobe. I have accessed these files easilly and without issue in the past. I have tried to access some of these documents today and they are all unaccessable.
    They are located on a network drive in one directory and its subdirectories.

    The message was
    "Acrobat could not open ........ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF"

  • I have tried to view videos created in premiere elements 10 and I get the following message: "this file type is not supported, or the required codec is  not installed.  When it opens there is a red screen in the monitor panel with Korean writing which als

    I have tried to view videos created in premiere elements 10 and I get the following message: "this file type is not supported, or the required codec is  not installed.  When it opens there is a red screen in the monitor panel with Korean writing which also appears in the place of each clip in the video.  I tried uninstalling and reinstalling premiere elements 10, but that did not have any effect on the video.  Do you have any suggestions?  I researched codec, but do not understand them at all.

    gloucester
    In case you did not find it, the following is a copy/paste of the Announcement on Premiere Elements 19/NVIDIA GeForce
    that appears at the top of this forum.
    Premiere Elements 10 NVIDIA Video Card Driver Roll Back
    If you are a Premiere Elements 10 user whose Windows computer uses a NVIDIA GeForce video card and you are experiencing
    Premiere Elements 10 display and/or unexplained program behavior, then your first line of troubleshooting needs to be rolling
    back the video card driver version instead of assuring that it is up to date.
    Since October 2013 to the present, there have been a growing number of reports about display and unexplained workflow
    glitches specific to the Premiere Elements 10 user whose Windows computer has a NVIDIA GeForce video card. If this applies
    to you, then the “user to user” remedy is to roll back the NVIDIA GeForce video card driver as far as is necessary to get rid of
    the problems. The typical driver roll back has gone back as far as March – July 2013 in order to get a working Premiere
    Elements 10. Neither NVIDIA nor Adobe has taken any corrective action in this regard to date, and none is expected moving forward.
    Since October 2013, the following thread has tried to keep up with the Premiere Elements 10 NVIDIA reports
    http://forums.adobe.com/thread/1317675
    Older NVIDIA GeForce drivers can be found
    http://www.nvidia.com/Download/Find.aspx?lang=en-us
    A February 2014 overview of the situation as well as how to use the older NVIDIA GeForce drivers for the driver roll back can be found
    http://atr935.blogspot.com/2014/02/pe10-nvidia-video-card-roll-back.html
    ATR

  • I need to install iWork 09 so I can open the many pages document files that will NOT open under the new pages 5. Mavericks will not accept an install from my iWork's 09 CD. How do I get around this?

    I need to install iWork 09 so I can open the many pages document files that will NOT open under the new pages 5. Mavericks will not accept an install from my iWork's 09 CD. How do I get around this?

    Hi, I'm helping StringSinger2 with this problem.
    The previously installed version is Pages 3.0.3 (the same as from iWork 08). This version (Pages 3.0.3/iWork 08) is incompatible with Pages 5.
    That is why it would be helpful to install iWork 09, which is the version between the two. It will open the older 08 files, and its saved files are readable by the new Pages5.
    SO...
    When I try to install iWorks 09 from my retail DVD the error message is "the installer is damaged". (I know the dvd is good, I installed iWorks09 to my laptop today.) Is the "installer" part of the system files? And - If that is damaged is there a patch for that?
    Many Thanks!

  • I have just updated to LR5.  I also have a new Camera.  Nikon D800.  Trying to import directly (from camera) into LR.  But unsuccessful. Getting the following message.  "The files are from a camera which is not recognised by the raw format support in Ligh

    I have just updated to LR5.  I also have a new Camera.  Nikon D800.  Trying to import directly (from camera) into LR.  But unsuccessful. Getting the following message.  "The files are from a camera which is not recognised by the raw format support in Lightroom."  How can I import please?

    Hi,
    I assume you mean the Nikon D810 because D800/800E support has been there since Lightroom 4.1
    Currently, because it is a new camera (D810) the only support is in a RC of ACR 8.6 for Photoshop CS6 and CC, as the RC runs out on 31 August it is expected support will be there in the next dot release of Lightroom.
    Current limitations are that only full sized NEF is supported.
    If you wish to import to Lightroom 5.5. you will need to download the DNG Converter v8.6RC and convert the NEF files (full size RAW ony) to DNG then import into Lightroom 5.5

Maybe you are looking for