Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-11-2008, 05:35 AM
Member
 
Join Date: Jul 2008
Posts: 6
acp26b is on a distinguished road
Problem With Package
I have a package called Product that has 2 class files, ProductInfo and BinaryFile. Both files are located in the same directory ../Product/ and both files start with "package Product;" I can compile BinaryFile.java just fine. Inside of ProductInfo i want to use the class BinaryFile, however i get a compile error saying:

Code:
ProductInfo.java:18: cannot find symbol symbol : class BinaryFile ...
I did not think an import was needed since the files are in the same directory and in the same package, does any one have any ideas on how to fix the compile error?


Thanks,
-Adam
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-14-2008, 08:59 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,545
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
You mean BinaryFile and ProductInfo are in the same package, but can't access ProductInfo within the BinaryFile class?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-14-2008, 06:23 PM
Member
 
Join Date: Jul 2008
Posts: 6
acp26b is on a distinguished road
Yes both classes are in the same package called Product but it is the other way around. ProductInfo has BinaryFile variables in it. Each product has a preview image so for example inside of ProductInfo there is a variable: BinaryFile previewImage = new BinaryFile('/path/preview.png');
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-14-2008, 07:58 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
For the compiler to find a class, the class must be on the classpath. For a class in a package, the classpath must end where the package begins, so that the classpath + package path is the location of the class file.
For example class X in package pkg located on path: C:\javastuff\pkg\X.class would require a classpath of C:\javastuff.
If you use javac with -classpath . the . would be a classpath of C:\javastuff\pkg.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
get classes of a certain package ashraf shaban New To Java 4 07-08-2008 09:20 PM
JXL Package gaya3 Java Servlet 1 05-23-2008 11:03 AM
Package Explorer bilmeze Eclipse 0 04-04-2008 10:57 AM
Elements package BlitzA New To Java 0 12-28-2007 01:58 AM
Java Package help? Bibendum New To Java 2 12-12-2007 06:29 AM


All times are GMT +3. The time now is 11:57 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org