Results 1 to 6 of 6
  1. #1
    po0oker is offline Member
    Join Date
    Oct 2007
    Posts
    11
    Rep Power
    0

    Default cannot find symbol class error

    hi there ,
    i am creating a min class that links several classes and i am doing the following



    Java Code:
    package javazoom.jl.decoder;
    
    public class Main {
     
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
     
     
     
     
    		
    				
    			Decoder  d = new Decoder();
    			Header h = new Header();
    		
     
     
     
    		}
    		
    	}
    i am saving all the classes in the same folder , and i am having this error twice with each line that i creat an instance for a class

    the errors are
    (1)
    cannot find symbol
    symbol : class Decoder
    location: class javazoom.jl.decoder.Main
    Decoder d = new Decoder();
    ^
    (2)
    cannot find symbol
    symbol : class Decoder
    location: class javazoom.jl.decoder.Main
    Decoder d = new Decoder();
    ^

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    The problem: Compiler can not find Decoder and Header classes.

    The solution: You need to tell compiler where these classes.

    If you are using command line javac tool then this will be more problematic. Check parameters of javac command. You will need to place these classes correctly to your classpath or show the place of these classes as classpath to the javac!

    If you are using an IDE like Netbeans, all you need to do is to select Properties of the Project and add the jar containing these classes or the directory containing these classes using a dialog.. And IDE will inform the compiler itself automatically.

  3. #3
    ShoeNinja's Avatar
    ShoeNinja is offline Senior Member
    Join Date
    Oct 2007
    Posts
    124
    Rep Power
    0

    Default

    From what you have posted, it is tough to tell where the problem would be. Is the main class in the same directory as the Decoder class? If it isn't, change your package statement at the top to import.

  4. #4
    po0oker is offline Member
    Join Date
    Oct 2007
    Posts
    11
    Rep Power
    0

    Default

    Thanks for the help guys but i couldn't figure out a solution :confused:

    i have all the classes in the same folder , but how can i import a class in the main class ?

  5. #5
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    Ok create the following directory tree in the directory where you put your Main.class:

    javazoom/jl/decoder

    Into that directory, copy Header and Decoder classes and try to recompile.

    So if the Main.class is inside c:/pooker directory then copy those classes to c:/pooker/javazoom/jl/decoder and go to c:/pooker again and type the following command to recompile your class:

    javac -cp . Main.java

    If it does not work let us know the error message you get.

  6. #6
    ShoeNinja's Avatar
    ShoeNinja is offline Senior Member
    Join Date
    Oct 2007
    Posts
    124
    Rep Power
    0

    Default

    This might be a silly question, but have you checked your classpath? From looking at your code above, you're using some sort of IDE so it should be pretty easy to find. Just search the help docs for 'classpath.'

Similar Threads

  1. [SOLVED] Java Error: Cannot find Symbol...
    By bobleny in forum New To Java
    Replies: 8
    Last Post: 04-15-2008, 06:35 AM
  2. Programm Error: cannot find symbol Help?
    By junix in forum New To Java
    Replies: 2
    Last Post: 12-10-2007, 05:30 AM
  3. Error: cannot find symbol
    By silvia in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:39 AM
  4. Error: cannot find symbol
    By cachi in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08:12 PM
  5. Error: cannot find symbol constructor
    By zoe in forum New To Java
    Replies: 1
    Last Post: 07-24-2007, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •