Skip to content

FileNotFoundException when running ExecuteAround main method in chap3 package #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RickyGo opened this issue Apr 3, 2015 · 2 comments

Comments

@RickyGo
Copy link

RickyGo commented Apr 3, 2015

I think that replace "lambdasinaction/chap3/data.txt" with ExecuteAround.class.getResource("/lambdasinaction/chap3/data.txt").getPath() should solve the problem.

@ghost
Copy link

ghost commented Aug 17, 2015

Swap out new FileReader("lambdasinaction/chap3/data.txt") with new InputStreamReader(ClassLoader.getSystemResourceAsStream("lambdasinaction/chap3/data.txt")) and it works correctly.

And this worked for me too.

Files.newBufferedReader(Paths.get(ExecuteAround.class.getResource("/lambdasinaction/chap3/data.txt").getPath()))

@felipealvesgnu
Copy link

felipealvesgnu commented Sep 15, 2017

You can swap for :
try (BufferedReader br = new BufferedReader(new FileReader("src/main/resources/lambdasinaction/chap3/data.txt"))) {
with absolute path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants