Results 1 to 12 of 12
Thread: Can't find symbols errors ugh
- 03-07-2017, 07:05 PM #1
Member
- Join Date
- Mar 2017
- Posts
- 6
- Rep Power
- 0
Can't find symbols errors ugh
I am using Netbeans 8.2
I am trying out Apache math lib and it won't work
I installed the .jar files . See photo.
You can see the errors in the window in the pic as to the installed
.jar file
The following program is the demo .java to test it out
Java Code:import org.apache.commons.math.optimization.general.EstimationException; import org.apache.commons.math.optimization.general.EstimatedParameter; import org.apache.commons.math.optimization.general.EstimationProblem; import org.apache.commons.math.optimization.general.LevenbergMarquardtEstimator; import org.apache.commons.math.optimization.general.SimpleEstimationProblem; import org.apache.commons.math.optimization.general.WeightedMeasurement; public class TrajectoryDeterminationProblem extends SimpleEstimationProblem { public static void main(String[] args) { try { TrajectoryDeterminationProblem problem = new TrajectoryDeterminationProblem(0.0, 100.0, 800.0, 1.0, 0.0); double[][] distances = { { 0.0, 806.5849 }, { 20.0, 796.8148 }, { 40.0, 791.0833 }, { 60.0, 789.6712 }, { 80.0, 793.1334 }, { 100.0, 797.7248 }, { 120.0, 803.2785 }, { 140.0, 813.4939 }, { 160.0, 826.9295 }, { 180.0, 844.0640 }, { 200.0, 863.3829 }, { 220.0, 883.3143 }, { 240.0, 908.6867 }, { 260.0, 934.8561 }, { 280.0, 964.0730 }, { 300.0, 992.1033 }, { 320.0, 1023.998 }, { 340.0, 1057.439 }, { 360.0, 1091.912 }, { 380.0, 1125.968 }, { 400.0, 1162.789 }, { 420.0, 1201.517 }, { 440.0, 1239.176 }, { 460.0, 1279.347 } }; for (int i = 0; i < distances.length; ++i) { problem.addDistanceMeasurement(1.0, distances[i][0], distances[i][1]); }; double[][] angles = { { 10.0, 1.415423 }, { 30.0, 1.352643 }, { 50.0, 1.289290 }, { 70.0, 1.225249 }, { 90.0, 1.161203 }, {110.0, 1.098538 }, {130.0, 1.036263 }, {150.0, 0.976052 }, {170.0, 0.917921 }, {190.0, 0.861830 }, {210.0, 0.808237 }, {230.0, 0.757043 }, {250.0, 0.708650 }, {270.0, 0.662949 }, {290.0, 0.619903 }, {310.0, 0.579160 }, {330.0, 0.541033 }, {350.0, 0.505590 }, {370.0, 0.471746 }, {390.0, 0.440155 }, {410.0, 0.410522 }, {430.0, 0.382701 }, {450.0, 0.356957 }, {470.0, 0.332400 } }; for (int i = 0; i < angles.length; ++i) { problem.addAngularMeasurement(3.0e7, angles[i][0], angles[i][1]); }; LevenbergMarquardtEstimator estimator = new LevenbergMarquardtEstimator(); estimator.estimate(problem); System.out.println("initial position: " + problem.getX0() + " " + problem.getY0()); System.out.println("velocity: " + problem.getVx0() + " " + problem.getVy0()); } catch (EstimationException ee) { System.err.println(ee.getMessage()); } } public TrajectoryDeterminationProblem(double t0, double x0Guess, double y0Guess, double vx0Guess, double vy0Guess) { this.t0 = t0; x0 = new EstimatedParameter( "x0", x0Guess); y0 = new EstimatedParameter( "y0", y0Guess); vx0 = new EstimatedParameter("vx0", vx0Guess); vy0 = new EstimatedParameter("vy0", vy0Guess); // inform the base class about the parameters addParameter(x0); addParameter(y0); addParameter(vx0); addParameter(vy0); } public double getX0() { return x0.getEstimate(); } public double getY0() { return y0.getEstimate(); } public double getVx0() { return vx0.getEstimate(); } public double getVy0() { return vy0.getEstimate(); } public void addAngularMeasurement(double wi, double ti, double ai) { // let the base class handle the measurement addMeasurement(new AngularMeasurement(wi, ti, ai)); } public void addDistanceMeasurement(double wi, double ti, double di) { // let the base class handle the measurement addMeasurement(new DistanceMeasurement(wi, ti, di)); } public double x(double t) { return x0.getEstimate() + (t - t0) * vx0.getEstimate(); } public double y(double t) { return y0.getEstimate() + (t - t0) * vy0.getEstimate(); } private class AngularMeasurement extends WeightedMeasurement { public AngularMeasurement(double weight, double t, double angle) { super(weight, angle); this.t = t; } public double getTheoreticalValue() { return Math.atan2(y(t), x(t)); } public double getPartial(EstimatedParameter parameter) { double xt = x(t); double yt = y(t); double r = Math.sqrt(xt * xt + yt * yt); double u = yt / (r + xt); double c = 2 * u / (1 + u * u); if (parameter == x0) { return -c; } else if (parameter == vx0) { return -c * t; } else if (parameter == y0) { return c * xt / yt; } else { return c * t * xt / yt; } } private final double t; private static final long serialVersionUID = -5990040582592763282L; } private class DistanceMeasurement extends WeightedMeasurement { public DistanceMeasurement(double weight, double t, double angle) { super(weight, angle); this.t = t; } public double getTheoreticalValue() { double xt = x(t); double yt = y(t); return Math.sqrt(xt * xt + yt * yt); } public double getPartial(EstimatedParameter parameter) { double xt = x(t); double yt = y(t); double r = Math.sqrt(xt * xt + yt * yt); if (parameter == x0) { return xt / r; } else if (parameter == vx0) { return xt * t / r; } else if (parameter == y0) { return yt / r; } else { return yt * t / r; } } private final double t; private static final long serialVersionUID = 3257286197740459503L; } private double t0; private EstimatedParameter x0; private EstimatedParameter y0; private EstimatedParameter vx0; private EstimatedParameter vy0; }
HelpLast edited by Azoth; 03-07-2017 at 08:50 PM.
- 03-07-2017, 07:19 PM #2
Re: Can't find symbols errors ugh
see the errors in the window in the pic
Also images are useless for getting text to include in responses. Better to copy the text and paste it here.
Please edit your post and wrap your code with code tags:
[code]
**YOUR CODE GOES HERE**
[/code]
to get highlighting and preserve formatting.If you don't understand my response, don't ignore it, ask a question.
- 03-07-2017, 07:30 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Can't find symbols errors ugh
First (after squinting at the image) your class needs to be in a java file of the same name.
Which is what that error says.
After that, your apache maths jar seem to be missing from the build path.Please do not ask for code as refusal often offends.
** This space for rent **
- 03-07-2017, 08:47 PM #4
Member
- Join Date
- Mar 2017
- Posts
- 6
- Rep Power
- 0
Re: Can't find symbols errors ugh
I did that. I place the library in alll the relevant areas.
This is what I did
Libraries->Compile Apache
Liobraries->Processor Apache
Libraries-> Run Apache
Libraries -> Compiletest Apache
Libraries ->Run test Apache
ClassPath =C:\math\commons-math.3.6.1\commons-math-3.3.6.1.jar
Same for the source Classpath
- 03-08-2017, 10:09 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Can't find symbols errors ugh
If that classpath is defined in the environment variables, remove it.
You should never declare one there, no matter what some dubious websites say. It just confuses matters.
Have you fixed the classname / filename issue?
That's the start point and should remove the first error.Please do not ask for code as refusal often offends.
** This space for rent **
- 03-08-2017, 05:20 PM #6
Member
- Join Date
- Mar 2017
- Posts
- 6
- Rep Power
- 0
Re: Can't find symbols errors ugh
I removed the CLASSPATH and it removed Apache-1. 3.2 altogether from the Libraries.
I saw this:
Libraries
Jdk
When I reinstalled CLASSPATH
I saw this
Libraries:
Jdk
Apache1-3.2
When compiling it gave me the error
It stated library unreadable?
- 03-08-2017, 05:43 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Can't find symbols errors ugh
Where is the CLASSPATH declared?
Is it in the environment variables of your PC (or equivalent for other OSes)?Please do not ask for code as refusal often offends.
** This space for rent **
- 03-09-2017, 08:19 PM #8
Member
- Join Date
- Mar 2017
- Posts
- 6
- Rep Power
- 0
Re: Can't find symbols errors ugh
ClASSPATH is in the Netbeans environment
It is in the Library module.
I have nothing set in my PC environment for it . I set one for JAVA. Should I do the same for Apache ?
- 03-10-2017, 10:13 AM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Can't find symbols errors ugh
I don't tend to keep my libraries in a separate location.
I tend to bundle them with the project.
So, create a libs directory as part of your project and stick all the jar dependencies in there.
That way you can see, in the project, that everything is in place.
Then change any project paths to point to that directory.
Also, you still haven't said if you'd fixed the filename.Please do not ask for code as refusal often offends.
** This space for rent **
- 03-10-2017, 05:53 PM #10
Member
- Join Date
- Mar 2017
- Posts
- 6
- Rep Power
- 0
Re: Can't find symbols errors ugh
Not yet.
Ok I will put external libs in the same project dir.
Anyways I created a test class called ApacheMathTest and it works so fad
- 03-24-2017, 01:49 PM #11
Member
- Join Date
- Mar 2017
- Posts
- 10
- Rep Power
- 0
Re: Can't find symbols errors ugh
i am new in netbeans, suffering same problems, i am trying to cod a simple query on db, it makes me to cast result which is not necessary, it dosen't know result.next() plz inform me when you found your answer.
- 03-24-2017, 02:44 PM #12
Re: Can't find symbols errors ugh
This question has moved here: https://www.java-forums.org/netbeans...st-result.html
"It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013
Similar Threads
-
cannot find symbol errors
By noviceJava in forum New To JavaReplies: 5Last Post: 02-05-2015, 10:57 AM -
Cannot find symbol errors question
By zlloyd1 in forum New To JavaReplies: 1Last Post: 12-17-2012, 04:24 PM -
Keep on getting cannot find symbol errors...
By wizar in forum New To JavaReplies: 6Last Post: 11-25-2010, 05:31 AM -
Code errors (incompatible types, cannot find variables, etc)
By Menre in forum Advanced JavaReplies: 7Last Post: 08-28-2009, 09:23 AM
Bookmarks