0

I am using maven to build application and I would like to try out apache pivot for the GUI rendering. However, it looks like most pivot tutorials assume that you are using eclipse. I added 2.0 version in my pom.xml (and tried with 2.0.2 as well), but, I get this error:

[DEBUG] joining on thread Thread[Timer-1,5,com.polyglot.HelloBXML]
java.lang.IllegalArgumentException: location is null.
at org.apache.pivot.beans.BXMLSerializer.readObject(BXMLSerializer.java:604)
at org.apache.pivot.beans.BXMLSerializer.readObject(BXMLSerializer.java:568)
at org.apache.pivot.beans.BXMLSerializer.readObject(BXMLSerializer.java:534)
at com.polyglot.HelloBXML.startup(HelloBXML.java:21)

It seems like it is unable to find the BXML file. I had put it in src/main/resources. I searched the forums and it looks like it is because BXML file is not in the classpath. I tried with target/classes, but still no avail. Can somebody guide me what is the correct location of the BXML file?

Salil
  • 9,534
  • 9
  • 42
  • 56

2 Answers2

6

For the HelloBXML.java example

change

window = (Window)bxmlSerializer.readObject(HelloBXML.class, "hello.bxml");

to

window = (Window)bxmlSerializer.readObject(HelloBXML.class, "/hello.bxml");

and put hello.bxml in src/main/resources.

(may need to be backslash for MS Windows environment, but I don't know)

David Prentiss
  • 548
  • 1
  • 6
  • 16
0

The solution to put it in the classpath was correct. I copied it in src/main/resources/{my package path} and it works. My mistake was I was putting it in src/main/resources directly.

Salil
  • 9,534
  • 9
  • 42
  • 56