Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Getting a running error while running some code to import X3D into Java  RSS feed

 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm trying to make a project that loads X3D files into Java and for Java to display them, I'm using Xj3D to do this but when I run the code, I seem to be getting an error. I've downloaded all the jars that are listed here. I've made a library that's called 'Xj3D' and in the project properties, in the libraries section, I've put the Xj3D library and in the VM options, I've put -Xmx450M -Djava.library.path='C:\Users\matt\Downloads\xj3d-sai_2.0.0.jar' and the code that I have in java is:



And I've put the test.x3dv file in the project folder. The test.x3dv code is as follows:


When I press the run button in Netbeans, I get the following runtime error:

 
Knute Snortum
Sheriff
Posts: 4070
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
It looks like the error is happening in a class in one of the libraries. I would contact Xj3D for support, but then since they haven't released a version of the software in six years, it may be a dead product.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have contacted them to see if I can have the Xj3D code trunk folder and they happily gave me it for this project.

And it seems to me that Xj3D is the only way I'd be able to display X3D files in Java
 
Fred Kleinschmidt
Bartender
Posts: 560
9
  • Mark post as helpful
  • send pies
  • Report post to moderator
How are you executing the code? The error says that java cannot find class org.j3d.aviatrix3d.DrawableSurface. Are you sure you have it installed, and that that location is in your classpath?
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have got it installed, because I've checked the libraries tab under the project in Netbeans. I'm executing the code by pressing the 'Run' button that Netbeans has. And the location is in the classpath
 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Report post to moderator
Have ou checked that that class actually exists in one of your jars?

If so, then that jar is clearly not on the runtime classpath for your Netbeans project.
Not having used Netbeans for 6 years or so I can't say exactly how it should be set up.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
How would I check if the class exists in the jars? I know that I have the library with all the jars within the project
 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Report post to moderator
Most IDEs let you look inside the jar files.
There may also be a way to search for a class.

In fact, in your code try and import that class.
If you can't then that class does not exist in those jars.

Failing that you can use any archive tool (like 7zip) to open the archive, but that's a fairly manual way of doing it.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
I've just looked inside the jar files and I can't find the org.j3d.aviatrix3d.DrawableSurface class. So should I try and download that class and import it in?
 
Knute Snortum
Sheriff
Posts: 4070
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
If you can find it, yes, download it. I wasn't able to find it when I looked.
 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Report post to moderator
Bit of an assumption here, but I'm guessing this is the aviatrix3d site.

Probably the place to start looking.
 
Knute Snortum
Sheriff
Posts: 4070
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Yeah, I looked in there, but maybe I missed it.
 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Report post to moderator
Version 2.x doesn't have it, but the version 1.x jars do.
So if you have an aviatrix jar already its likely you have the wrong version.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
I've just downloaded that version and loaded the jars into the Xj3D library that I have and it's been loaded into my project. However, when I run my project now, I have the following:

 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Report post to moderator
That'll be more of the same I expect.

This is all going to involve some hunting on your part I'm afraid.

Essentially, if you get a ClassNotFound then you are either using the wrong version of some library or you are missing a library entirely.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Report post to moderator
Okay, so I've downloaded all the ones that have said that I needed a specific class and have added it to the library and to the project. However, now that I've run it, I get the following run time error:

 
Paul Clapham
Sheriff
Posts: 22472
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Yet another situation where you've got a mixed-up bunch of jar files.

Apparently in one version BaseRenderingProcess was allowed to construct a ViewEnvironment object, but in a different version the ViewEnvironment constructor was made private, or at least not accessible to the surface package. So you're using the BaseRenderingProcess class from the one version and the ViewEnvironment class from the other version.

I don't know anything about this aviatrix3d thing but so far from this thread I've learned that there's more than one environment. So if it were me I would nuke the whole thing from my system and try to download a consistent set of jars for one of the environments.
 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Report post to moderator
See my answer on your other thread:
http://www.coderanch.com/t/662562/java/java/java-lang-IllegalAccessError-running-code

I think you might have multiple versions of the aviatrix jar file on your classpath.
 
Paul Clapham
Sheriff
Posts: 22472
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Like these two?

aviatrix3d-all
aviatrix3d-all_2.2.0


But speaking of "your other thread", let's just have one thread. I'll close this one and the other one can carry on as usual.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!