Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

cannot resolve symbol
I am having a problem compiling my program that I think is related to
my classpath. All of my swing components create unresolved symbols in
their declarations. Here are my compile errors:

C:\Documents and Settings\Michael\My
Documents\School\CSC3360\Concentration>java
c Concentration.java
Concentration.java:18: cannot resolve symbol
symbol  : class Jframe
location: class Concentration
Jframe f = new ConcentrationFrame("Concentration");
^
.\ConcentrationFrame.java:16: cannot resolve symbol
symbol  : class Jframe
location: class ConcentrationFrame
public class ConcentrationFrame extends Jframe {
^
.\ConcentrationFrame.java:18: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
private Jpanel centerPanel =
^
.\ConcentrationFrame.java:20: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
private Jpanel buttonPanel =
^
.\ConcentrationFrame.java:22: cannot resolve symbol
symbol  : class Jlabel
location: class ConcentrationFrame
private Jlabel statusLabel =
^
.\ConcentrationFrame.java:19: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
new Jpanel(new FlowLayout(FlowLayout.CENTER, 20, 20));
^
.\ConcentrationFrame.java:21: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
new Jpanel(new GridLayout(4, 6, 20, 20));
^
.\ConcentrationFrame.java:36: cannot resolve symbol
symbol  : method setBackground (java.awt.Color)
location: class ConcentrationFrame
setBackground(new Color(255, 255, 255));
^
.\ConcentrationFrame.java:58: cannot resolve symbol
symbol  : variable f
location: class ConcentrationFrame
Container contentPane = f.getContentPane();
^
.\ConcentrationFrame.java:65: cannot resolve symbol
symbol  : variable EXIT_ON_CLOSE
location: class ConcentrationFrame
 setDefaultCloseOperation(EXIT_ON_CLOSE);

^
10 errors

As you can see, I am not certain that the compiler is seeing the
javax.swing file in the classpath. I had this problem before in a
program using only awt and changed both my path and classpath to the
following:

PATH = C:\j2sdk1.4.2_05\bin;C:\Program Files\SSH Communications
Security\SSH Secure Shell
CLASSPATH = .;C:\Program Files\Java\j2re1.4.1\lib\ext\QTJava.zip

Everything before the semicolon was added to both environment
variables by me to resolve the compilation issues I had with the
previous program. However, that program compiles fine now. Please
help!

Here is the driver class. The helper class imports the same packages.

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

// Driver class
public class Concentration {
public static void main(String[] args) {
Jframe f = new ConcentrationFrame("Concentration");
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = f.getSize();
f.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
f.pack();
f.setVisible(true);
}
}

Hope this helps.

Report this thread to moderator Post Follow-up to this message
Old Post
Michael
09-26-04 01:57 AM


Re: cannot resolve symbol
"Michael" <michaelyaeger@hotmail.com> wrote in message
news:5ee31395.0409251632.1bc337d8@posting.google.com...
> I am having a problem compiling my program that I think is related to
> my classpath. All of my swing components create unresolved symbols in
> their declarations. Here are my compile errors:
>
> C:\Documents and Settings\Michael\My
> Documents\School\CSC3360\Concentration>java
> c Concentration.java
> Concentration.java:18: cannot resolve symbol
> symbol  : class Jframe
> location: class Concentration
>                 Jframe f = new ConcentrationFrame("Concentration");
>                 ^
> .\ConcentrationFrame.java:16: cannot resolve symbol
> symbol  : class Jframe
> location: class ConcentrationFrame
> public class ConcentrationFrame extends Jframe {
>                                         ^
> .\ConcentrationFrame.java:18: cannot resolve symbol
> symbol  : class Jpanel
> location: class ConcentrationFrame
>         private Jpanel centerPanel =
>                 ^
> .\ConcentrationFrame.java:20: cannot resolve symbol
> symbol  : class Jpanel
> location: class ConcentrationFrame
>         private Jpanel buttonPanel =
>                 ^
> .\ConcentrationFrame.java:22: cannot resolve symbol
> symbol  : class Jlabel
> location: class ConcentrationFrame
>         private Jlabel statusLabel =
>                 ^
> .\ConcentrationFrame.java:19: cannot resolve symbol
> symbol  : class Jpanel
> location: class ConcentrationFrame
>                 new Jpanel(new FlowLayout(FlowLayout.CENTER, 20, 20));
>                     ^
> .\ConcentrationFrame.java:21: cannot resolve symbol
> symbol  : class Jpanel
> location: class ConcentrationFrame
>                 new Jpanel(new GridLayout(4, 6, 20, 20));
>                     ^
> .\ConcentrationFrame.java:36: cannot resolve symbol
> symbol  : method setBackground (java.awt.Color)
> location: class ConcentrationFrame
>                 setBackground(new Color(255, 255, 255));
>                 ^
> .\ConcentrationFrame.java:58: cannot resolve symbol
> symbol  : variable f
> location: class ConcentrationFrame
>                 Container contentPane = f.getContentPane();
>                                         ^
> .\ConcentrationFrame.java:65: cannot resolve symbol
> symbol  : variable EXIT_ON_CLOSE
> location: class ConcentrationFrame
>                  setDefaultCloseOperation(EXIT_ON_CLOSE);

>                                          ^
> 10 errors
>
> As you can see, I am not certain that the compiler is seeing the
> javax.swing file in the classpath. I had this problem before in a
> program using only awt and changed both my path and classpath to the
> following:
>
> PATH = C:\j2sdk1.4.2_05\bin;C:\Program Files\SSH Communications
> Security\SSH Secure Shell
> CLASSPATH = .;C:\Program Files\Java\j2re1.4.1\lib\ext\QTJava.zip
>
> Everything before the semicolon was added to both environment
> variables by me to resolve the compilation issues I had with the
> previous program. However, that program compiles fine now. Please
> help!
>
> Here is the driver class. The helper class imports the same packages.
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> import java.util.*;
>
> // Driver class
> public class Concentration {
> public static void main(String[] args) {
> Jframe f = new ConcentrationFrame("Concentration");
> Dimension screenSize =
> Toolkit.getDefaultToolkit().getScreenSize();
> Dimension frameSize = f.getSize();
> f.setLocation((screenSize.width - frameSize.width) / 2,
> (screenSize.height - frameSize.height) / 2);
> f.pack();
> f.setVisible(true);
> }
> }
>
> Hope this helps.

Java is case sensitive, and the names of the classes
you want are JFrame, JPanel, JLabel, and so on. You
may have other errors, but fix these first, and recompile.



Report this thread to moderator Post Follow-up to this message
Old Post
George W. Cherry
09-26-04 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.