Getting error "Can't resolve symbol"  getting frustrated

Posted on 2005-03-26
Medium Priority
Last Modified: 2013-11-23
Ok I have a Java program that is calling another program.  The name of the program that has the frame and everything in it is MortApp1.  The program that it is trying to call is Mortcalc2.  The first thing that I did was compile the Mortcalc2 program and then I go and compile the MortApp1 program and I get the following error messages:
C:\Java\help>javac Mortcalc2.java

C:\Java\help>javac MortApp1.java
MortApp1.java:30: cannot resolve symbol
symbol  : class Mortcalc2
location: class MortApp1
    static Mortcalc2 MC2;
MortApp1.java:88: cannot resolve symbol
symbol  : class Mortcalc2
location: class MortApp1
            MC2 = new Mortcalc2(new Double(txtPrincipal.getText()).doubleValue(), new Double(txtRate.ge
tText()).doubleValue(), new Integer(txtTerm.getText()).intValue());

I have gone through this at least 800 zillion times, I am not sure what the problem is.  I am enclosing the frame class first and then below it I will enclose the program that it calls with is MortCalc2.  Any assitance that you can give me would be greatly appreciated.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MortApp1 implements ActionListener {
    // Declare our variables
    static JFrame frame;
    static JPanel contentPane;
    static JPanel pRow1;
    static JPanel pRow2;
    static JPanel pRow3;
    static JPanel pRow4;
    static JPanel pRow5;
    static JLabel lblPrincipal;
    static JLabel lblRate;
    static JLabel lblTerm;
    static JLabel lblMonthlyPaymentLbl;
    static JLabel lblMonthlyPayment;
    static JTextField txtPrincipal;
    static JTextField txtRate;
    static JTextField txtTerm;
    static JButton bCalculate;
    static JButton bQuit;
    static double principal;
    static double rate;
    static int term;
    static double montlypayment;
    static Mortcalc2 MC2;
    private Component createComponents() {
        // Create the panels
        contentPane = new JPanel(new GridLayout(5, 1));
        pRow1 = new JPanel(new GridLayout(1,2,5,0));
        pRow2 = new JPanel(new GridLayout(1,2,5,0));
        pRow3 = new JPanel(new GridLayout(1,2,5,0));
        pRow4 = new JPanel(new GridLayout(1,2,5,0));
        pRow5 = new JPanel(new FlowLayout(FlowLayout.CENTER,5,0));
        // Create and add the components.
        lblPrincipal = new JLabel("Principal:", JLabel.RIGHT);
        txtPrincipal = new JTextField(20);
        lblRate = new JLabel("Rate:", JLabel.RIGHT);
        txtRate = new JTextField(8);
        lblTerm = new JLabel("Term:", JLabel.RIGHT);
        txtTerm = new JTextField(8);
        lblMonthlyPaymentLbl = new JLabel("Monthly Payment:", JLabel.RIGHT);
        lblMonthlyPayment = new JLabel("");
        bCalculate = new JButton("Calculate");
        bQuit = new JButton("Quit");
        // Add sub-panels to content panel
        // Return the content panel
        return contentPane;
    public void actionPerformed(ActionEvent e) {
        // Check which button triggered the event
        if("Calculate".equals(e.getActionCommand())) {
            // Create a string format
            java.text.DecimalFormat dec = new java.text.DecimalFormat("$,###.00");
            // Create a new instance of Mortcalc2 with values from text boxes
            MC2 = new Mortcalc2(new Double(txtPrincipal.getText()).doubleValue(), new Double(txtRate.getText()).doubleValue(), new Integer(txtTerm.getText()).intValue());
            // Set the monthly payment
        else if("Quit".equals(e.getActionCommand())) {
            // Exit the program
    private static void createAndShowGUI() {
        // Set window decorations
        // Create and set up the window.
        frame = new JFrame("mortApp");
        // Create an instance of our application
        MortApp1 app = new MortApp1();
        // Create our components
        Component contents = app.createComponents();
        // Add components to frame
        // Display the window.
        // Don't allow window to be resized
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {

Here is the program that I have getting called:

import java.text.DecimalFormat;
import java.io.*;

public class Mortcalc2      // name of the program
    // global class variables
    private double principal;                                           // loan principal
    private double interestRateYears;                                   // annual interest rate (percentage)
    private double interestRateMonths;                                  // monthly interst rate
    private int termYears;                                              // length of loan in years
    private int termMonths;                                             // length of loan in months
    private double monthlyPayment;                                      // monthly payment

    private double balance;                                             // displays current balance
    private double interestPaid;                                        // displays the interest paid
    private double principalPaid;                                       // displays the principal paid
    private double monthlyInterestPayment;                              // holds current interest payment
    private double monthlyPrincipalPayment;                             // holds current principal payment

    private int currentMonth;

    java.text.DecimalFormat dec = new java.text.DecimalFormat(",###.00");

    public Mortcalc2(double p_Principal, double p_Rate, int p_Term)
        // assign values
        principal = p_Principal;                                    // loan principal
        interestRateYears = p_Rate;                                 // annual interest rate (percentage)
        interestRateMonths = (interestRateYears / 12) / 100;        // monthly interest rate
        termYears = p_Term;                                         // length of loan in years
        termMonths = (termYears * 12);                              // length of loan in months
        monthlyInterestPayment = 0;                                 // set current interest payment = 0
        monthlyPrincipalPayment = 0;                                // set current principal payment = 0
        balance = principal;                                        // set current balance = principal

        currentMonth = 1;

        monthlyPayment = (principal * interestRateMonths) /         // calculate monthly payment
            (1 - Math.pow(1 + interestRateMonths, - termMonths));


    public double getMonthlyPayment()
        // return montlyPayment;
        return monthlyPayment;

    public double getMonthlyInterestPayment()
        // return montly interest payment
        return monthlyInterestPayment;

    public double getMonthlyPrincipalPayment()
        // return montly principal payment
        return monthlyPrincipalPayment;

    public double getBalance()
        // return balance
        return balance;

    public void nextMonth()
        if(currentMonth < termMonths + 1)
            // calculate interest and principal payments
            monthlyInterestPayment = (balance * interestRateMonths);
            monthlyPrincipalPayment = (monthlyPayment - monthlyInterestPayment);
            balance = (balance - monthlyPrincipalPayment);

} // End class Mortcalc2
Question by:gschoser
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
LVL 14

Accepted Solution

sudhakar_koundinya earned 2000 total points
ID: 13636780
do this  before you compile

set classpath=%classpath%;.;

Now compile your program

javac *.java
LVL 14

Expert Comment

ID: 13636787
>>set classpath=%classpath%;.;

So that it checks the classes in your current folder.

Means while you are compiling a particular class, if class contains any dependable class objects then JVM can identify the dependable classes also. In your case MortCalc2 in MortApp1
LVL 14

Expert Comment

ID: 13636790
>>set classpath=%classpath%;.;

I presume you know how to set the classpaths at DOS prompt

Sudhakar Chavali
LVL 14

Expert Comment

ID: 13636865

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question