Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

packages

 
Saraswathi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we create packages of our own, where is it supposed to stored and accessed?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, anywhere you want it. I am not sure in what context you are asking. Packages for Applications are usually stored in some ROOT file structure of that application and then it's package subdirectories. Most people developing java apps will have a lib folder where they will put JAR files (which are just zipped packages).
In web apps, it just depends on if you are talking about Servlets that are in a package structure, or other helper classes you have written.
As long as they are accessable by the application (via the classpath) they can go anywhere. But there is typically a norm on where to put them.
If you could be a bit clearer on what you mean by your question, it might be easier to give you an explination.
[ September 15, 2003: Message edited by: Gregg Bolinger ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On an aside, we have a naming policy here at Javaranch that states we don't allow obvious fictitous names. Please adjust your display name to meet our guidelines. You can change your display name here
Thanks a lot and welcome to Javaranch.
Also, who is this Indain Godess Kali? I would be interested in knowing who you hold in such high regards.
[ September 15, 2003: Message edited by: Gregg Bolinger ]
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you create a package you can access that package by putting in in your CLASSPATH at runtime. For example lets say you created a package named com.domain.myapp. You created your directory structure com -> domain -> myapp -> class files and compiled and created a jar file named myapp.jar. If you wanted to use that package in another application you were writing you could simple include it in your class path like this: java -classpath myapp.jar. I hope this helps.
 
Gayathri Prasad
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Suppose I am creating a package called packA in Top Folder.In packA I have another folder called gaya3 and in it I store my Java files.
packA.gaya3->First.java (First pprog in the package)
packA.gaya3->Sec.java
I need to set the class path to Top (Folder immediately above packA) and in my java progs (First and Sec), the first line should be
package packA.gaya3;
they should be compiled from Top folder as
javac packA/gaya3/First.java
Cheers,
Gaya3
---------------------------
Prasanna Kumar R.V
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Saraswathi!
You might want to take a look at The Creating and Using Packages Lesson of Sun's Java Tutorial.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic