Cannot Resolve Symbol

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vsp15584
    New Member
    • Oct 2006
    • 1

    #1

    Cannot Resolve Symbol

    Hii..i use the coding as below :-

    import java.applet.app let;
    import java.awt.*;
    import com.sun.j3d.uti ls.applet.mainf rame;
    import com.sun.j3d.uti ls.universe.*;
    import com.sun.j3d.uti ls.geometry.*;
    import javax.media.j3d .*;
    import javax.vecmath.* ;

    public class J3DLinesPoints extends Applet {
    private SimpleUniverse u=null;

    public BranchGroup createScene() {
    BranchGroup objRoot = new BranchGroup();
    TransformGroup tg = new TransformGroup( );
    Shape3D shapeLine = new Shape3D();
    Transform3D t3d2 = new Transform3D();

    PointArray pa = new PointArray(2,Po intArray.COORDI NATES | pOINTaRRAY.colo r_3);
    LineArray la= new LineArray(2,Lin eArray.COORDINA TES |LineArray.cOLO R_3);
    Point3d[] ptsPoints = new Point3d[2];
    Point3d[] ptsLine = new Point3d[2];
    PointAttributes ptAtt = new PointAttributes ();
    Color3f[] colors = new Color3f[2];
    Appearance appPoint = new Appearance();
    t3d2.setscale(0 .2);
    tg.setTransform (t3d2);
    objRoot.addChil d(tg);

    ptsPoints[0] = new Point3d(2,3,-2);
    ptsPoints[1] = new Point3d(2,4,-2);
    ptsLine[0] = new Point3d(1,1,-2);
    ptsLine[1] = new Point3d(-2,2,-2);

    colors[0] = new Color3f(1.0f,0. 0f, 0.0f); //red
    colors[1] = new color3f(0.0f,0. 0f, 1.0f); //blue

    pa.setCoordinat es(0,ptsPoints) ; //set the coordinates of the points into the Point Array
    pa.setColors(0, colors);
    ptAtt.setPointS ize(5.0f); //increase size of points to make them more visible
    appPoint.setPOi ntAttributes(pt Att);
    shapePOint.setG eometry(pa);
    shapePoint.setA ppearance(appPo int);

    la.setCoordinat es(0,ptsLine); //set the coordinates of the line points into the LineArray
    la.setColors(0, colors);
    shapeLine.setGe ometry(la);

    tg.addChild(sha pePoint);
    tg.addChild(sha peLine);
    objRoot.compile ();
    return objRoot;
    }

    public void init() {
    setLayout(new BorderLayout()) ;
    GraphicsConfigu ration config = SimpleUniverse. getPreferredCon figuration();
    Canvas3D canvas = new Canvas3D(config );
    canvas.setBackg round(Color.yel low);
    add("Center", canvas);
    BranchGroup Scene= createScene();
    u = new SimpleUniverse (canvas);
    u.getViewingPla tform().setNomi nalViewingTrans form();
    u.addBranchGrap h(scene);
    }

    public static void main(String[] args) {
    new MainFrame(new J3DLinesPoints( ),500,400);
    }
    }


    and the errors which i get in COMMAND prompt are as follows :-

    U:\cadcam\java> javac J3DLinesPoints. java
    J3DLinesPoints. java:1: cannot resolve symbol
    symbol : class applet
    location: package applet
    import java.applet.app let;
    ^
    J3DLinesPoints. java:3: cannot resolve symbol
    symbol : class mainframe
    location: package applet
    import com.sun.j3d.uti ls.applet.mainf rame;
    ^
    J3DLinesPoints. java:9: cannot resolve symbol
    symbol : class Applet
    location: class J3DLinesPoints
    public class J3DLinesPoints extends Applet {
    ^
    J3DLinesPoints. java:18: cannot resolve symbol
    symbol : variable pOINTaRRAY
    location: class J3DLinesPoints
    PointArray pa = new PointArray(2,Po intArray.COORDI NATES
    | pOINTaRRAY.colo r_3);

    ^
    J3DLinesPoints. java:19: cannot resolve symbol
    symbol : variable cOLOR_3
    location: class javax.media.j3d .LineArray
    LineArray la= new LineArray(2,Lin eArray.COORDINA TES |Lin
    eArray.cOLOR_3) ;

    ^
    J3DLinesPoints. java:25: cannot resolve symbol
    symbol : method setscale (double)
    location: class javax.media.j3d .Transform3D
    t3d2.setscale(0 .2);
    ^
    J3DLinesPoints. java:35: cannot resolve symbol
    symbol : class color3f
    location: class J3DLinesPoints
    colors[1] = new color3f(0.0f,0. 0f, 1.0f); //blue
    ^
    J3DLinesPoints. java:40: cannot resolve symbol
    symbol : method setPOintAttribu tes (javax.media.j3 d.PointAttribut es)
    location: class javax.media.j3d .Appearance
    appPoint.setPOi ntAttributes(pt Att);
    ^
    J3DLinesPoints. java:41: cannot resolve symbol
    symbol : variable shapePOint
    location: class J3DLinesPoints
    shapePOint.setG eometry(pa);
    ^
    J3DLinesPoints. java:42: cannot resolve symbol
    symbol : variable shapePoint
    location: class J3DLinesPoints
    shapePoint.setA ppearance(appPo int);
    ^
    J3DLinesPoints. java:48: cannot resolve symbol
    symbol : variable shapePoint
    location: class J3DLinesPoints
    tg.addChild(sha pePoint);
    ^
    J3DLinesPoints. java:55: cannot resolve symbol
    symbol : method setLayout (java.awt.Borde rLayout)
    location: class J3DLinesPoints
    setLayout(new BorderLayout()) ;
    ^
    J3DLinesPoints. java:59: cannot resolve symbol
    symbol : method add (java.lang.Stri ng,javax.media. j3d.Canvas3D)
    location: class J3DLinesPoints
    add("Center", canvas);
    ^
    J3DLinesPoints. java:63: cannot resolve symbol
    symbol : variable scene
    location: class J3DLinesPoints
    u.addBranchGrap h(scene);
    ^
    J3DLinesPoints. java:67: cannot resolve symbol
    symbol : class MainFrame
    location: class J3DLinesPoints
    new MainFrame(new J3DLinesPoints( ),500,400);
    ^
    15 errors

    I am very new..to this java programming so please if you can give me some detailed explannations for the answers.

    I refer few blogs on the site for the same error which suggests to give CLASS PATH along with the "javac" command....i tried that too..
    but i was not able to do that...

    thank you
    vishal patel
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by vsp15584
    Hii..i use the coding as below :-

    import java.applet.app let;
    import java.awt.*;
    import com.sun.j3d.uti ls.applet.mainf rame;
    import com.sun.j3d.uti ls.universe.*;
    import com.sun.j3d.uti ls.geometry.*;
    import javax.media.j3d .*;
    import javax.vecmath.* ;

    public class J3DLinesPoints extends Applet {
    private SimpleUniverse u=null;

    public BranchGroup createScene() {
    BranchGroup objRoot = new BranchGroup();
    TransformGroup tg = new TransformGroup( );
    Shape3D shapeLine = new Shape3D();
    Transform3D t3d2 = new Transform3D();

    PointArray pa = new PointArray(2,Po intArray.COORDI NATES | pOINTaRRAY.colo r_3);
    LineArray la= new LineArray(2,Lin eArray.COORDINA TES |LineArray.cOLO R_3);
    Point3d[] ptsPoints = new Point3d[2];
    Point3d[] ptsLine = new Point3d[2];
    PointAttributes ptAtt = new PointAttributes ();
    Color3f[] colors = new Color3f[2];
    Appearance appPoint = new Appearance();
    t3d2.setscale(0 .2);
    tg.setTransform (t3d2);
    objRoot.addChil d(tg);

    ptsPoints[0] = new Point3d(2,3,-2);
    ptsPoints[1] = new Point3d(2,4,-2);
    ptsLine[0] = new Point3d(1,1,-2);
    ptsLine[1] = new Point3d(-2,2,-2);

    colors[0] = new Color3f(1.0f,0. 0f, 0.0f); //red
    colors[1] = new color3f(0.0f,0. 0f, 1.0f); //blue

    pa.setCoordinat es(0,ptsPoints) ; //set the coordinates of the points into the Point Array
    pa.setColors(0, colors);
    ptAtt.setPointS ize(5.0f); //increase size of points to make them more visible
    appPoint.setPOi ntAttributes(pt Att);
    shapePOint.setG eometry(pa);
    shapePoint.setA ppearance(appPo int);

    la.setCoordinat es(0,ptsLine); //set the coordinates of the line points into the LineArray
    la.setColors(0, colors);
    shapeLine.setGe ometry(la);

    tg.addChild(sha pePoint);
    tg.addChild(sha peLine);
    objRoot.compile ();
    return objRoot;
    }

    public void init() {
    setLayout(new BorderLayout()) ;
    GraphicsConfigu ration config = SimpleUniverse. getPreferredCon figuration();
    Canvas3D canvas = new Canvas3D(config );
    canvas.setBackg round(Color.yel low);
    add("Center", canvas);
    BranchGroup Scene= createScene();
    u = new SimpleUniverse (canvas);
    u.getViewingPla tform().setNomi nalViewingTrans form();
    u.addBranchGrap h(scene);
    }

    public static void main(String[] args) {
    new MainFrame(new J3DLinesPoints( ),500,400);
    }
    }


    and the errors which i get in COMMAND prompt are as follows :-

    U:\cadcam\java> javac J3DLinesPoints. java
    J3DLinesPoints. java:1: cannot resolve symbol
    symbol : class applet
    location: package applet
    import java.applet.app let;
    ^
    J3DLinesPoints. java:3: cannot resolve symbol
    symbol : class mainframe
    location: package applet
    import com.sun.j3d.uti ls.applet.mainf rame;
    ^
    J3DLinesPoints. java:9: cannot resolve symbol
    symbol : class Applet
    location: class J3DLinesPoints
    public class J3DLinesPoints extends Applet {
    ^
    J3DLinesPoints. java:18: cannot resolve symbol
    symbol : variable pOINTaRRAY
    location: class J3DLinesPoints
    PointArray pa = new PointArray(2,Po intArray.COORDI NATES
    | pOINTaRRAY.colo r_3);

    ^
    J3DLinesPoints. java:19: cannot resolve symbol
    symbol : variable cOLOR_3
    location: class javax.media.j3d .LineArray
    LineArray la= new LineArray(2,Lin eArray.COORDINA TES |Lin
    eArray.cOLOR_3) ;

    ^
    J3DLinesPoints. java:25: cannot resolve symbol
    symbol : method setscale (double)
    location: class javax.media.j3d .Transform3D
    t3d2.setscale(0 .2);
    ^
    J3DLinesPoints. java:35: cannot resolve symbol
    symbol : class color3f
    location: class J3DLinesPoints
    colors[1] = new color3f(0.0f,0. 0f, 1.0f); //blue
    ^
    J3DLinesPoints. java:40: cannot resolve symbol
    symbol : method setPOintAttribu tes (javax.media.j3 d.PointAttribut es)
    location: class javax.media.j3d .Appearance
    appPoint.setPOi ntAttributes(pt Att);
    ^
    J3DLinesPoints. java:41: cannot resolve symbol
    symbol : variable shapePOint
    location: class J3DLinesPoints
    shapePOint.setG eometry(pa);
    ^
    J3DLinesPoints. java:42: cannot resolve symbol
    symbol : variable shapePoint
    location: class J3DLinesPoints
    shapePoint.setA ppearance(appPo int);
    ^
    J3DLinesPoints. java:48: cannot resolve symbol
    symbol : variable shapePoint
    location: class J3DLinesPoints
    tg.addChild(sha pePoint);
    ^
    J3DLinesPoints. java:55: cannot resolve symbol
    symbol : method setLayout (java.awt.Borde rLayout)
    location: class J3DLinesPoints
    setLayout(new BorderLayout()) ;
    ^
    J3DLinesPoints. java:59: cannot resolve symbol
    symbol : method add (java.lang.Stri ng,javax.media. j3d.Canvas3D)
    location: class J3DLinesPoints
    add("Center", canvas);
    ^
    J3DLinesPoints. java:63: cannot resolve symbol
    symbol : variable scene
    location: class J3DLinesPoints
    u.addBranchGrap h(scene);
    ^
    J3DLinesPoints. java:67: cannot resolve symbol
    symbol : class MainFrame
    location: class J3DLinesPoints
    new MainFrame(new J3DLinesPoints( ),500,400);
    ^
    15 errors

    I am very new..to this java programming so please if you can give me some detailed explannations for the answers.

    I refer few blogs on the site for the same error which suggests to give CLASS PATH along with the "javac" command....i tried that too..
    but i was not able to do that...

    thank you
    vishal patel
    Java is case sensitive. Class names in you program are starting with uppercase but your import statements are importing classes with all lowercase.
    change your imports to
    import com.sun.j3d.uti ls.applet.Mainf rame;
    import java.applet.App let;
    Only then can we tell whether your class path is wrong or not.

    Comment

    Working...