bmj [options] rootClasses
bmj looks for dependency files on the classpath. If you specify a set of sources, some or all of those sources might not be recompiled. For example, the class files might be determined to be up to date, if they have been saved but not edited since the last compile. You can force recompilation using the -rebuild option.
To check a set (or "graph") of interdependent classes, it is sufficient to call bmj on the root class (or multiple root classes, if one is not under the other). You can specify root classes using class names, package names, names of sources that declare classes, or a combination.
To see the syntax and list of options at the command line, enter the bmj
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: bcj command-line compiler
Options
For example:
If no CLASSPATH is defined, the default classpath is:bmj -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 thebmj -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
The updated dependency file test.test3.dependency will also be saved in that directory.
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 for class files matches the package structure in the source files and starts from the root directory of the source. The default destination for dependency files matches the package structure and starts in the current directory.
For example, doing:
Does a Make and dependency checking starting with root classes declared in foo.java. Characters in all source files are interpreted as the PC and Windows character set for Japanese.bmj -encoding SJIS foo.java
With this option, a given branch of the checking process halts when it reaches a package marked "stable"; it does not look for unstable packages imported by the stable packages. Therefore, with this option, you might need to specify a greater number of modules to compile. Suppose unstable package A uses stable package B, which uses unstable package C. If you want to skip rechecking the stable package B, then you need to specify compiling package C in addition to package A; otherwise, package C will not be checked (unless A depends directly on C).
By default, bmj checks packages marked "stable" as well as packages marked "unstable", to determine whether they and their imported classes need to be recompiled. See also Selectively compiling stable packages
This option is especially useful for working with a library of classes with no source available, when some of the class files are not consistent, but not used.
See also User's Guide: Compiling Java Programs: The Make command and Stable packages.
For example:
bmj -nomakestable 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.
See also Compiling Java Programs: Types of compiling.
set
command.
If no source path is specified and if no SOURCEPATH environment variable is set, the classpath is used to find the sources.
Similar to the classpath, the sourcepath must point to the root of the package directory tree, and not directly to the directory of the sources. For example, to make foo.java
, which contains the package statement test.test3
and is located in d:\mydir\test\test3
, you must set the source path to d:\mydir
and not to d:\mydir\test\test3
. From any current directory, you can then type the following:
bmj d:\mydir\test\test3\foo.java -d d:\myclasses
{[-s] {source.java} | -p {package} | -c {class}}
For example,
is the same asbmj -s borland\samples\tutorial\dataset\CalcField.java
bmj borland\samples\tutorial\dataset\CalcField.java
If you list some packages with the -p option before listing sources, then you need to specify the -s option. If you list sources before packages and classes, the "-s" is assumed, and is not necessary.
For example, doing:
Makes all classes of the borland.samples.tutorial.dataset package, and all imported classes.bmj -p borland.samples.tutorial.dataset
For example, doing:
Makes the class CalcField of package borland.samples.tutorial.dataset and all imported classes.bmj -c borland.samples.tutorial.dataset.CalcField
As another example, doing:
Makes source file foo.java, packages package1 and package2, and all the java files in the mydir\ directory.bmj foo.java -p package1 package2 -s mydir\*.java
Note that the first source name (foo.java) comes before the -p (package) option, so does not need to explicitly specify the -s option, because "-s" is assumed. But after the -p option is specified, if you want to specify another source file name, you have to explicitly specify the -s option.