Ads Sponsored By Google :)

Thursday, 24 January 2013

what|is|meaning how to compile|compilation a package in java from command prompt|line|of with example


how to compile a package in java how to compile a package in java from command prompt how to compile a package in java with example how to compile a package progam in java compile a package in java command line compile package in java compile package in java in command prompt how we compile package in java command to compile package in java command to compile a package in java compilation of java package compilation of package in java command for compiling package in java what is the meaning of java package compilation command

Command For compilation of a package:

       Javac –d . filename.java

         Description Of package compilation command :

          1)      –d is an option / switch which gives an indication to the JVM in such way that go to a   
                 filename.java, take package name and create as a directoryprovided the folloeing             
                conditions must be satisfied.
a)      No errors presents in the filename.java.
b)      Earlier the package name should not be created as directory (if it is already created then the created directory will be considered without recreating it.
             This directory created as current directory and it will be referred by .(dot).
        2)      “filename.java” program will be compiled and generated filename.class.
        3)       Dot(.) refers current directory. Because of dot(.) currently generated dot(.) class file is  
                automatically copied into currently created directory.

   Eg : java –d . Demo.java

// Create a package JavaJavax and place class called Demo
   Package JavaJavax1;
 Public class Demo
{
   Public Demo()
 {
  System.out.println(“user defined package”);
  }
Public void display()
{
System.out.println(“user defined display method”);
}
}
Package pack1;
Public interface Test
{
   Public  void show();
}

Compiling package classes and interface by using command.
For Compiling package classes and interfaces, we use the following
      Eg : java –d . Demo.java

Ensure the package “JavaJavax” must be created as directory, Demo.java program must be compiled, Demo.class must be generated and it should be automatically copied into JavaJavax package. 





No comments:

Post a Comment

LinkWithin