Results 1 to 2 of 2
  1. #1
    Swamynathan is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Trouble WIth Packages


    I am new to Java and am using a Eclipse compiler.I learning how to make new packages in Java(Herbert) and tried to create one . it goes like this

    Java Code:
    package MyPkg1;
    class Balance{
    	String name;
    	double balance;
    	Balance(String n, double b){
            	name = n;
    		balance = b;}
    	void show(){
    		if (balance <=0)
    			System.out.println("Balance NIL");
    		System.out.println("Mr." + name + ", the balance n your acount is Rs." +balance);}
    class PackgeDemo {
    public static void main(String args[]){
    	Balance newbalance = new Balance("hari", 998.22);
    The compler is showing the following error

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    at PackgeDemo.main(

    i created a CLASSPATH in the Env. variables with the following address


    Please Help
    Last edited by Norm; 09-14-2011 at 02:28 PM. Reason: added code tags

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Trouble WIth Packages

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    at PackgeDemo.main(
    What is the statement at line 25?
    Can you compile the program with the javac program and get the compiler error? Your IDE is NOT showing what the error is.
    Here is what a normal javac error looks like:
    Java Code: cannot find symbol
    symbol  : variable var
    location: class TestSorts
             var = 2;

Similar Threads

  1. How to use my own packages?
    By Vardiane in forum New To Java
    Replies: 4
    Last Post: 04-22-2011, 05:53 AM
  2. Packages
    By urbim in forum Eclipse
    Replies: 2
    Last Post: 07-02-2009, 03:01 PM
  3. Replies: 3
    Last Post: 02-12-2008, 12:03 PM
  4. Using packages
    By prfalco in forum New To Java
    Replies: 5
    Last Post: 01-31-2008, 11:38 PM

Tags for this Thread

Posting Permissions

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