• Tech Travel Hub is your one stop, ultimate tour guide to all things tech, travel, visas and digital nomads
  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact
Menu
  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact
View Blog
March 28, 2023March 28, 2023

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 the library(Whose exact location and type is platform dependent).

The Compiler class encapsulates a facility for compiling Java classes to native code. As provided by Sun, the methods of this class do not actually do anything. However, if the system property java.compiler has been defined and if the method System.loadLibrary() is able to load the library named by the property, the methods of this class use the implementations provided in the library. The Compiler class has no public constructors, so it cannot be instantiated.

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 native Object command(Object obj);
    public static native boolean compileClass(Class aclass);
    public static native boolean compileClasses(String classes);
    public static native void disable();
    public static native void enable();
    } 

    The details of the methods are as follows:

    public static native Object command(Object obj);

    public static native Object command(Object obj)method directs the compiler to perform an operation specified by the given argument. The available operations, if any, are determined by the compiler library.

    This method returns a value determined by the compiler library, or null if no compiler library is loaded.
    Parameter
    obj -The permissible value and its meaning are determined by the compiler library.

    public static native boolean compileClass(Class aclass);

    public static native boolean compileClass(Class aclass) method requests the compiler to compile the specified class to native code.

    This method returns true if the compilation succeeds, or false if the compilation fails or no compiler library is loaded.
    Parameter
    aclass-The class to be compiled to native code.

    public static native boolean compileClasses(String classes);

    public static native boolean compileClasses(String classes) method requests the compiler to compile all of the classes named in the string.
    This method returns true if the compilation succeeds or false if the compilation fails or no compiler library is
    loaded.
    Parameter
    classes-A string that specifies the names of the classes to be compiled.

    public static native void disable();

    public static native void disable() method disables the compiler if one is loaded.

    public static native void enable();

    public static native void enable() method enables the compiler if one is loaded.

  • Apart from these Compiler class also has inherited methods from class- Object. They are as follows:

    • clone()
    • finalize()
    • hashCode()
    • notifyAll()
    • wait()
    • wait(long, int)
    • equals(Object)
    • getClass()
    • notify()
    • toString()
    • wait(long)
    •  

Post navigation

Previous post
Next post

Umer Umer

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • The Core Element Of A Woocommerce Store And 5 Incredible Plugins
  • 15 Amazing Must-Have WooCommerce Plugins in 2021
  • How to Make A MP4 File Smaller Using Wondershare UniConverter – 5 Important Tips
  • Wondershare Filmii – Create Videos Easily with AI-Powered Video Editor With 4 Important Tips
  • 10 Wonderful Places in India

Categories

  • Adventure
  • Agile Methodology
  • AI
  • All world Tour
  • Android Development
  • Ansible
  • App
  • App Development
  • Artificial Intelligence
  • AWS
  • Bitcoin
  • BlockChain
  • Blogging
  • Box Packing
  • Business
  • business
  • Business Communication
  • buying guide
  • C
  • car
  • Care
  • Certification
  • Certification
  • Chatbot
  • cinema
  • Cloud Tech
  • Content Marketing
  • Corporate
  • covid-19
  • crucible
  • Cryptocurrency
  • Database
  • DevOps
  • DevOps
  • Digital Marketing
  • Drawing
  • Dress
  • Earn Money Online
  • Educational
  • Employment
  • Entertainment
  • Exceptions In Java
  • Fashion
  • Festivals
  • Finance
  • Fitness
  • Food
  • Game
  • Gift ideas
  • Graphic Designers
  • Groovy
  • Health
  • Health
  • home
  • home improvement
  • HR
  • IllegalThreadStateException in Java
  • India Tour
  • Instagram
  • Ios
  • ISO
  • Java
  • Javascript
  • job
  • Kids Section
  • Kitchen
  • Law
  • Life Style
  • Lifestyle
  • Lifestyle Home Improvement
  • Magento
  • Main Stories
  • Management
  • Mattress
  • Motorable
  • Movie
  • nursing
  • Office Productivity
  • Pendrive
  • Perspective
  • Pet
  • Popular
  • Programming
  • Python
  • RDT
  • Relationships
  • Selenium
  • SEO
  • Skin
  • SOA
  • SOAPUI
  • Social Media
  • Social Media Marketing
  • Software
  • software development
  • Software Development Model
  • Software Engineering
  • Software Testing
  • Sports
  • Startup
  • T Robot
  • TDD
  • Tech
  • Tech News
  • Tech News
  • Technology
  • Tool
  • Tour Guide
  • Tour Guide
  • Travel
  • UFT
  • Uncategorized
  • USB Cable
  • VBscript
  • VPN
  • Web Development
  • WebHosting
  • WebServices
  • Wildlife
  • Wordpress
  • Yoga
  • Youtube

Tags

Instagram Instagram Marketing Marketing SEO Thoptv App

Categories

  • Tech
  • Travel
  • Visas
  • Digital Nomad
  • Tech
  • Travel
  • Visas
  • Digital Nomad

Publishing

If you would like to publish on our site, please email admin@techtravelhub.com

Quick Links

  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact
  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact

Contact

Tech Travel Hub LLC

Address:
8 The Green STE A
Dover
Delaware, 19901

Phone: +1 302 956 9948