[Solved]At my wit's end to correct the error messages in Eclipse [message #1770978] |
Sun, 20 August 2017 07:37  |
Eclipse User |
|
|
|
Five Files in compressed format attached as New_CalculatorModel.tar.gz.
The codes were taken from `Learn Java in a Weekend` by `Joseph Russell`.
All of these files show errors in Eclipse and don't appear to compile in Eclipse, but all except one compile at the terminal with Javac filename.java
That one, CalculatorHelperTest.java , shows the following error messages and doesn't compile, even from the terminal.
javac CalculatorHelperTest.java
CalculatorHelperTest.java:11: cannot find symbol
symbol : method setOperand1(double)
location: class CalculatorHelper
calcHelper.setOperand1(a);
^
CalculatorHelperTest.java:12: cannot find symbol
symbol : method setOperand2(double)
location: class CalculatorHelper
calcHelper.setOperand2(b);
^
CalculatorHelperTest.java:13: add() has private access in CalculatorHelper
System.out.println(a + " + " + b + " = " + calcHelper.add());
^
CalculatorHelperTest.java:14: subtract() has private access in CalculatorHelper
System.out.println(a + " - " + b + " = " + calcHelper.subtract());
^
CalculatorHelperTest.java:15: multiply() has private access in CalculatorHelper
System.out.println(a + " * " + b + " = " + calcHelper.multiply());
^
CalculatorHelperTest.java:16: divide() has private access in CalculatorHelper
System.out.println(a + " / " + b + " = " + calcHelper.divide());
^
6 errors
My master, Dr. Merks, please advise.
[Updated on: Wed, 23 August 2017 07:51] by Moderator
|
|
|
|
|
|
|
|
|
|
|
[Solved]Re: At my wit's end to correct the error messages in Eclipse [message #1771247 is a reply to message #1771235] |
Wed, 23 August 2017 06:29  |
Eclipse User |
|
|
|
Yes, my query is: Why? I have followed the book! I have carefully removed and replaced all the doubtful punctuation marks. Okay, I will check thoroughly once more!
But then why is OpenJDK allowing the files to run?
[Later]
This part gave me the clue. The console registered:
ConsoleThe project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project CalculatorModel Unknown Java Problem I had built the CalculatorModel folder manually within the Eclipse workspace folder, and did not place the source codes within the src folder, and so the .classpath file was not built.
Built an src folder and moved all the sources to that folder. Studied and copied a .classpath file from another project in the CalculatorModel folder. And the problem was resolved!
[Updated on: Sat, 26 August 2017 03:44] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.09058 seconds