Class Javacw

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--Javacw
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Javacw
extends java.awt.Frame

This wrapper makes it possible to compile java programs on platforms that don't have a command line, but a java runtime.
On systems with a command line it can be used as GUI, but this wrapper was intentionally written for running on Compaqs iPAQ, so the graphics are optimized to display correct on this system (240 x 320).
When the wrapper is started you'll see a MenuBar where ever it's displayed by your system, some Buttons at top of the Frame for quick access to some functions, a TextArea for the system output in the center of the screen and a status bar at the bottom of the Frame which provides information about what's going on.

The MenuBar:

File
 -New: Removes all files from the compiler
 -Open Project: Opens an existing Javac Wrapper Project (.jwp)
 -Save Project: Saves the current project
 -Save Project as ...: Allows you to save the current project into another file
 -Add File: Opens a FLMFileDialog where you can select the file that should be added to the compiler.
 -Add Directory: Opens a FLMFileDialog where you can select a file or directory that should be added to the compiler.
If you choose a file, this file will be added as first file to the compiler and after that all other .java-files will be added to the compiler
If you choose a directory all .java-files from this directory will be added to the compiler. The first file to be added is the first .java-file in the directory.
 -Remove file(s): Opens a Dialog where you can choose the files to be removed from the compiler.
 -Compile: Calls sun.tools.javac.Main.compile(String[]) with all added files and the options selected in the options menu
 -Exit
   
Options
 -Compiler Options: Opens a Dialog where you can select the options that should be used when the files are compiled
 -Run Options: Opens a Dialog where you can select the options that should be used when the compiled application is started

The Compiler Options:
 -g: Generate all debugging info
 -O: Optimize; may hinder debugging or enlarge class file
 -nowarn: Generate no warnings
 -verbose: Output messages about what the compiler is doing
 -deprecation: Output source locations where deprecated APIs are used
 -classpath <path>: Specify where to find user class files
 -Autobuild classpath: If this option is enabled, the paths of the added files will be added to the classpath automatically
 -d <directory>: Specify where to place generated class files
 -depend: Recompilation of class files on which the source files given as arguments recursively depend
 -J<javaoption>: Passes through the string javaoption as a single argument to the Java interpreter which runs the compiler. The argument should not contain spaces. Multiple argument words must all begin with the prefix -J, to the first argument -J is added automatically

The Run Options:
 -Allow run by invoke: If this is enabled, the runButton will be enabled although the System doesn't support the Runtime.exec() command.
In this case, the application is started by invoking it's main method from within the wrapper. This sounds easy, but it causes some substantial problems which should be solved in this release, but I can't guarantee that there're no bugs. One still existing problem is that if your compiled application calls System.exit(int) it will cause the wrapper to close too. This problem is solved for Java 1.2, so if you want to run the wrapper with a Java 1.2 runtime take the sources, remove the comments in SecurityManager part in Javacw.java and recompile it.
(For iPAQ Users: The JVM for the iPAQ has a bug which causes the JVM to crash, whenever you hide a frame that was created from your application.)
 -Autobuild classpath: If this option is enabled, the paths of the added files will be added to the classpath automatically. This may cause some problems if you are trying to run a class which is part of a package
 -classpath <path>: Specify where to find user class files
 -Class name to run: Enter a class file which should be executed when the runButton is pressed

The Buttons:
 -Add File...: Opens a FileDialog where you can select the file that should be added to the compiler.
 -Compile: Calls sun.tools.javac.main with all added files and the options selected in the Options menu
 -Run: Tries to run the compiled class if it is an application with a main method
 -New: Removes all files from the compiler

Note! The wrapper uses the java compiler found in the package sun.tools.javac which is not supported by Sun.
In newer releases (and some older ones) of the JDK sun.tools.javac.Main will be removed, so you have to make sure that it is present somewhere else on the system and that the wrapper has access to it.

Author:
FReAK La Marsch, Yani Ioannou
See Also:
Serialized Form

Nested Class Summary
(package private)  class Javacw.CompilerSecurityManager
          SecurityManager for this application.
(package private)  class Javacw.ExitSecurityException
           
(package private)  class Javacw.FailSecurityException
           
(package private)  class Javacw.SuccessSecurityException
           
(package private)  class Javacw.WaitForThread
          Thread that waits for another thread to die and calls appCleanup() when the thread is dead
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  boolean dontSave
           
(package private)  boolean overwrite
           
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Javacw()
          The default constructor method
Javacw(java.lang.String project)
          Another constructor method
Javacw(java.lang.String[] fileNames)
           
 
Method Summary
 void appCleanup()
          Is called to finish an application that has been run by the runButton
protected  java.util.Properties getAppConfig()
          Returns appConfig
protected  FLMResizableArray getSourceFiles()
          Returns sourceFiles
static void main(java.lang.String[] args)
          Main method of this application
protected  void saveProject(java.lang.String type)
           
protected  void setAppConfig(java.util.Properties p)
          Sets appConfig
 void setCOptionsArray(java.lang.String[] array)
          sets the cOptionsArray
 void setROptionsArray(java.lang.String[] array)
          sets the rOptionsArray
protected  void setSourceFiles(FLMResizableArray v)
          Sets the sourceFiles
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

overwrite

boolean overwrite

dontSave

boolean dontSave
Constructor Detail

Javacw

public Javacw()
The default constructor method


Javacw

public Javacw(java.lang.String project)
Another constructor method


Javacw

public Javacw(java.lang.String[] fileNames)
Method Detail

main

public static void main(java.lang.String[] args)
Main method of this application


getAppConfig

protected java.util.Properties getAppConfig()
Returns appConfig


setAppConfig

protected void setAppConfig(java.util.Properties p)
Sets appConfig


saveProject

protected void saveProject(java.lang.String type)
                    throws java.io.FileNotFoundException,
                           java.io.IOException
java.io.FileNotFoundException
java.io.IOException

setCOptionsArray

public void setCOptionsArray(java.lang.String[] array)
sets the cOptionsArray

Parameters:
array - the new cOptionsArray

setROptionsArray

public void setROptionsArray(java.lang.String[] array)
sets the rOptionsArray

Parameters:
array - the new cOptionsArray

appCleanup

public void appCleanup()
Is called to finish an application that has been run by the runButton


setSourceFiles

protected void setSourceFiles(FLMResizableArray v)
Sets the sourceFiles

Parameters:
v - the new sourceFiles FLMResizableArray

getSourceFiles

protected FLMResizableArray getSourceFiles()
Returns sourceFiles