[ACCEPTED]-How can i Get file path in some java package?-java
Accepted answer
denemeJasper.class.
getResource
("reportDeneme.jasper").
getPath
()
If you need the path for reading the file's 5 contents, it would be simpler (and safer) to 4 use getResourceAsStream()
and avoid having to deal with paths 3 entirely.
BTW, your class denemeJasper
violates ubiquitous 2 Java naming standards; as a class, its name 1 should start with an uppercase letter.
The might be better off with a relative 4 path, but the absolute path would be:
String fullpath = "/jasper/deneme/reportDeneme.jasper";
'/'
replaces 3 '.'
in the package name whether the resource 2 is located in a file, a jar or by any other 1 means.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.