12 Replies - 48645 Views - Last Post: 08 February 2009 - 05:22 PM Rate Topic: -----

#1 buniwai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 10-December 08

RuntimeException: Uncompilable source code

Posted 08 February 2009 - 03:46 PM

package gradebooktest;
import java.util.Scanner; //program uses Scanner
public class GradeBookTest { //class declaration
	
	//main method begins program execution
	// used to execute applications
	public static void main(String[] args) 
	{
	//Create a Scannerto obtain input from command window
		Scanner input = new Scanner(System.in);

		//create a GradeBook Object and assign it to myGradeBook
		GradeBook myGradeBook = new GradeBook();

		//prompt for and input course name
		System.out.println("Please Enter Course Name:");
		String nameOfCourse = input.nextLine(); //read a line of text
		System.out.println(); //outputs a blank line

		//call myGradeBook's displaymessage method
		myGradeBook.displayMessage(nameOfCourse);
		
		System.out.println("welcome to the Grade Book!");

	}//end method



This is the error I am getting:

run:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol : class GradeBook
location: class gradebooktest.GradeBookTest
at gradebooktest.GradeBookTest.main(GradeBookTest.java:17)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Could someone explain it to me?

Thanks

MOD EDIT: :code:

This post has been edited by Jayman: 08 February 2009 - 04:56 PM


Is This A Good Question/Topic? 0
  • +

Replies To: RuntimeException: Uncompilable source code

#2 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 03:51 PM

can you post the GradeBook class and also place you code between code tags
Was This Post Helpful? 0
  • +
  • -

#3 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 03:57 PM

make sure that you have the GradeBook class in the same folder as this class
Was This Post Helpful? 0
  • +
  • -

#4 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3116
  • View blog
  • Posts: 19,154
  • Joined: 14-September 07

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 03:57 PM

Is GradeBook in the same package?
Was This Post Helpful? 0
  • +
  • -

#5 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 03:57 PM

the error seems to point to the fact that it cannot find the GradeBook class, is it in the same folder? Which compiler are you using?
Was This Post Helpful? 0
  • +
  • -

#6 buniwai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 10-December 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 04:10 PM

[quote name='buniwai' date='8 Feb, 2009 - 02:46 PM' post='536763']

This is the GradeBookTest.Java code
package gradebooktest;
import java.util.Scanner; //program uses Scanner
public class GradeBookTest { //class declaration
	
	//main method begins program execution
	// used to execute applications
	public static void main(String[] args) 
	{
	//Create a Scannerto obtain input from command window
		Scanner input = new Scanner(System.in);

		//create a GradeBook Object and assign it to myGradeBook
		GradeBook myGradeBook = new GradeBook();

		//prompt for and input course name
		System.out.println("Please Enter Course Name:");
		String nameOfCourse = input.nextLine(); //read a line of text
		System.out.println(); //outputs a blank line

		//call myGradeBook's displaymessage method
		myGradeBook.displayMessage(nameOfCourse);
		
		System.out.println("welcome to the Grade Book!");

	}//end method



This is the error I am getting:

run:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol : class GradeBook
location: class gradebooktest.GradeBookTest
at gradebooktest.GradeBookTest.main(GradeBookTest.java:17)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

The Code for the GradeBook.Java
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gradebook;

public class GradeBook {

   //display a welcome message to the GradeBook user
	public void displayMessage(String courseName)
	{
		System.out.printf("Welcome to the grade book for\n%s!\n", courseName);
	}//end displayMessage

}//end class GradeBook


Now I have lost my classes also <no main classes found> when I click on both

Thanks for the heads up on the code tabs much easier to read
Was This Post Helpful? 0
  • +
  • -

#7 prajayshetty  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 920
  • Joined: 27-April 07

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 04:15 PM

i guess your classes might not be in a same folder it doesnt look any error in your code better use a free ides like netbeans or eclipse it will be lot better

This post has been edited by prajayshetty: 08 February 2009 - 04:16 PM

Was This Post Helpful? 0
  • +
  • -

#8 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 04:16 PM

probably you dont have both classes saved in the same folder, make sure that they both exist in the same folder, then try to compile the GradeBookTest and run it
Was This Post Helpful? 0
  • +
  • -

#9 buniwai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 10-December 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 04:19 PM

View Postmostyfriedman, on 8 Feb, 2009 - 03:16 PM, said:

probably you dont have both classes saved in the same folder, make sure that they both exist in the same folder, then try to compile the GradeBookTest and run it


Thanks Guys that is the issue they are in 2 seperate application. This book can get so confusing.

Until next chapter :D

Buni
Was This Post Helpful? 0
  • +
  • -

#10 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 04:22 PM

which book are you using?
Was This Post Helpful? 0
  • +
  • -

#11 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 04:56 PM

Modified title to be more descriptive of the problem.
Was This Post Helpful? 0
  • +
  • -

#12 buniwai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 10-December 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 05:13 PM

View Postmostyfriedman, on 8 Feb, 2009 - 03:22 PM, said:

which book are you using?


Java: How to Program , Sixth edition by H.M Deitel and PJ Deitel. Published by Prentice Hall, copyright 2005 by Pearson
Was This Post Helpful? 0
  • +
  • -

#13 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: RuntimeException: Uncompilable source code

Posted 08 February 2009 - 05:22 PM

you should be fine with this book, i really like this book..its the best i have found so far..
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1