If you're writing a quick script, there's absolutely no point to caching those exceptions in Ruby—it's just going to cause your program to continue when it otherwise should have quit out due to an error condition outside of its control. Java's checked exceptions breeds overly defensive programming like this.
Anyway, here's a slightly better ruby version:
File.readlines('file.txt').each do |line|
puts(line)
end
Notice how I don't have to worry at all about constructing or manipulating a Path object, which I find to always be a very tedious part of file IO in Java. It's fully correct, sure, but for a web server that's only ever going to be deployed on Linux containers or a 50 line CLI script that's trying to wring a useful task out of some Java-only library, it's just insane overkill. The only thing worse then using Paths objects is trying to figure out which file calls do and don't work with path objects and which need to be converted to some other class that does the exact same thing.
Notice also how this is much more equivalent to the Java example provided, except it also consumes the file so you don't have to worry about introducing a new syntax construct to understand how the file gets closed. (Same, incidentally, with the File.open case, which just reuses a standard ruby block instead of introducing a new magic try statement that autocloses the file). You lose laziness, but you can get it back by using File.foreach instead, at the cost of a little bit of readability