Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile a class with the pachage statement

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Could you please tell, how to compile a class with a package statement. I mean the class should go to the perticular directory.
Thanks
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the javac documentation note that the -d option specifies that compiled classes are to be placed in the directory specified after the -d switch. Also note it says that "[i]f a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed."
Another thing to note is that if you're working from a command prompt and you'd like the package directories to be created in the current working directory, the easy thing to do is to just use a period "." following the -d switch. The period specifies that the current working directory is to be used.
 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thank you very much,,,,,,,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic