PDA

View Full Version : Resolved Cannot find symbol error



dan0
02-28-2009, 06:47 PM
Can anyone tell me how to resolve the following compile-time error?


TestUserInterface.java:5: cannot find symbol
symbol: class UserInterface
location: class projects.web.TestUserInterface
UserInterface ui = new UserInterface();


I have two classes: UserInterface and TestUserInterface. Both are in the same package.

To compile and run them I use the following cmds respectively:


javac -d ..\classes projects\web\TestUserInterface.java

java -cp ..\classes projects.web.TestUserInterface

Following is the code for both classes:


package projects.web;

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

public class UserInterface extends JFrame{

JPanel menuPanel = new JPanel();
JPanel contentPanel = new JPanel();
JPanel selectionPanel = new JPanel();

JButton save = new JButton("Save");
JButton addFiles = new JButton("Add");

public UserInterface(){
super("File Upload");
setSize(500, 500);

menuPanel.add(addFiles);
selectionPanel.add(save);

setLayout(new BorderLayout());
add(menuPanel, BorderLayout.NORTH);
add(contentPanel, BorderLayout.CENTER);
add(selectionPanel, BorderLayout.SOUTH);

} // end constructor

} // end UserInterface clas


package projects.web;

public class TestUserInterface{
public static void main(String[] args){
UserInterface ui = new UserInterface();
}
} // end TestUserInterface class

dan0
02-28-2009, 09:14 PM
Problem was the code; it was creating the interface, but not displaying it. To resolve problem needed to add:
setVisible(true); in UserInterface constructor.