File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Package compilation - urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package compilation - urgent" Watch "Package compilation - urgent" New topic

Package compilation - urgent

saquib nisar

Joined: Nov 13, 2000
Posts: 14
I have the following setup:
Directory c:\project1 containing my Java sources
java source files with package com.caluk.utils as the first line.
When these compile they (i.e. the class files) get written to directory c:\project1\com\caluk\utils (using JCreator)
However, if I do a compile of a java source file which imports one of these files (using import com.caluk.utils.*), I get the following errors:
1) If I add c:\project1\com\caluk\utils to my classpath I get a bad class file error
2) Without changing the classpath I do get errors indicating that the class files cannot be found.
What am I doing wrong? Do I need to change the classpath, or should it just work?
Saquib Nisar

Joined: Nov 14, 2000
Posts: 12
You need to put your java source file and the package in the same directory level. You dont have to edit the path for this to work. Just include the source file and the package in the same level.
I agree. Here's the link:
subject: Package compilation - urgent
It's not a secret anymore!