Forums Register Login

Getting an exception when running some code

+Pie Number of slices to send: Send
I'm trying to run some code that imports test.x3dv in Java. The Java code that I have is:



And the test.x3dv is:



When I run the code, I get the following:



I believe it's to do with the line or the and trying to call a method on a null object and I don't know how to fix it. If anyone can help, it would be greatly appreciated.
+Pie Number of slices to send: Send
Do you have the x3d product?

If not you need to rewrite to support what you do have.
+Pie Number of slices to send: Send
When I googled your exception description I found several other posts elsewhere which had exactly identical code. They can't all be crossposted by you so I conclude that you, like those other people, got that example from somewhere on the web. I think that the example should come with instructions on how to configure a browser in the browser factory, or something like that, but maybe it assumes you already did that based on earlier pages.

At any rate I'd suggest you go back to where you got the example and look around for instructions on how to set up your environment. If you're still stuck, then maybe you could post a link to whatever it is which contained that example?
+Pie Number of slices to send: Send
By x3d product, I assume you mean the x3d file which I've placed in the Java project.

The reason why I posted it again here is in the hope someone might be able to help me understand how to overcome this problem with the browser factory line. As if someone explains how to get round it, I'll have a better understanding and won't have to carry on asking the question.
+Pie Number of slices to send: Send
What is the result of this call:


is 'null' a legal value to pas as the argument? Is x3dComponent null after the call? If so, you need to read the documentation of createX3DComponent() to see why it might return null.
+Pie Number of slices to send: Send
I've realised my mistake. And now I've changed it round. I now have:


In which I have a few errors. All the lines that have at the end don't have any errors, however the lines that have the errors on are the ones that have 'String.' and there's red lines underneath all the words that follow the 'String.' saying that it can't find the symbol
+Pie Number of slices to send: Send
Well, yes, that's because the String class doesn't have any of those members. Perhaps you need an actual string in those places (like "MEDIUM" for example)? Or perhaps there's some other class which does have those members and you should be using that other class instead of String? Without a link to the documentation I'm just speculating, though. Hopefully you do have a link to the documentation so you can look things up there.
+Pie Number of slices to send: Send
When I've put String."MEDIUM"; there's a red line under the whole line so and the link that I was following can be found here
+Pie Number of slices to send: Send
The documentation says it wants a String there. So use a String:



It could be said that the documentation was less than helpful in that it didn't show how to form a Java String literal, but perhaps it's just aimed too high.
+Pie Number of slices to send: Send
I've changed it round and now have the the following when I run the code:
+Pie Number of slices to send: Send
And what did you specify for your renderer? So far your posted code hasn't mentioned that.
+Pie Number of slices to send: Send
I've just added the following line into the code for the renderer:
However, when I've run it with that line and put all the correct jars in the library, I get the following run time error:
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 695 times.
Similar Threads
Displaying an X3D image within a subpanel
Displaying an X3D image within a subpanel
text box - GridBagLayout
close window when new one opens
The serializable class does not declare a static final...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:40:23.