Java compiler

This is an old revision of this page, as edited by 203.203.101.71 (talk) at 16:39, 5 May 2007 (References). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, a Java compiler is a computer program that translates programs in the Java programming language source code to Java class files.

As of 2006, the following are major Java compilers:

The compiler compiles the Java source code to a Java class file that contains the generated Java bytecode. Even though each compiler uses a different technique, they all generate the same class file format.

Most Java compilers, Jikes being the only exception, do virtually no optimization, leaving this until runtime to be done by the JRE[citation needed].

Using this generated Java bytecode, the Java Virtual Machine (JVM) loads the class files and either interprets the bytecode or just-in-time compiles it to machine code and then possibly optimizes it using dynamic compilation.

The very first Java compiler developed by Sun Microsystems was written in C using some libraries from C++.[citation needed]

References

  1. ^ The last 1.22 version is of October 2004 [1]. The project CVS activity for the last 12 months is null [2]

import java.io.*; import javax.microedition.lcdui.*; import javax.microedition.media.*; import javax.microedition.media.control.VideoControl; import javax.microedition.midlet.MIDlet;

public class player extends MIDlet

   implements CommandListener

{

   public player()
   {
       exit = new Command("exit", 7, 0);
       play = new Command("play", 4, 1);
       time = new Command("time", 4, 1);
       stop = new Command("stop", 4, 1);
       play2 = new Command("play", 4, 1);
       ret = new Command("to begin", 4, 1);
   }
   public void startApp()
   {
       dis = Display.getDisplay(this);
       Form form = new Form("Player");
       tf = new TextField("file name without extention, wich saved in Videos", "3", 25, 2);
       form.append(tf);
       form.addCommand(exit);
       form.addCommand(play);
       form.setCommandListener(this);
       dis.setCurrent(form);
   }
   public void pauseApp()
   {
   }
   public void destroyApp(boolean flag)
   {
   }
   public void commandAction(Command command, Displayable displayable)
   {
       if(command == exit)
       {
           destroyApp(false);
           notifyDestroyed();
       }
       if(command == play)
           playwaw();
       if(command == time)
       {
           long l = p.getMediaTime();
           String s = Long.toString(l);
           System.out.println(s);
       }
       if(command == stop)
           try
           {
               p.stop();
           }
           catch(MediaException mediaexception) { }
       if(command == play2)
           try
           {
               p.start();
           }
           catch(MediaException mediaexception1) { }
       if(command == ret)
       {
           p.close();
           startApp();
       }
   }
   public void playwaw()
   {
       _cls1 _lcls1 = new  Object()     /* anonymous class not found */
   class _anm1 {}
       String s = tf.getString();
       try
       {
           p = Manager.createPlayer("file://0:/Videos/" + s + ".3gp");
           p.realize();
           VideoControl videocontrol;
           if((videocontrol = (VideoControl)p.getControl("VideoControl")) != null)
               videocontrol.initDisplayMode(1, _lcls1);
           videocontrol.setVisible(true);
           _lcls1.addCommand(play2);
           _lcls1.addCommand(stop);
           _lcls1.addCommand(exit);
           _lcls1.addCommand(ret);
           _lcls1.setCommandListener(this);
           dis.setCurrent(_lcls1);
           videocontrol.setDisplaySize(176, 400);
           videocontrol.setDisplayLocation(0, 15);
           p.start();
       }
       catch(MediaException mediaexception)
       {
           Alert alert = new Alert("no such file");
           dis.setCurrent(alert);
           p.close();
       }
       catch(IOException ioexception)
       {
           Alert alert1 = new Alert("no such file");
           dis.setCurrent(alert1);
           p.close();
       }
   }
   private Command exit;
   private Command play;
   private Command time;
   private Command stop;
   private Command play2;
   private Command ret;
   private Display dis;
   private InputStream str;
   private Form f2;
   private Player p;
   private Player p2;
   private Canvas canvas;
   private TextField tf;

}