Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessor method visible under Windows, Linux, but not OS X

Tags:

java

java-3d

Trying to build against javax.vecmath using the 1.5.2 jar file (found on Java.net http://java3d.java.net/binary-builds.html, for example).

Try to make a call on, say Point3d;

public class Foo {
  public static void main(String[] args) {
    Point3d t = new Point3d(1.0, 1.0, 1.0);
    System.out.println(t.getX());
  }
}

In 64 bit Windows and Linux (I've only tried Ubuntu 10.04, 64 bit), this compiles and runs.

In OS X (10.6.7) it will not compile:

...: cannot find symbol
  symbol  : method getX()
    location: class javax.vecmath.Point3d
    System.out.println (t.getX());

This is using the exact same physical vecmath.jar

If instead I use the source directly, it compiles on OS X, but does not run

Exception in thread "main" java.lang.NoSuchMethodError: javax.vecmath.Point3d.getX()D

If I compile the sources myself on OS X to a jar file, and then use the jar in the example above, again, unable to compile.

Now, the fields being accessed are in javax.vecmath.Tuple3d, which is an abstract class with public fields for x, y and z. So on OS X this will work (actually, it seems to work everywhere).

public class Foo {
  public static void main(String[] args) {
    Point3d t = new Point3d(1.0, 1.0, 1.0);
    System.out.println(t.x);
  }
}

The thing is, I'm working on a code base that depends on vecmath.jar, and in which the maintainers are on Windows and wish to keep using the accessor methods, but I'm on OS X.

I'm looking to both:

(1) understand what is going on (2) figure out how to make these sources portable while depending on the vecmath.jar file.

like image 940
npskirk Avatar asked May 27 '11 16:05

npskirk


1 Answers

The "Exception in thread "main" java.lang.NoSuchMethodError: javax.vecmath.Point3d.getX()" indicates that not the 1.5.2 version but the Apple version 1.3 of vecmath.jar is accessed. The *getter" and "setter" methods were introduced in 1.5.

Check if Apple's out-dated Java 3D version 1.3 is installed in System/Library/Java/Extensions/ on your Mac. Remove all Java 3D 1.3 related files including vecmath.jar (jar, jnilib), they are useless.

August, InteractiveMesh

like image 187
InteractiveMesh Avatar answered Oct 25 '22 03:10

InteractiveMesh