To my knowledge, you can't. When you use getResourceAsStream, it's going to find the data somewhere in the classpath (including JARs), and to my knowledge, there is no way to get the 'physical' location of the resource that you accessed, and I don't even know how you would represent that if the resource came from a JAR.

IIRC, there is a preferences API you can use to store the save folder and file name and maybe you could use that?

actually I was pretty straight forward. Can I save to a text file from a class without having to use the entire path for the file(c:\asdsad\asdsafd\filename.ext)

You can do it to read a file(Class.class.getResourceAsStream(filename)) and this knows you are coming from the location of the class file. As for topic location...I didnt see another topic that fit. sorry

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org