Results 1 to 19 of 19
- 06-21-2011, 05:45 AM #1
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
Need help with exception thread - new to java
I am getting this message and I am new to Java. The first two row are where the error is coming from
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
at McBrideCalc.main(McBrideCalc.java:55)
System.out.println("Following is the payment plan for " + String.valueOf(loanAmount)+
" In " + String.valueOf(selectedYears) + " Years with the rate of " + String.valueOf(selectedRate*100) +" % ");
System.out.print("Payment number "); // Displays the Payment Header
System.out.print("Interest payed ");//Displays the Interest Header
System.out.print("Actual Amount payed ");//Displays the Actual Pay Header
System.out.print(" Amount Owed ");
System.out.println();//new line
System.out.println("============================== ================================================== ");
- 06-21-2011, 05:55 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
You don't need to do String.valueOf(...), assuming the variables are ints or other primitives, drop the method and see if it works.
- 06-21-2011, 06:00 AM #3
Since this is a RuntimeException I wonder if your code has not been compiled correctly or perhaps has compilation errors. Try doing a clean build of the project just to make sure everything is fine.
- 06-21-2011, 06:01 AM #4
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
Thank you. I still get the same message when I took the string off...
System.out.println("Following is the payment plan for " + loanAmount +
" In " + selectedYears + " Years with the rate of " + selectedRate*100 +" % ");
- 06-21-2011, 06:04 AM #5
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Is that the entire error message? Have you tried junkys suggestion?
- 06-21-2011, 06:07 AM #6
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
Excuse my ignorance but I'm not sure what he or she meant by do a clean build of the project. :(
-
Also post more code, and place that code between [code] and [/code] tags (note that the bottom tag is different from the top tag) so that the code will retain its formatting and be readable).
- 06-21-2011, 06:10 AM #8
- 06-21-2011, 06:12 AM #9
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
How are you attempting to run your program? An IDE? If so, which? If not, are you using command line?
Is that the only error message/full error message? If not, please post full error messages and all of them.
- 06-21-2011, 06:15 AM #10
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
I'm using NetBeans
- 06-21-2011, 06:16 AM #11
and......
Find and use the Clean and build option.
- 06-21-2011, 06:17 AM #12
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
This is the only error message - Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
at McBrideCalc.main(McBrideCalc.java:55)
Below is what I got when I did a clean and build
init:
deps-clean:
Updating property file: C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build\built-clean.properties
Deleting directory C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build
clean:
init:
deps-jar:
Created dir: C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build
Updating property file: C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build\built-jar.properties
Created dir: C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build\classes
Created dir: C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build\empty
Created dir: C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build\generated-sources\ap-source-output
Compiling 5 source files to C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\build\classes
C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\src\McBrideCalc.java:2: class, interface, or enum expected
*/
C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\src\McBrideCalc.java:69: reached end of file while parsing
System.out.println("============================== ================================================== ");
2 errors
C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\nbproject\build-impl.xml:603: The following error occurred while executing this line:
C:\Users\Owner\Documents\NetBeansProjects\JavaAppl ication1\nbproject\build-impl.xml:245: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)
- 06-21-2011, 06:19 AM #13
OK so you have 2 errors. You have to fix them before you can run your code.
- 06-21-2011, 06:21 AM #14
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Looks like you messed up on the brackets, make sure you have a closing bracket for each opening lines. Would you mind posting more code?
@junky: nice sig
- 06-21-2011, 06:27 AM #15
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
Yes Junky is referring to me lol...I told ya'll I am VERY VERY new at this.
This is all the code.
//
import java.io.*; // input output
import java.math.*; // calculator
import java.text.*; //format
public class McBrideCalc//class
{
private static int selectedRate;
public static void main(String[] args) throws IOException
{
// Declaration of variables
double dMortgageLoanAmount; // Mortgage Loan Amount
int iMonthlyPaymentAmount; // Monthly Loan Payment Amount
int startNum,lineCtr,ctr;
int lastNum=360;
int iLenthOfLoan=360;
int maxLineCtr=361;
double dLoanTerm;
double dMonthlyInterestPaid;
double dLoanBalance;
String nothing;
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader bfr = new BufferedReader(isr);// creates the input reader to user interactionDecimalFormat twoDigits = new DecimalFormat("0.00");
System.out.println(" Welcome To Mortgage Payment Calculator ");
System.out.println();//new line
// Declaration of Array for mortgage calculation of different payment plans
double[]dInterestRate ={0.0535,0.055,0.0575}; // Loan Interest Rates
int[]iLoanTerm = {84,180,360}; // Monthly loan figures
System.out.println("Following is the payment plan for " + loanAmount +
" In " + selectedYears + " Years with the rate of " + selectedRate*100 +" % ");
System.out.print("Payment number "); // Displays the Payment Header
System.out.print("Interest paid ");//Displays the Interest Header
System.out.print("Amount paid ");//Displays the Actual Pay Header
System.out.print(" Amount owed ");
System.out.println();//new line
}
}
- 06-21-2011, 06:28 AM #16
- 06-21-2011, 06:31 AM #17
McBrideCalc.java:52: cannot find symbol
symbol : variable loanAmount
McBrideCalc.java:54: cannot find symbol
symbol : variable selectedYears
Those are the errors I get when I compile your code.
- 06-21-2011, 06:33 AM #18
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Looks like you have a comment going off it's line when you create a buffered reader, although, this probably just the unformatted code. Either way, check to make sure the comment isn't partially uncommented.
- 06-21-2011, 07:04 AM #19
Similar Threads
-
Exception in thread "main" java.lang.NoClassDefFoundError: client Caused by: java.lan
By marlon9472 in forum New To JavaReplies: 2Last Post: 04-27-2011, 04:58 AM -
exception in thread main java.util.nosuchelementexception
By dude1it in forum New To JavaReplies: 6Last Post: 03-11-2011, 03:53 AM -
exception in thread main java.lang.arrayindexoutofboundsexception
By dwill19686 in forum New To JavaReplies: 3Last Post: 02-03-2011, 04:49 PM -
Exception in thread "main" java.lang Exception In InitializerError
By kenzo2009 in forum New To JavaReplies: 4Last Post: 10-25-2010, 07:42 PM -
Exception in thread "Thread-22" java.lang.NoClassDefFoundEthen screen just sits there
By bnh14 in forum Java AppletsReplies: 3Last Post: 11-06-2008, 04:24 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks