Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2011
    Posts
    12
    Rep Power
    0

    Unhappy Java Compile error?

    I have stopped production of my program long enough to compile a working version of it for my friend. It works fine enough in Eclipse, and I've got two classes. The main one reads the Conversation one. It all works fine and dandy.

    However, when I try to compile it with CMD's javac command, I get this error, it happens when i try to compile both of the .java files:

    EverythingulatorMain.java:124: cannot find symbol
    symbol : class ConversationClass
    location : class EverythingulatorMain
    ConversationClass ConvoClass = new Conversationclass();
    .................................................. ^
    EverythingulatorMain.java:124: cannot find symbol
    symbol : class ConversationClass
    location : class EverythingulatorMain
    ConversationClass ConvoClass = new Conversationclass();
    ^
    2 errors

    And, that's it, same happens with the other .java, except it replaces ConversationClass with EverythingulatorMain
    Last edited by AlleDingeAndern; 02-04-2011 at 10:35 AM.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default

    1. Have you spelt the class name correctly? ConversationClass ConvoClass = new Conversationclass(); Hmmmm.

    2. Have you imported the class?

    3. Is your class on the classpath?

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default

    If it compiles in Eclipse I'm hoping (1) is simply a typo when writing it out here (copy and paste is your friend), and (2) is unlikely...so I'll go for (3) please, Bob.

  4. #4
    Join Date
    Feb 2011
    Posts
    12
    Rep Power
    0

    Default

    (1) I have it all typed correctly in both Eclipse and the error message
    I have not imported?(2)
    and, I don't understand the third one.
    Last edited by AlleDingeAndern; 02-04-2011 at 10:33 AM.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default

    Well, for (1) this is what you wrote above:
    Java Code:
    [B]ConversationClass [/B]ConvoClass = new [B]Conversationclass[/B]();
    Java is case sensitive so ConversationClass is not the same as Conversationclass since the 'c' of 'class' is different between the two bolded names.

    For (2), if the classes are in different packages then they need to be imported.

    For (3) show use the structure of your directories and where the files are located and also what command you are using to compile your code.

  6. #6
    Join Date
    Feb 2011
    Posts
    12
    Rep Power
    0

    Default Damn

    Alright, I got the same error again. copy and paste:

    Java Code:
    [SIZE="1"]Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\Documents and Settings\Master>cd C:\Java\EclipseSDK\Workspace\ForSal\src\main
    Package
    
    C:\Java\EclipseSDK\Workspace\ForSal\src\mainPackage>javac IntroClass.java
    IntroClass.java:5: package internalGames does not exist
    import internalGames.GameMainMenu;
                        ^
    IntroClass.java:6: package internalGames does not exist
    import internalGames.GuessingGame;
                        ^
    IntroClass.java:27: cannot find symbol
    symbol  : class GameMainMenu
    location: class mainPackage.IntroClass
                    GameMainMenu GMM = new GameMainMenu();
                    ^
    IntroClass.java:27: cannot find symbol
    symbol  : class GameMainMenu
    location: class mainPackage.IntroClass
                    GameMainMenu GMM = new GameMainMenu();
                                           ^
    4 errors
    
    C:\Java\EclipseSDK\Workspace\ForSal\src\mainPackage>[/SIZE]
    I have my folders/ packages set up like this:

    \src\mainPackage, \src\internalGames

    In the main package, there's one file, that's the one I just tried to compile using javac command.

    I don't know how much code you want me to show you, but I'll copy and paste the entire thing,

    Java Code:
    [SIZE="1"]package mainPackage;
    //imports
    import java.util.Scanner;
    
    import internalGames.GameMainMenu;
    import internalGames.GuessingGame;
    
    public class IntroClass {
    
    	public static void main(String[] args) {
    		// TODO: Load Scanners
    		Scanner name = new Scanner(System.in);
    		Scanner mm = new Scanner(System.in);
    		// TODO: Load into program
    		System.out.println("Welcome to Z0rZ's corner!");
    		System.out.println("In the space below, enter your desired username.");
    		String username = name.nextLine();
    		System.out.println("That's an interesting name! Welcome, " + username);
    		System.out.println("Press enter to proceed to the main menu.");
    		String MainMenuGo2 = mm.nextLine();
    		MainMenu(username);
    	}
    
    	public static void MainMenu(String username) {
    		// TODO: Load Scanners/Variables to be used
    		Scanner Input = new Scanner(System.in);
    		GameMainMenu GMM = new GameMainMenu();
    		
    		// TODO: Run the main menu
    		System.out.println("Welcome, " +username);
    		System.out.println("Here is a list of things to do:");
    		System.out.println("typing: '1' = Games, typing '2' = ");
    		String choice = Input.nextLine();
    		
    		if(choice.equalsIgnoreCase("1")){
    			GMM.MainMenu(username);
    		}
    	}
    
    }
    [/SIZE]
    If you want me to paste the code to my other files, I will.

    Thanks, Joe.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default

    Either compile from the src directory (javac mainPackage/IntroClass.java), or compile where you are currently but give the classpath (javac -cp .;.. IntroClass.java).

Similar Threads

  1. Replies: 3
    Last Post: 11-06-2010, 12:33 PM
  2. Java compile error
    By socboy6579 in forum New To Java
    Replies: 7
    Last Post: 10-14-2010, 06:48 PM
  3. Java Compile error
    By pablo2002 in forum Java Applets
    Replies: 8
    Last Post: 09-12-2010, 02:48 AM
  4. compile error
    By angryredantz in forum New To Java
    Replies: 1
    Last Post: 01-23-2009, 10:44 PM
  5. Java 1.5 compile time error
    By ank_k in forum New To Java
    Replies: 4
    Last Post: 11-13-2008, 11:12 AM

Posting Permissions

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