Can someone look at this Java code for me?

  • Context: Java 
  • Thread starter Thread starter the other guy
  • Start date Start date
  • Tags Tags
    Code Java
Click For Summary

Discussion Overview

The discussion revolves around a Java code snippet related to loading a MilkShape 3D model using Java 3D. Participants are trying to identify missing components or errors in the code, as the original poster indicates that the code is incomplete or not functioning as expected.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • The original poster mentions that the code seems to be missing a line or two, particularly regarding "ending parsing."
  • Some participants inquire about the intended functionality of the code and what specific issues the original poster is encountering, such as compiler or run-time errors.
  • There is confusion regarding the term "ending parsing," with participants seeking clarification on what it refers to in the context of the code.
  • One participant suggests that the absence of a main() method might be a potential issue with the code.
  • Another participant notes that the original poster may lack the experience to specify the problems clearly, which complicates the assistance process.

Areas of Agreement / Disagreement

Participants express uncertainty about the specific problems with the code, and there is no consensus on what the "ending parsing" refers to or how to resolve the issues presented. Multiple viewpoints on the potential missing elements and errors remain unresolved.

Contextual Notes

Participants highlight the need for more context and specific error messages to provide effective help. The discussion reflects a lack of clarity regarding the original poster's development environment and the exact nature of the issues faced.

Who May Find This Useful

Individuals interested in Java programming, particularly those working with Java 3D and model loading, may find this discussion relevant.

the other guy
Messages
19
Reaction score
0
im starting a project from an Ebook that seems to be missing a line or two or something. Can someone suggest what should be here? I added the ending parsing since it was one of the more obvious missing things.


import com.sun.j3d.loaders.*;
import com.glyphein.j3d.loaders.milkshape.MS3DLoader;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import javax.media.j3d.BranchGroup;
import com.sun.j3d.loaders.objectfile.ObjectFile;
import com.sun.j3d.loaders.ParsingErrorException;
import com.sun.j3d.loaders.IncorrectFormatException;
import com.sun.j3d.loaders.Scene;
import java.applet.Applet;
import java.io.*;

class bob extends Applet {
// Loader loader = new MS3DLoader(MS3DLoader.LOAD_ALL);

private String filename = null;

public BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();

Loader raptor = new MS3DLoader(MS3DLoader.LOAD_ALL);
Scene s = null;
try {
s = raptor.load("Ships/raptor.MS3D");
}
catch (FileNotFoundException e) {
System.err.println(e);
System.exit(1);
}
catch (ParsingErrorException e) {
System.err.println(e);
System.exit(1);
}
catch (IncorrectFormatException e) {
System.err.println(e);
System.exit(1);
}

objRoot.addChild(s.getSceneGroup());
}

}
 
Technology news on Phys.org
OK, I looked at it...

Without actually formatting it so I can grok the braces, it looks like it oughta compile.

What's it 'sposed to do, and what isn't it doing? Also not sure what the "ending parsing" you added is or why?
 
schip666! said:
OK, I looked at it...

Without actually formatting it so I can grok the braces, it looks like it oughta compile.

What's it 'sposed to do, and what isn't it doing? Also not sure what the "ending parsing" you added is or why?

It's supposed to load a milkshape3d model. I know i didnt put in a universe or anything standard like that yet (trying to keep posted code simple), but for some reason, I can't get the all clear from my editor for the code.

There was origionally one parsing at the end, but I added another to close it off.
 
schip666! said:
What's it 'sposed to do, and what isn't it doing? Also not sure what the "ending parsing" you added is or why?

I don't get the "ending parsing" bit, either. What "parsing" bit are you talking about?

To expand on schip666!'s questions, what problems are you having? Are you getting compiler errors or run-time errors or what?
 
Mark44 said:
I don't get the "ending parsing" bit, either. What "parsing" bit are you talking about?

To expand on schip666!'s questions, what problems are you having? Are you getting compiler errors or run-time errors or what?


Sorry. Forget the Parsing thing.

I'm trying to get a model to import and run in JAVA3D. a model from milkshape3d
 
Again, what problems are you having? Are you getting compiler errors or run-time errors or what? If you don't give us some idea of where you're stuck it's very difficult to provide any help.
 
This is a good example of a curious phenomenon in these sorts of "help" forums...
There is obviously some kind of problem, but the poster doesn't seem to have enough experience -- yet -- to know what to specify, or how to capture the output, in order to get help.

Phrases like "added ending parsing" and "getting the all-clear from my editor" make wonderful sense -- to the poster -- but only open further cans'o'worms for the rest of us riff-raff. Providing the missing context and actual errors is what we need here, e.g.,
by "all-clear from my editor" I'm suspecting that "editor" means the development system
and that there's a compile time error of some sort. But without having exactly the same, unspecified, system, we are somewhat en-darkened...
 
By "ending parsing" the original poster means the closing curly bracket "}".

Not sure what's wrong with the code. Maybe the lack of main()?