---
title: "Discussion on \"Reading from a file within a JAR\" | Hashnode"
description: "Discussion on \"Reading from a file within a JAR\". TL;DR:\nWhen reading resources from a file in Java it is better\nto use an `InputStream` rather than a `File`.\nUsing `InputStream` allows you to read content\nregardless of where the resource file is located.\n\nRecently in one of the projects I'm working..."
url: "https://hashnode.com/posts/reading-from-a-file-within-a-jar/63d19a402c958aaf7e4699a5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Reading from a file within a JAR](https://blog.birgitkratz.de/reading-from-a-file-within-a-jar?utm_source=hashnode&utm_medium=feed)

TL;DR: When reading resources from a file in Java it is better to use an \`InputStream\` rather than a \`File\`. Using \`InputStream\` allows you to read content regardless of where the resource file is located. Recently in one of the projects I'm working...

Jan 25, 2023 · 4 min read · blog.birgitkratz.de  
Read the article

-   [#springboot](https://hashnode.com/tag/springboot)
-   [#java](https://hashnode.com/tag/java)

## Written by

[Birgit Kratz](https://hashnode.com/@bkratz)

@bkratz · Dormagen, Germany

  
[View profile](https://hashnode.com/@bkratz)

Freelancing Java developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
