It's not a secret anymore!
The moose likes Beginning Java and the fly likes How to import my package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to import my package?" Watch "How to import my package?" New topic

How to import my package?

ebru aloglu

Joined: May 23, 2005
Posts: 2
Basit bir şekilde toplama yapan bir class olsun.Paketi ise
There is a simple class which adds two double number.This class's package is
The class like this :
package ;
public class addDouble
public static double add (double a, double b)
return (a + b) ;
I compile and addDouble.class created under tr\edu\iu\math.No problem.

On the other hand I have which imports code like this :

public class Calculate{
public static void main(String args[]) {
double total = addDouble.add(9.6 , 8.7);
System.out.println("9.6 + 8.7 = " + total );
But when i tried to compile the from concole it returns an error : "package does not exist "

What can i do ?

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189


Welcome to JavaRanch!

This is a problem with your "classpath". The compiler needs to be able to find your compiled class files. The most likely problem is that your classpath does not include an entry "." (dot), to represent the current directory. You'll need to either unset the CLASSPATH environment variable altogether (generally preferred!) or add a "." entry. See for details and platform-specific instructions on doing this.

[Jess in Action][AskingGoodQuestions]
ebru aloglu

Joined: May 23, 2005
Posts: 2
Thank u for your advice i solved my problem
it was about classpath as you said.
I agree. Here's the link:
subject: How to import my package?
It's not a secret anymore!