Results 1 to 19 of 19
  1. #1
    spulliam81 is offline Member
    Join Date
    Jun 2011
    Posts
    6
    Rep Power
    0

    Default 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("============================== ================================================== ");

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    You don't need to do String.valueOf(...), assuming the variables are ints or other primitives, drop the method and see if it works.

  3. #3
    Junky's Avatar
    Junky is online now Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    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.

  4. #4
    spulliam81 is offline Member
    Join Date
    Jun 2011
    Posts
    6
    Rep Power
    0

    Default

    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 +" % ");

  5. #5
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Is that the entire error message? Have you tried junkys suggestion?

  6. #6
    spulliam81 is offline Member
    Join Date
    Jun 2011
    Posts
    6
    Rep Power
    0

    Default

    Excuse my ignorance but I'm not sure what he or she meant by do a clean build of the project. :(

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    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).

  8. #8
    Junky's Avatar
    Junky is online now Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    Quote Originally Posted by spulliam81 View Post
    Excuse my ignorance but I'm not sure what he or she meant by do a clean build of the project. :(
    Are you using an IDE (Eclipse, Netbeans etc)? Then one of the menu options should be "Clean and build project".

    If not try deleting all your .class files and compile your code again.

  9. #9
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    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.

  10. #10
    spulliam81 is offline Member
    Join Date
    Jun 2011
    Posts
    6
    Rep Power
    0

    Default

    I'm using NetBeans

  11. #11
    Junky's Avatar
    Junky is online now Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    and......

    Find and use the Clean and build option.

  12. #12
    spulliam81 is offline Member
    Join Date
    Jun 2011
    Posts
    6
    Rep Power
    0

    Default

    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)

  13. #13
    Junky's Avatar
    Junky is online now Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    OK so you have 2 errors. You have to fix them before you can run your code.

  14. #14
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    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

  15. #15
    spulliam81 is offline Member
    Join Date
    Jun 2011
    Posts
    6
    Rep Power
    0

    Default

    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
    }

    }

  16. #16
    Junky's Avatar
    Junky is online now Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    Quote Originally Posted by sunde887 View Post
    @junky: nice sig
    Nothing like having an unachievable goal.

  17. #17
    Junky's Avatar
    Junky is online now Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    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.

  18. #18
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    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.

  19. #19
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default

    spulliam81, you've already been asked to use the code tags. If you're not willing to read responses and take advice, there's really no point in members here trying to help you.

    db

Similar Threads

  1. Replies: 2
    Last Post: 04-27-2011, 04:58 AM
  2. Replies: 6
    Last Post: 03-11-2011, 03:53 AM
  3. Replies: 3
    Last Post: 02-03-2011, 04:49 PM
  4. Replies: 4
    Last Post: 10-25-2010, 07:42 PM
  5. Replies: 3
    Last Post: 11-06-2008, 04:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •