bcj [ options ] {file.java}
bcj compiles the selected .java file and any of its imported files that do not have .class files. bcj compiles the specified .java file, whether or not its .class file is outdated. (An "outdated" .class file is one that was not generated by compiling the current version of its .java source file.) bcj also compiles any directly imported .java files that do not have .class files. Imported .java files that already have .class files will not be recompiled, even if their .class files are outdated; after using the Compile command, some imported classes might still have outdated .class files.
bcj does not check dependencies between files.
To see the syntax and list of options at the command line, enter the bcj
command with no arguments.
You might need to run setvars.bat to set the environment variables for the command line, so the required classes are found.
See also:
Getting Started card: Command-line compiler options
User's Guide: Compiling Java Programs: Smart Dependencies Checking
User's Guide: Compiling Java Programs: Compiling from the command line
User's Guide: Command-line tools: Setting environment variables for command-line tools
User's Guide online: bmj command-line compiler
Options
For example:
If no CLASSPATH is defined, the default classpath is:bcj -classpath c:\testclasses\test3;c:\mydir;c:\jbuilder\myclasses foo.java
%JAVAHOME%\classes;%JAVAHOME%\lib\classes.zip
If JAVAHOME is not defined, the default classpath is:
\java\classes;\java\lib\classes.zip
For example:
causes the class files for the classes defined in thebcj -d c:\jbuilder\myclasses foo.java
foo.java
source file to be saved in the directory c:\jbuilder\myclasses\test\test3 directory, assuming that foo.java contains the following package statement: test.test3
Files are read from the class path and written to the destination directory. The destination directory can be part of the class path. The default destination matches the package structure in the source files and starts from the root directory of the source.
For example, doing:
Compiles foo.java and any directly imported .java files that do not have .class files. Characters in all source files are interpreted as the PC and Windows character set for Japanese.bcj -encoding SJIS foo.java
Obfuscation makes your programs less vulnerable to reverse engineering. After decompiling your obfuscated code, the generated source code contains altered symbol names for private symbols.