aspose file tools*
The moose likes General Computing and the fly likes java 3d code compiling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "java 3d code compiling" Watch "java 3d code compiling" New topic
Author

java 3d code compiling

Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
hey i have a java 3d code that is executing but when i make changes in the code and compile it throws a hundred errors. Can anyone tell me the possible reason? Am i going wrong in the commands ?
i use javac filename.
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

What do you mean by 3d code?
Show us the code! I belive you haven't specified valid classpath to the compiler and that is the reason why you're getting those hundreds of errors.
Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
Actually its a very long code. Its a code that works in java 3d as it has animations involved. How is it able to execute with those errors? And how do i specify the correct class path ?
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

To compile, you must specify all the libraries this code is using.
For example, If you use logger library, you must compile your code, including this logger's library in classpath:
For example: javac -cp "logger.jar;anotherarchive.jar;anotherdirectorycontainingclassfiles" mainclass.java
Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
the following are the import statements could you tell me what command to give because i am new to java.
Its not my code but my job is to make some small changes and then compile it.



import com.mnstarfire.loaders3d.Inspector3DS;
import com.mnstarfire.loaders3d.Loader3DS;

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.Timer;
import javax.swing.*;
import java.io.*;
import java.net.*;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.j3d.*;
import javax.vecmath.*;

import com.sun.j3d.loaders.IncorrectFormatException;
import com.sun.j3d.loaders.ParsingErrorException;
import com.sun.j3d.loaders.Scene;
import com.sun.j3d.loaders.objectfile.ObjectFile;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.SimpleUniverse;

import com.sun.j3d.utils.behaviors.mouse.*;
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

I'm not sure what are those, but I see at least two extra libraries needed:
one for com.mnstarfire.loaders3d.*, another for com.sun.j3d.*

I belive this is applet you're running. Please see the <applet> tag in HTML to see what libraries are used (<archive> tag). After that you specify those libraries to your javac compiler.
Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
but i have only this java file available i don't have any html file? where should i look for ?
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

Didn't you said you're able to run this program?

Anyways, try searching in jarfinder.com or findjar.com for jar of those missing libraries.
for example, i wrote "com.sun.j3d.loaders.IncorrectFormatException" in jarfinder.com and it gave me out one result:
class com.sun.j3d.loaders.IncorrectFormatException [338 bytes, jvm >= 1.2 ]
j3d-core-utils-1.3.1.jar

So download this and add this to classpath.
Do the same for rest of missing imports.
Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
The code which was given to me executes without any error. But if i compile it , it is giving me errors. That is very strange hence i am stuck.

But now since i have to make changes in the code i have to compile it for me to execute it the corrected one.

Thanks for the help i ll try this and get back if it doesn't work.
Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
still no luck. i downloaded it but maybe i am going wrong in setting the classpath. now the jar file is in a folder say C:\Users\Monisha\Downloads\jar so how exactly should i set the class path?
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

javac -cp "C:\Users\Monisha\Downloads\jar\x.jar" file.java
Monisha Manoharan
Greenhorn

Joined: Jun 16, 2011
Posts: 7
no still the same .
actually i have many jar files now so how do i specify all of them in the classpath? and should they all be in the same folder? and should the code also be in a specific folder ?

i am so confused don't know
where its going wrong?
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

As I mentioned before, you do specify more jar files in this way: -cp "logger.jar;anotherarchive.jar;anotherdirectorycontainingclassfiles"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java 3d code compiling