> From: Pete Tinker <[EMAIL PROTECTED]>
>
> I'm writing a new loader for ArcInfo Binary elevation files.  Compiles with
> no warnings or errors. Now comes a dumb question:  where do I put it?  When
> I put the class file (ArcInfoBLoader.class) in the local directory with its
> test program, and put "import ArcInfoBLoader;" in Test.java, I get the error
> 
> error: File .\ArcInfoBLoader.class does not contain type ArcInfoBLoader as
> expected, but type com.sun.j3d.loaders.ArcInfoB.ArcInfo
> BLoader. Please remove the file, or make sure it appears in the correct
> subdirectory of the class path.

You need to specify the right package name and put the classes into the right 
directory for that package.   The simplest way to do this is to not use a 
package for this loader (at least for development).  To do this, just remove the 
line

   package com.sun.j3d.loaders.ArcInfoB;
   
from your source.  Now you can put your loader in the same directory as your 
test program and everything should work.

At some point you may want to put your loader into a package, but 
com.sun.j3d.loaders is probably not the right place, since you are writing this 
package, not Sun.  How about: org.acm.j3d.loaders.ArcInfoB? 

To do this, you'll need to set up your source and classes in a directory 
structure which matches the package structure.  That is, you'll need to put your 
stuff into a directory named org/acm/j3d/loaders/ArcInfoB  (the following 
discussion uses UNIX pathnames and commands). 

The usual way to do this is to put the source in one branch of a tree and the 
classes into another branch and then use the -d option to javac to specify the 
directory for the classes:

        cd ~ptinker # or wherever your Java source lives
        mkdir classes  # this is where the classes will go
        mkdir -p src/org/acm/j3d/loaders/ArcInfoB # the source goes here
        cd src/org/acm/j3d/loaders/ArcInfoB  
        javac -d ~ptinker/classes ArcInfoBLoader.java
        
You will have to update your source for the loader and test program to have the 
new package name, and set your CLASSPATH to include ~ptinker/classes.

Like I said, it is easier to not use a package at first.

Doug Gehringer
Sun Microsystems

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to