File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Packages 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 » Java in General
Bookmark "Packages" Watch "Packages" New topic


deepikakasi kasi

Joined: Oct 08, 2006
Posts: 7

I have a doubt like how to run & compile a package source code.

As creating a new folder named package & under that source file is stored.

If I compile that, it is displaying as System cann't find that file.

How to run & compile that package ??

with regards,
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3640
Deepika, if you are new to Java, then please read this section- it will help you to understand the concept of package.
[ October 17, 2006: Message edited by: Chetan Parekh ]

My blood is tested +ve for Java.
GS Chidam
Ranch Hand

Joined: Jul 07, 2006
Posts: 34

refer this url

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

When you use pacakges, you are esseintally telling the complier that you are going to be placing and organizeing your code into sub-directories. A package is really nothing more than a directory on the filesystem. However, since Java is cross platform, you can't really use a normal directory notation, as Linux slashes are different from PC DOS slashes. So, Java uses a dot notation, and coins the cute little term 'package'

Getting packaged code to compile can definitely be annoyting. I put together a short multimedia tutorial that shows you exactly where a java source file should go when you want to package compile it, and how to run the source code generated by the compilation:

Using Packages with the JDK

JDK Tutorials for Compiling Packaged Code - Even Some Classpath Switches in there Too!!!

Working with the SDK is important, but eventually, you'll want to move to an IDE like Eclipse or use NetBeans or something.


-Cameron McKenzie
deepikakasi kasi

Joined: Oct 08, 2006
Posts: 7
Thanks for the immediate reply..

thanks & regards,
I agree. Here's the link:
subject: Packages
It's not a secret anymore!