All About Class Compiler In Java

0
139
Spread the love
  • 28
  • 34
  • 28
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    137
    Shares

Class Compiler In Java
Class Compiler In Java

The class compiler provides support to java to native code compilers and related services.

When JVM starts ,it determines if a system property in java exists.

If so , it is assumed to be the name of library(Whose exact location and type is platform dependent) .

The loadLibrary() method in class-System is called to load the library. If the library loading is successful, the function name java.lang.Compiler.start() on the library is called. In case there is no compiler, these methods do nothing.

Normally, the javac command compiles only the file that you specify on the command line, but you can coax javac into compiling more than one file at a time by using any of the following techniques:

  • If the Java file you specify on the command line contains a reference to another Java class that’s defined by a java file in the same folder, the Java compiler automatically compiles that class, too.

  • You can list more than one filename in the javac command. The following command compiles three files

  • If you need to compile a lot of files at the same time but don’t want to use a wildcard
  • (perhaps you want to compile a large number of files but not all the files in a folder),
  • you can create an argument file, which lists the files to compile.
  • In the argument file, you can type as many filenames as you want, using spaces or line breaks to separate them. Here’s an argument file named TestPrograms that lists three files to compile:
  • You can compile all the programs in this file by using an @ character, followed by the name of the argument file on the javac command line.

The structure of class Compiler is given as:


public final class java.lang.Compiler extends java.lang.Object{
//methods:
public static Object command(Object obj);
public static boolean compileClass(Class aclass);
public static boolean compileClassES(String classes);
public static void disable();
public static void enable();
}
 
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 28
  • 34
  • 28
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    137
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here