• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to import my package?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basit bir şekilde toplama yapan bir class olsun.Paketi ise tr.edu.iu.math.
There is a simple class which adds two double number.This class's package is tr.edu.iu.math
The class like this :
package tr.edu.iu.math ;
public class addDouble
{
public static double add (double a, double b)
{
return (a + b) ;
}
}
I compile addDouble.java and addDouble.class created under tr\edu\iu\math.No problem.

On the other hand I have Calculate.java which imports tr.edu.iu.math.Its code like this :

import tr.edu.iu.math.*;
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 Calculate.java from concole it returns an error : "package tr.edu.iu.math does not exist "

What can i do ?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.
 
ebru aloglu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank u for your advice i solved my problem
it was about classpath as you said.
 
reply
    Bookmark Topic Watch Topic
  • New Topic