Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need help making a package  RSS feed

 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use two different .java files, but I don't know how to link them. The text talks about making packages, but I didn't understand it. Can someone explain it in simple terms?
[ February 12, 2006: Message edited by: Jesse Crockett ]
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my class Exchange, when placing the line "package lab08package;" at the top, will not let me compile until re-saving the file. Is the name of the package the name of the directory with all the .java files? Also I don't understand what to do about my classpath setting, if I should change it?
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to save each class using the line "package Lab08package;" as Lab08package is the directory containing the .java files, but now the compiler tells me that for class Money "no such package exists". What is going on?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Packages can be a bit frustrating until you get all the details sorted out.

This chapter from Eckel's Thinking in Java does a pretty good job at laying it all out. See if that helps.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This covers some of the same material in a brief tutorial form. it has a link to a zip file with example source.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!