Results 1 to 4 of 4
- 01-20-2010, 06:59 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 1
- Rep Power
- 0
error while compile code using javac
hi,
i dont have much knowledge on java. this is my code. i got it from a friend of mine. and i would like to use it. but when i create a class file there's an error occur. could anybody help me?
HERE ARE THE ERRORSJava Code:import java.sql.*; import java.io.*; import java.util.*; import java.math.*; import oracle.sql.*; import oracle.jdbc.*; import oracle.spatial.geometry.*; import quickhull3d.*; import vclip.ConvexPolyhedron; import vclip.PolyTree; import javax.vecmath.Vector3d; import javax.vecmath.Tuple3d; public class GM_SplineCurve implements SQLData //SQL Data is the interface to mapping between SQL Data and Java Data { public String sql_type = "Pushi.GM_SplineCurve"; public ARRAY cpt; //mapping attribute "controlpoints" public GM_KnotVector knots; //mapping attribute "knots" public int degree; //mapping attribute degree public int n; public double[] ordinates; //public ARRAY weights; //map attribute weights //public ARRAY trim; //map attribute trim public GM_SplineCurve() {} public String getSQLTypeName() throws SQLException { return sql_type; } public void readSQL(SQLInput stream, String typeName) throws SQLException //output from Java to SQL { sql_type = typeName; degree=stream.readInt(); cpt=(ARRAY)stream.readArray(); knots=(GM_KnotVector)stream.readObject(); //if(typeName.equalsIgnoreCase("GM_NURBSCurve")) //{ // weights=(ARRAY)stream.readArray(); //trim=(ARRAY)stream.readArray(); //} } public void writeSQL(SQLOutput stream) throws SQLException //input from SQL to Java { stream.writeInt(degree); stream.writeArray(cpt); stream.writeObject(knots); } public void initialize() //inner data processing, change JDBC types to normal types { try{ n=cpt.length()/3; ordinates=cpt.getDoubleArray(); }catch(Exception e){System.out.println("cuole");} } public double[] getOrdinates() { initialize(); return ordinates; } public boolean isClosed() //mapping methods isclosed { initialize(); if((ordinates[0]==ordinates[3*n-3])&&(ordinates[1]==ordinates[3*n-2])&&(ordinates[2]==ordinates[3*n-1])) return true; else return false; } public int N() //mapping method N { initialize(); return n; } public Connection getConnection() { Connection con=null; try { con=DriverManager.getConnection("jdbc:default:connection:"); } catch(SQLException e){} return con; } public STRUCT CPolygon() //mapping method cPolygon { JGeometry Ch=null; initialize(); try { Ch=JGeometry.createLinearPolygon(ordinates,3,0); STRUCT obj=JGeometry.store(Ch,getConnection()); return obj; } catch(SQLException e){System.err.println(e.getMessage());} return null; } public STRUCT ConvexHull() { JGeometry Ch; double[] tmp; STRUCT obj=null; Point3d[] vertices; initialize(); QuickHull3D hull = new QuickHull3D(); hull.build(ordinates); vertices=hull.getVertices(); tmp=new double[vertices.length*3]; for(int i=0;i<vertices.length;i++) { tmp[3*i]=vertices[i].x; tmp[3*i+1]=vertices[i].y; tmp[3*i+2]=vertices[i].z; } Ch=JGeometry.createLinearPolygon(tmp,3,0); try { obj=JGeometry.store(Ch,getConnection()); } catch(SQLException e){} return obj; } public Vector3d center() { double[] tmp; Point3d[] vertices; initialize(); QuickHull3D hull = new QuickHull3D(); hull.build(ordinates); vertices=hull.getVertices(); tmp=new double[vertices.length*3]; for(int i=0;i<vertices.length;i++) { tmp[3*i]=vertices[i].x; tmp[3*i+1]=vertices[i].y; tmp[3*i+2]=vertices[i].z; } ConvexPolyhedron poly = new ConvexPolyhedron(tmp, hull.getFaces()); PolyTree pt1=new PolyTree("polytree",poly); Vector3d vc=new Vector3d(); pt1.centerOfMass(vc); return vc; } public STRUCT Centroid() { STRUCT obj=null; JGeometry Ch; Vector3d v3d=center(); double[] cpoint=new double[3]; cpoint[0]=v3d.x; cpoint[1]=v3d.y; cpoint[2]=v3d.z; Ch=JGeometry.createPoint(cpoint,3,0); try { obj=JGeometry.store(Ch,getConnection()); } catch(SQLException e){} return obj; } public String Bounding_Cube() //mapping method Bounding_Cube { initialize(); double[] b=new double[6]; double minx,miny,minz,maxx,maxy,maxz; minx=maxx=ordinates[0]; miny=maxy=ordinates[1]; minz=maxz=ordinates[2]; for(int i=0;i<n;i++) { if(ordinates[3*i]<minx) minx=ordinates[3*i]; if(ordinates[3*i]>maxx) maxx=ordinates[3*i]; if(ordinates[3*i+1]<miny) miny=ordinates[3*i+1]; if(ordinates[3*i+1]<maxy) maxy=ordinates[3*i+1]; if(ordinates[3*i+2]<minz) minz=ordinates[3*i+2]; if(ordinates[3*i+2]<maxz) maxz=ordinates[3*i+2]; } b[0]=minx;b[1]=maxx; b[2]=miny;b[3]=maxy; b[4]=minz;b[5]=maxz; String str; str="MinX:"+minx+" MaxX:"+maxx+" MinY:"+miny+" MaxY:"+maxy+" minZ:"+minz+"MaxZ:"+maxz; return str; } public GM_SplineCurve translation(float x,float y,float z) //mapping method translation { initialize(); for(int i=0;i<n;i++) { ordinates[3*i]=ordinates[3*i]+x; ordinates[3*i+1]=ordinates[3*i+1]+y; ordinates[3*i+2]=ordinates[3*i+2]+z; } try{ cpt.setObjArray(ordinates); }catch(SQLException e){} return this; } public GM_SplineCurve scale(float x,float y,float z) { initialize(); for(int i=0;i<n;i++) { ordinates[3*i]=ordinates[3*i]*x; ordinates[3*i+1]=ordinates[3*i+1]*y; ordinates[3*i+2]=ordinates[3*i+2]*z; } try{ cpt.setObjArray(ordinates); }catch(SQLException e){} return this; } public GM_SplineCurve rotateX(float a) { initialize(); for(int i=0;i<n;i++) { ordinates[3*i+1]=Math.cos(a)*ordinates[3*i+1]-Math.sin(a)*ordinates[3*i+2]; ordinates[3*i+2]=Math.sin(a)*ordinates[3*i+1]+Math.cos(a)*ordinates[3*i+2]; } try{ cpt.setObjArray(ordinates); }catch(SQLException e){} return this; } public GM_SplineCurve rotateY(float a) { initialize(); for(int i=0;i<n;i++) { ordinates[3*i]=Math.cos(a)*ordinates[3*i]+Math.sin(a)*ordinates[3*i+2]; ordinates[3*i+2]=-Math.sin(a)*ordinates[3*i]+Math.cos(a)*ordinates[3*i+2]; } try{ cpt.setObjArray(ordinates); }catch(SQLException e){} return this; } public GM_SplineCurve rotateZ(float a) { initialize(); for(int i=0;i<n;i++) { ordinates[3*i]=Math.cos(a)*ordinates[3*i]-Math.sin(a)*ordinates[3*i+1]; ordinates[3*i+1]=Math.sin(a)*ordinates[3*i]+Math.cos(a)*ordinates[3*i+1]; } try{ cpt.setObjArray(ordinates); }catch(SQLException e){} return this; } }
c:\JAVA>javac GM_NURBSSurface.java
GM_NURBSSurface.java:152: illegal start of expression
double[] cpoint=new double[(ordinates.length)*/3];
^
GM_NURBSSurface.java:152: ']' expected
double[] cpoint=new double[(ordinates.length)*/3];
^
GM_NURBSSurface.java:167: illegal start of expression
public String Bounding_Cube() //mapping method Bounding_Cube
^
GM_NURBSSurface.java:270: ';' expected
^
GM_NURBSSurface.java:276: '}' expected
}
^
5 errorsLast edited by Eranga; 01-20-2010 at 09:08 AM. Reason: Added code tags
- 01-20-2010, 07:02 AM #2
Member
- Join Date
- Jan 2010
- Posts
- 90
- Rep Power
- 0
could you please post the comile time error?
- 01-20-2010, 07:18 AM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
You failed to copy by missing some characters (most likely end closing brace).
Better ask your friend about it since he wrote it.
- 01-20-2010, 09:10 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
And please use code tags when you post codes here, with properly indent. Un-formatted codes are really hard to read.
Similar Threads
-
===javac error===
By solt in forum New To JavaReplies: 21Last Post: 12-06-2009, 09:18 AM -
Error : Invalid path, \bin\javac.exe -classpath
By Ed in forum JCreatorReplies: 3Last Post: 08-14-2009, 12:57 PM -
Code will not compile
By ShotGunRockets in forum New To JavaReplies: 17Last Post: 05-10-2009, 03:31 AM -
source code of 'javac'?
By Pooja Deshpande in forum Advanced JavaReplies: 2Last Post: 06-04-2008, 11:24 AM -
compile error
By dirtycash in forum New To JavaReplies: 6Last Post: 12-12-2007, 06:00 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks