File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Package and Classpath

 
Prashant Neginahal
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everbody,
I have some problem with package and class path.It goes like this ,
I have two .java files in d:\java\ folder.
First file is Complex.java.
-----------------------------------------
package com.prashant.Hello;
public class Complex
{
public Complex()
{
System.out.println("From com.prashant.Complex class");
}
}
--------------------------------------------
Second file is Simple.java.
--------------------------------------------
package com.prashant.Hello;
public class Simple
{
public Simple()
{
System.out.println("From com.prashant.Simple class");
}
}
--------------------------------------------
Ok , these two files i am using in another source file located in e:\java\ folder as below,
import com.prashant.Hello.*;
class Testing
{
public static void main(String a[])
{
Complex objComplex=new Complex();
Simple objSimple=new Simple();

}
}
Before that i set class path as CLASSPATH=.;d:\java;
But once i compile Testing.java, it is giving error as
Testing.java:6: cannot resolve symbol
symbol : constructor Complex ()
location: class Complex
Complex objComplex=new Complex();
^
Testing.java:7: cannot resolve symbol
symbol : constructor Simple ()
location: class Simple
Simple objSimple=new Simple();
^
2 errors

It works perfectily if i place Testing.java in some pavkage.
Hope somebody will help me.
Thanks
Prashant
 
Nayanjyoti Talukdar
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If u have those 2 files under folder called folder..then u have to set the classpath for d:\java\folder. Under that, u should have the required package structure.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic