Compiling Package


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Compiling Package

Hybrid View

  1. #1
    signor Guest

    Compiling Package


    I got a source file SampleClass.java but I want to creat
    ABC package

    here is my script:
    ======

    package jpb;
    import java.io.*;


    public class SampleClass{
    }
    ==========
    when I compile with
    javac -d ABC SampleClass.java

    I got these message:

    The ABC directory does not exist.
    Usage: javac <options> <source files>

    How come it won't creat ABC dir

    Can any one help me to compile this

  2. #2
    mike m Guest

    Re: Compiling Package


    "signor" <sizhnor_rhena@consultant.com> wrote:
    >
    >I got a source file SampleClass.java but I want to creat
    >ABC package
    >
    >here is my script:
    >======
    >
    >package jpb;
    >import java.io.*;
    >
    >
    > public class SampleClass{
    > }
    >==========
    >when I compile with
    >javac -d ABC SampleClass.java
    >
    >I got these message:
    >
    >The ABC directory does not exist.
    >Usage: javac <options> <source files>
    >
    >How come it won't creat ABC dir
    >
    >Can any one help me to compile this


    From your code segment, you defined your package to be 'jpb' therefore you
    should have a directory structure as follows:

    d:\JavaPrj\jpb\<added java files in this directory>

    Now compile:
    1. Change directory back up the tree to the node just above jpb, so in this
    case JavaPrj.
    2. javac jpb.SampleClass.java

    If you want to use ABC as your package then you need to change the directory
    structure & the package declaration in the java file to match up.

    Cheers,
    Mike


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center