Here’s what you should do instead:
Put that file back in your jar file. Use class.getResourceAsStream()
to read it instead of File
and FileReader
. Here is an explanation of how to do that: How to really read text file from classpath in Java
More Related Contents:
- Reading a resource file from within jar
- How to get the path of a running JAR file?
- How to make an executable JAR file?
- Running JAR file on Windows
- “Invalid signature file” when attempting to run a .jar
- How to list the files inside a JAR file?
- Execute another jar in a Java program
- What causes “Unable to access jarfile” error?
- Creating runnable JAR with Gradle
- Why is my URI not hierarchical? [duplicate]
- Execute .jar file from a Java program
- How to get names of classes inside a jar file?
- Reference jars inside a jar
- Access file in jar file?
- How to read a file from a jar file?
- Visual Studio Code, Java Extension, how to add a JAR to classpath?
- How to copy file inside jar to outside the jar?
- NoClassDefFoundError while trying to run my jar with java.exe -jar…what’s wrong?
- Java command line with external .jar
- “Could not find the main class” error when running jar exported by Eclipse
- Accessing a file inside a .jar file [duplicate]
- How to run a class from Jar which is not the Main-Class in its Manifest file
- Double Clicking JAR file does not open Command Prompt
- How to use a file in a jar as javax.net.ssl.keystore?
- Run a jar File from java program
- How to copy files out of the currently running jar
- Why does my JAR file execute at CMD, but not on double-click?
- Read directory inside JAR with InputStreamReader
- How to read file from relative path in Java project? java.io.File cannot find the path specified
- Run exe which is packaged inside jar file