javafx - Get resource path from another java lib res and itself res -


(ive done already(almost) code looks shiet)

i'm trying path lib(my core) res

so basicly in lib(my core) write

createwindow(null, "login", "view/login.fxml", "view/core.css"); 

this load files in res -> view (so working)

and in other jar uses lib(my core)

createwindow(getclass(), "login", "login.fxml", "core.css");  

this load files in src -> us.cweye.example (where main file is)

that trigger function

private boolean isself = false; public void createwindow(class<?> clazz, string windowid, string fxmlpath, string stylepath) {     try {         if(clazz == null) isself = true;         parent root = fxmlloader.load((clazz == null) ? classloader.getsystemresource("res/" + fxmlpath) : clazz.getresource(fxmlpath));         scene = new scene(root);         if(stylepath != null) {                 scene.getstylesheets().add((isself == false) ?   clazz.getresource(stylepath).toexternalform() : classloader.getsystemresource("res/" + stylepath).toexternalform());         }     } catch (ioexception e) {         e.printstacktrace();     } } 

ive had problem files not found when had compiled jar. did somthing fast fix then..idk how fix problem

so information want lib(my core) load files in res folder , other jar want load files in res.

thanks reading this. if want can fix languange errors :)

are files in jar file?

i using multi maven project , need perform

myclass.class.getclassloader().getresource("folder/view.fxml") 

where structure is:

src/main/resources/folder/view/fxml


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -