I don't have a full answer for you, but I have a pointer. Note that BXMLSereializer.readObject() uses Class.getResource() to find the file. This StackExchange question may be helpful:
http://stackoverflow.com/questions/12341348/java-class-getresource-with-eclipse Sorry not to give you a better answer, but its Friday night and I've got beer to drink =) Cheers, --E On Fri, Sep 27, 2013 at 8:57 PM, David Heard <[email protected]> wrote: > Hello All, > > I am new to apache-pivot although I do work with Spring MVC & Hibernate. > > Before I pose this question I did go through the archive, from Jan. 2011 > to current and I did not see an answer, and I did try Stackoverflow as > well. What I would like to do is move the .bxml files to a separate > directory - for example: /xml in the project. > > eclipse is the IDE (Keppler) and the plugin is installed. > > To make this shorter I'll use the excellent example of HelloBXML and just > the relevant snippet of code; > > @Override public void startup(Display display, Map<String, String> arg1) > throws Exception { > BXMLSerializer bmxlSerializer = new BXMLSerializer(); > window = (Window) bmxlSerializer.readObject(HelloBXML.class, > "xml/hello.bxml"); > window.open(display); > } > > I can get hello.bxml to load if I include it in the classpath as > com.dwh.pivot.tutorial.xml or by itself as hello.bxml in > com.dwh.pivot.tutorial where HelloBXML.java resides. > > When I tried creating the xml directory and calling hello.bxml from it I > got the error: " I get an java.lang.IllegalArgumentException: could not > find resource "/xml/hello.bxml". " > > I also tried using window = (Window) > bmxlSerializer.readObject(getClass().getResource("xml/hello.bxml")); > and I get a different error, "java.lang.IllegalArgumentException: > location is null." > > After a little thought, I tried creating a separate package named xml and > added hello.bxml to it. I received the same location is null error. > > What I would like to know is if it is possible to separate the files like > that using pivot? My reasoning is I am trying to isolate the gui portions > from the data or model. Maybe I am way out in left field and over thinking > it. > > Thank you for taking time to look at this, if I am off base let me know :) > I won't take offense. If I missed something somewhere point me at it and > smack my hand. > > Peace, > -Dave >
