Java Relative Path Issue -


I am facing a problem when trying to solve the file path using relative path in Java. I'm not sure where I have failed, can you get help from me? Thanks!

  @Test Public Null Exempt Object (Nautical) Exceptions thrown {FileReader fileReader = New FileReader (GetClass (). GetResource ("./ JavaPractice / resources / tests / codeeval / fileReaderTest.txt" ) .Wire()); AssertNotNull (FileReader); }   

Exception:

  java.lang.NullPointerException at components.com.codeeval.FileReader.FileReaderTest.testObjectNotNull (FileReaderTest.java13) on the sun. .NativeMethodAccessorImpl.invoke0 (native resident method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)   

Directory structure:

JavaPractice

- resources.tests.codeeval.fileReaderTest.txt (the file that I am trying to access)

- test.components.com.codeeval.FileReader.FileReaderTest.java (that is Janet Trying to use the above file)

Money files are not. They are usually jar file entries. You should use a class or classloader's resource API to return an input stream to you.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -