Skip to main content

"Canvas3DPanel.java": package com.sun.j3d.utils.universe does not exist

8 replies [Last post]
hazehaze
Offline
Joined: 2006-02-14
Points: 0

Hi, I have two questions. I hope someone will render some help as I am doing my final year porject in my University.

1)
When I try to run my friend Java 3D project in the command prompt, it works. However, when i try to run it in Jbuiler, it gives me 265 errors and some of the errors are:
"Canvas3DPanel.java": package com.sun.j3d.utils.universe does not exist at line 8, column 1

"Canvas3DPanel.java": package com.sun.j3d.utils.geometry does not exist at line 9, column 1

"Canvas3DPanel.java": cannot resolve symbol: class Point3d in class Canvas3DPanel at line 31, column 5

I have install Java 3D 1.3.1 API in my C:\Jbuilder9\bin but I still got all these errors. Can someone pls advice me what can be done? Thanks a million.

------------------------------------------------------

2)
I am wondering if I am on the right track:

I have coded a java 2D random maze generation code and I need to convert it to 3D fps maze. What I mean by fps 3D maze, is that when the user log in, the user can only see the walls in front, at the side of the maze. As the player proceed further, then the player would be able to see more of other walls and even encounter traps and cure.

I hears that it can be done using Java3D, hope someone please render some help on how can I get started? I am trying to get my friend project to run in Jbuilder so I will know if I am able to do in using Jbuilder.

This is my URL(2D GUI maze generated from my java code which I coded in Jbuilder):
http://www.geocities.com/hazepoh83/maze.html

With Thanks,
haze

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hazehaze
Offline
Joined: 2006-02-14
Points: 0

When I open the java file, these codes in my program have some errors:

The lines of codes:

import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;

Error report:

package com.sun.j3d.utils.universe does not exist at line 8 (8:1)
package com.sun.j3d.utils.geometry does not exist at line 9 (9:1)
package javax.media.j3d does not exist at line 10 (10:1)
package javax.vecmath does not exist at line 11 (11:1)

It seems to me that the program cant find the location for the java 3D stuffs that it need. I have already doanloaded Java 3D API and install it in c:\Jbuilder\jkd1.4 but it still cant work.

hazehaze
Offline
Joined: 2006-02-14
Points: 0

Thanks for your reply, but may I know do I configure Jbuilder to know where the libraries are? Is there any things else that I have to take note?

messengers
Offline
Joined: 2004-04-18
Points: 0

I`m not sure what you mean by "run it" in jBuilder, sorry.
If the JBuilder IDE is intimidating IMHO the build tool at
http://ant.apache.org/
has better support in terms of getting started. The Ant user mail list is at
http://marc.theaimsgroup.com/?l=ant-user&r=1&w=2
Otherwise you could look to Borland for support with their IDE if you don`t have their help files.
regards

hazehaze
Offline
Joined: 2006-02-14
Points: 0

What I mean by "run it" is that when I right click on the project(Assignment3.java), there are some options to be choose from(some examples):

Add files/packages/classes
[b]Run using defaults[/b]
Debug using defaults
Clean
Make
Rebuild
....

Wehn I click on the [b]Run using defaults[/b],it gives me those errors.

When I try to run other project which does uses java 3D stuffs, it can works properly.

messengers
Offline
Joined: 2004-04-18
Points: 0

That`s not a j3d problem. Sounds like your instructor from your course will be an appropriate person to help you there.
regards

hazehaze
Offline
Joined: 2006-02-14
Points: 0

May I know if you know what kind of errors is it? Is it that I did not set any path to the libraries or files needed?

Right now after coding my program, I need to convert it into 3D form. I am kind of clueless as to how to get started. Pls advice. thanks.

messengers
Offline
Joined: 2004-04-18
Points: 0

>Is it that I did not set any path to the libraries or files needed?

Yes. You need to consult Borland`s documentation regarding setting those paths correctly. If you used Ant you could simply set the path in a script.

>I am kind of clueless as to how to get started.

Study the example programs and the javadoc. Compile and run the the j3d examples and see how you can adapt them to your purposes. Here is the code for HelloUniverse.java to get you started. You will need to tell the compiler where the classes specified in the import declarations are. Follow the instructions in the JBuilder documentation to do that.

Good luck.

regards

[code]

/*
* @(#)HelloUniverse.java 1.55 02/10/21 13:43:36
*
* Copyright (c) 1996-2002 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any
* kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
* WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
* EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
* OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
* FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
* LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that Software is not designed,licensed or intended
* for use in the design, construction, operation or maintenance of
* any nuclear facility.
*/

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.*;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;

public class HelloUniverse extends Applet {

private SimpleUniverse u = null;

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

// Create the TransformGroup node and initialize it to the
// identity. Enable the TRANSFORM_WRITE capability so that
// our behavior code can modify it at run time. Add it to
// the root of the subgraph.
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objTrans);

// Create a simple Shape3D node; add it to the scene graph.
objTrans.addChild(new ColorCube(0.4));

// Create a new Behavior object that will perform the
// desired operation on the specified transform and add
// it into the scene graph.
Transform3D yAxis = new Transform3D();
Alpha rotationAlpha = new Alpha(-1, 4000);

RotationInterpolator rotator =
new RotationInterpolator(rotationAlpha, objTrans, yAxis,
0.0f, (float) Math.PI*2.0f);
BoundingSphere bounds =
new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
rotator.setSchedulingBounds(bounds);
objRoot.addChild(rotator);

// Have Java 3D perform optimizations on this scene graph.
objRoot.compile();

return objRoot;
}

public HelloUniverse() {
}

public void init() {
setLayout(new BorderLayout());
GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();

Canvas3D c = new Canvas3D(config);
add("Center", c);

// Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();
u = new SimpleUniverse(c);

// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
u.getViewingPlatform().setNominalViewingTransform();

u.addBranchGraph(scene);
}

public void destroy() {
u.cleanup();
}

//
// The following allows HelloUniverse to be run as an application
// as well as an applet
//
public static void main(String[] args) {
new MainFrame(new HelloUniverse(), 256, 256);
}
}

[/code]

messengers
Offline
Joined: 2004-04-18
Points: 0

>when i try to run it in Jbuiler, it gives me 265 errors

Sorry, don`t quite understand what you mean by "run it".
JBuilder needs to be configured so it knows where the j3d packages (libraries) are. Debugging programs in JBuilder requires you to configure a runtime environment as well. JBuilder comes with an extensive help system that will help you out there.

>I am wondering if I am on the right track
Sounds like j3d could help you out, but it requires some understanding of the java language and studying of the examples and javadoc notes.

regards