Hi,
I'm very new to Java and I have the following problem while compiling a source code:

g:\Java\Proj\baseline.java:1487: cannot find symbol
symbol  : constructor a(baseline)
location: class baseline.a
                          k.setItemStateListener(new a(this));
                                                 ^

I've ran the compiler with the following flags:

javac -d g:\Java\Proj\compiled\ -classpath g:\Java\WTK2\wtklib\emptyapi g:\Java\Proj\baseline.java

The source files are composed by a file called "baseline.jad" and another called "a.jad" which are in the same folder. Now I've renamed both files with the ".java" extension.
I don't know much about java but I think that the error could be caused by wrong filename/folder of the "a.java" or if the "a.java" class must be imported/declareted in some way in the "baseline.java" source.
Many thanks in advance for any help. ;)

Recommended Answers

All 3 Replies

I'm not sure I undestand what your doing with the calll of new a(this)...Could you explain.

The way you have it, it's like you have an inner class called a, and your are trying to pass the whole class to it. Am I correct?

I'm not sure I undestand what your doing with the calll of new a(this)...Could you explain.

The way you have it, it's like you have an inner class called a, and your are trying to pass the whole class to it. Am I correct?

Probably it may sound ridiculous but neither I know what this call to "a" exactly is. :rolleyes: :lol:

I try to explain myself better:
I've the sourcecode of a Java app for mobile phones and I need to recompile it.
So I've downloaded the J2ME classes (microedition.midlet, etc.) and now I'm stuck with 8 compiling errors.

The sourcecode is composed by 8 files:
baseline.jad, a.jad, b.jad, c.jad, (...), g.jad

At the beginning "baseline.java" calls (imports?) each class with this code:

import java.util.Calendar;
import java.util.TimeZone;
import java.util.Enumeration;
import javax.microedition.midlet.MIDlet;

public class baseline extends MIDlet
    implements CommandListener
{

    final void a()
    {

// CODE CUT

    }

final void b()
    {

// CODE CUT

    }

// ETC.

The beginning of a.jad file is:

import javax.microedition.lcdui.*;

final class a
    implements ItemStateListener
{

// CODE CUT

}

So, why I get this compiling error?

I really hope that this can help, as I've said before I'm quite new to Javaso I apologize for the inaccuracy of the question :rolleyes:

I can provide more info if needed.
Many thanks for your help ;)

The imports statements simply import classes that you need from the java library , not the classes that you are trying to instantiate in your program. Have you compiled all the other classes before trying to compile that one class with the errors? Or are you getting errors with those other classes? See, in order for that code to run, there must be a class called a, which there is, but it also must already be compiled or the compiler wont recognize it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.