Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Kenneth Bennett   on Aug 18 In Java Category.

  
Question Answered By: Keith Marshall   on Aug 18

with reference to my perivoius mail:

i added the CLASSPATH, the problem  is still not solved this time the error  is:

------------------------------------------------
E:\jdk1.4\bin\JWork\Dinner.java:14: cannot access Dessert
bad class file: E:\JDK1.4\bin\JWork\myPackages\Dessert.class
class file  contains wrong class: mypackages.Dessert
Please remove or make sure it appears in the correct
subdirectory of the classpath.
Dessert x = new Dessert();
^
1 error

Tool completed with exit code 1
------------------------------------------------
and here is the code
------------------------------------------------
//Placed in E:\JDK1.4\bin\JWork\myPackages
//: Dessert.Java
//Creates a library
package mypackages;

public class Dessert
{
public Dessert()
{
System.out.println("Dessert constructor");
}

void foo()
{
System.out.println("foo");
}
}
------------------------------------------------
//Placed in E:\JDK1.4\bin\JWork
//: Dinner.java
//Uses the my own library
import myPackages.Dessert;

public class Dinner
{
public void Dinner()
{
System.out.println("Dinner constructor");
}

public static void main (String[] args)
{
Dessert x = new Dessert();
}
}
------------------------------------------------
and here is the classpath
E:\JDK1.4\bin\JWork;E:\JDK1.4\bin\JWork\myPackages
------------------------------------------------
i will be greatfull to u in helping to solve my problem

Share: