MysorePak Posted April 21, 2015 Report Posted April 21, 2015 Na project structure lo lib folder vundhi andhulo okka lic version file add chesanu by namr "ABC.lic" so eppudu nenu aa lic file ne java programme lo call chesthunanu but adhi tesukovadam ledhu error throw chesthundhi.. InputStream file = this.getClass().getClassLoader().getResourceAsStream("lib/ABC.lic").. so adhi ela call cheyali aa file ne in java programming lo
afuser Posted April 21, 2015 Report Posted April 21, 2015 is that file part of the jar or classpath, if not then your code will not work.
MysorePak Posted April 21, 2015 Author Report Posted April 21, 2015 Its a file for the jar.... to make jar as a full license version is that file part of the jar or classpath, if not then your code will not work.
afuser Posted April 21, 2015 Report Posted April 21, 2015 try these, where MyClass is your class InputStream file = MyClass.class.getResourceAsStream("lib/ABC.lic") InputStream file = MyClass.class.getClassLoader().getResourceAsStream("lib/ABC.lic")
fake_Bezawada Posted April 21, 2015 Report Posted April 21, 2015 ls -lrt linux command cheppav enti lolz
MysorePak Posted April 21, 2015 Author Report Posted April 21, 2015 still same error... its doesnt work.. usually to call the file in the folder we give absolute path but why its doesnt work...:( looks like i am missing something try these, where MyClass is your class InputStream file = MyClass.class.getResourceAsStream("lib/ABC.lic") InputStream file = MyClass.class.getClassLoader().getResourceAsStream("lib/ABC.lic")
Pichkaari Posted April 21, 2015 Report Posted April 21, 2015 linux command cheppav enti lolz I'm lifting the thread re.. ls -lrt
fake_Bezawada Posted April 21, 2015 Report Posted April 21, 2015 OKA VELA idhi teda kodtundhi anukunta lib/ABC.lic string filePath="lib"+System.fileSeparator()+"ABC.lic; teesuni pass chesi check chey okosari ah file separator daggara teda kottachu
VenkatD Posted April 21, 2015 Report Posted April 21, 2015 still same error... its doesnt work.. usually to call the file in the folder we give absolute path but why its doesnt work... :( looks like i am missing something debug mode lo path oka sari chusko .. forwardslash backwardslash ... change chesi chudu .. give a try ..u never know
kiran karthik Posted April 21, 2015 Report Posted April 21, 2015 i think you have to use the absolute path
afuser Posted April 21, 2015 Report Posted April 21, 2015 debug mode lo path oka sari chusko .. forwardslash backwardslash ... change chesi chudu .. give a try ..u never know backwardslash wil not work still same error... its doesnt work.. usually to call the file in the folder we give absolute path but why its doesnt work... :( looks like i am missing something on another thing you can try is remove lib and just file name and see if that works. getResourceAsStream should look-up based on on file name as well Also try just getResource
afuser Posted April 21, 2015 Report Posted April 21, 2015 debug mode lo path oka sari chusko .. forwardslash backwardslash ... change chesi chudu .. give a try ..u never know in java always try using File.separator instead of guessing forward or bakwardslashs 1
chandu1987 Posted April 21, 2015 Report Posted April 21, 2015 em error vasthundhi?? if its file not found, check the path in debug mode or print the path once.
Recommended Posts