Link to home
Start Free TrialLog in
Avatar of GurkanGer
GurkanGer

asked on

"cannot resolve symbol"

Hi everyone,

My situation is:
* I have a Java code (ok)
* I'm decompiling it (ok)
* I'm ONLY looking at the code (Changed NOTHING) (ok)
* I'm trying to compile the code again (and...)
* I'm getting the error: "cannot resolve symbol"

What could it be?
Thank you all.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

If you're recompiling the result of your decompile, the former has probably broken it
Post the code where the error occurs
Sorry - i mean the decompile has probably broken it
>> I'm decompiling it (ok)
You really mean DEcompile?
>>Sorry - i mean the decompile has probably broken it

Which is of course a commonplace occurrence
Avatar of GurkanGer
GurkanGer

ASKER

Dear zzynx,

The decompiler i'm using is "DJ Java Decompiler"
All right.
I was confused because you were talking about "decompiling *code*" and  "compiling *again*"

>> I'm getting the error: cannot resolve symbol
= a variable/function name is used that isn't defined/declared

Most Java decompiler don't support inner classes.
You must also decompile inner classes ( __the_class__$ ... .class )
The code and error follows:
import java.awt.*;
import java.applet.*;
import java.awt.image.*;
import java.awt.event.*;

import com.lotus.sametime.core.comparch.*;
import com.lotus.sametime.core.constants.*;
import com.lotus.sametime.core.types.*;
import com.lotus.sametime.community.*;
import com.lotus.sametime.places.*;
import com.lotus.sametime.awarenessui.*;
import com.lotus.sametime.awarenessui.placelist.*;

/**
 * Meeting Applet sample showing how to create a chat only meeting
 */
public class ChatMeeting extends Applet
{
  private STSession m_session;
  private CommunityService m_comm;
  private Place m_place;
  private PlaceAwarenessList m_peopleList;
   
  private ChatPanel m_chatPanel;  //This is line 20
  private Label m_PeopleNumLbl;
   
  private static int numUsersInPlace = 0;
   
  /**
   * Initialize the applet. Create the session, load and start
   * the components.
   */
  public void init()
.....
The error is:
D:\Lotus\CM\ChatMeeting.java:20: cannot resolve symbol
symbol  : class ChatPanel
location: class ChatMeeting
    private ChatPanel m_chatPanel;
            ^


That just means that class ChatPanel is not available to the compiler in the classpath
maybe you have to put all source files in one package/directory "test"

Then start each source file with:

package test;
What package does ChatMeeting think it's in - if any?

Another decompiler :
http://www.programfiles.com/Default.asp?LinkId=22748

>> maybe you have to put all source files in one package/directory "test"
How will this solve the problem ?

I de&recompiled the innerclasses too, but no success.

Now i will try:
>Then start each source file with:
>package test;

And then JAD.

Hope to return with positive answer.
>> How will this solve the problem ?
Think that if all files are in the same package,
they can "see" each other without any need to import them. No?

>> What package does ChatMeeting think it's in - if any?
Apparently CEHJ is also thinking in that direction
>>Now i will try:

I too don't know how that's going to help. And you didn't answer my question...
...oh and hold off on downloading any other decompilers too - faulty kit is not part of your problem from what i can see
>What package does ChatMeeting think it's in - if any?

ChatMeeting is not in any package.
I'm calling this applet from a cab.
>> they can "see" each other without any need to import them. No?
No package is needed to do that : the files may be in the same directory or not, but theses directories must be in the classpath.

Well you'll just have to make sure that all those private member variable classes at least are in the same directory
>> I'm calling this applet from a cab.
if you put the cab file in the classpath, you will get a duplicate class error.
extract all classes from the cab file, or delete the recompiled class from it.

All classes are in a package in fact. It just happens that ChatMeeting is in the 'default package'
>make sure that all those private member variable classes at least are in the same directory

No; the classes are not in the same directory, but they are defined in classpath.
That should be OK
...although it might makes things easier if they were
I'm calling tihs applet within an HTML page with cabbase parameter, and all classes should be in the ChatMeeting.cab
I decompressed the cab file in to chatmeeting folder, decompile all classes and inner classes and saw the codes. And now trying to compile the ChatMeeting.java

You can find the cab file's original structure below.
>ChatMeeting$CommunityEventsListener.java
>ChatMeeting$ParticipantListListener.java
>ChatMeeting$PlaceEventsListener.java
>ChatMeeting.java
>ChatPanel$ChatAreaEventsListener.java
>ChatPanel$MyMsgEventsListener.java
>ChatPanel$TextFieldEventListener.java
>ChatPanel.java

Also I have another 2 cab files, and 2 jar files which I've been already added to classpath while compiling.



Have you tried just

javac *.java

in the source directory?
>Have you tried just javac *.java

Okay, i tried and the answer was 87 errors 8-)
Sorry.
Right. Better start with just ChatMeeting then
>Right. Better start with just ChatMeeting then

Yes?
I decompiled the code with JAD, and i got different errors:

D:\Lotus\chatmeeting\ChatMeeting.java:51: cannot resolve symbol
symbol  : method bindToPlace  (com.lotus.sametime.places.Place)
location: class ChatPanel
            m_chatPanel.bindToPlace(placeevent.getPlace());
                       ^


D:\Lotus\chatmeeting\ChatMeeting.java:167: cannot resolve symbol
symbol  : constructor ChatPanel  (com.lotus.sametime.core.comparch.STSession,jav
a.applet.AppletContext)
location: class ChatPanel
        m_chatPanel = new ChatPanel(m_session, getAppletContext());
                      ^
D:\Lotus\chatmeeting\ChatMeeting.java:168: cannot resolve symbol
symbol  : method add  (ChatPanel,java.lang.String)
location: class java.awt.Panel
        panel3.add(m_chatPanel, "Center");
              ^
..which is what you're already doing isn't it? Where are you at now?
Sorry people,
The 100 points goes to nobody.

The answer was:

put a . (yes a dot) in the beginnig of the classpath.

Thanks to all
At https://www.experts-exchange.com/Community_Support/CleanUp/ you can post a 0 points question
to ask to delete this question and to refund you the points.
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial