4 ms·
Which is a bummer because JDK 9 added some nice convenience functions to the standard library. Like "transferTo" to avoid using like 6 utility functions just t
by owyn 8y ago
Which is a bummer because JDK 9 added some nice convenience functions to the standard library. Like "transferTo" to avoid using like 6 utility functions just to move bytes around. It's stuff like this that will compile on JDK9 but won't run on JDK8 because the stdlib method isn't there that you kind of have to watch out for when deploying stuff on a machine that might be running an old JDK. But in general my engineering philosophy is it's usually worth it to keep things up to date, even if it's just because it makes the engineers happier.
InputStream in = Main.class.getClassLoader().getResourceAsStream(filename);
try {
OutputStream out = new FileOutputStream(file);
in.transferTo(out); // new in jdk 9!
out.close();
} finally {
in.close();
}
- JohnFen 8y agoI understand your point. But realistically, if none of our customers want or can use anything beyond 8, the safest thing for us to to is to avoid upgrading our dev environment beyond 8. That way, nobody could accidentally use incompatible features. Personally, though, I really dislike Java regardless of the version being used. I'm hoping that some day I'll be able to foist this aspect of my job off on someone else -- then I won't have to worry about it!