Java jar getResource not working in linux -


this question has answer here:

same lines of code work in windows not in linux. code run through executable jar file.

  • entries in buildpath: {project}/src,{project}/res
  • project path of test1.java: /src/com/qe/util/test1
  • project path of tc_mapping.xml: /res/tc_mapping.xml

.

package com.qe.util; public class test1{     public static void parsetcmapping(){     ...         string xmlpath = tcdetailsextractor.class.getclassloader().getresource("tc_mapping.xml").tostring();         system.out.println(xmlpath);         inputstream = tcdetailsextractor.class.getclassloader().getresourceasstream(xmlpath);     ...     } } 

if have resource in jar should use getresourceasstream() method obtain content. might when files not in jar not when application packed in jar.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -