A loader class reads 3D scene files (not Java 3D files) and creates Java 3D representations of the file's contents that can be selectively added to a Java 3D world and augmented by other Java 3D code.

A loader example based on the ObjectFile class is written here. In this program, a galleon is loaded and added into the virtual world.The "galleon.obj" file is required for running this program.

 public class ObjLoadExample extends JFrame {
  public ObjLoadExample() {
    ...
  }

  public BranchGroup createSceneGraph() {
    BranchGroup objRoot = new BranchGroup();
    
    ...
    
    // Load the content from a object file
    ObjectFile file=new ObjectFile();
    Scene s=null;
    try {
      s=file.load("galleon.obj");
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IncorrectFormatException e) {
      e.printStackTrace();
    } catch (ParsingErrorException e) {
      e.printStackTrace();
    }
    objRoot.addChild(s.getSceneGroup());

    return objRoot;
  }
  
  public static void main(String[] args){
    ...
  }
}