Jump to content

Recommended Posts

Posted

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

Posted

is that file part of the jar or classpath, if not then your code will not work.

Posted

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.

 

Posted

try these, where MyClass is your class

 

InputStream file = MyClass.class.getResourceAsStream("lib/ABC.lic")
InputStream file = MyClass.class.getClassLoader().getResourceAsStream("lib/ABC.lic")

Posted

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")

 

Posted

linux command cheppav enti lolz

I'm lifting the thread re.. ls -lrtpWGAMeu.gif

Posted

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 

Posted

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

Posted

i think you have to use the absolute path

Posted

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

Posted

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

  • Upvote 1
Posted

em error vasthundhi??

if its file not found, check the path in debug mode or print the path once. 

×
×
  • Create New...