Java Quick Guide
 
 
This guide contains usefull Java information.

rss






Javac Command.

Information:
Usage: javac <options> <source files>

The options can be found in the below mentioned table.
Note: Based on java version 1.4.0_03

Related information:


Option Description
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-O Optimize; may hinder debugging or enlarge class file.
Eliminates optional tables in the class files, such as line numbers and local variables tables.
-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
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options


Example 1:
  1. Create the following directories:

    c:\demo
    c:\demo\com
    c:\demo\com\mobilefish


  2. Create the file c:\demo\com\mobilefish\HelloWorld.java.

    package com.mobilefish;

    public class HelloWorld {

          public static void main(String args[]) {
                System.out.println("Hello World");
          }
    }


  3. Open a dos window and type:

    cd c:\demo

  4. Compile the java code, type:

    javac ./com/mobilefish/HelloWorld.java

  5. Run your application:

    java com.mobilefish.HelloWorld

    Output: Hello World