i have a java application done in netbeans, and it has a package called my.alarm and it has an interface class called AlarmListener.java, an GUI class called AlarmGUI.java and a another class called Alarm.java which has all the methods implemented. so i would like to compile this package in command line instead of using netbeans. How do i do that ? the class paths were set and jdk was properly installed.
Asked
Active
Viewed 1,017 times
2 Answers
0
In Cmd line issue the following command
javac -d . *.java
make sure javac is in your path.

laksys
- 3,228
- 4
- 27
- 38
-
javac -d . *.java is not recognized i suppose, says :- javac: file not found: *.java – Sugar Jan 01 '15 at 08:12
0
Since all your classes and dependencies resides in your only package, You could use something from your package directory like:
javac *.java
You could check the usage of javac (java compiler) and use as per your need further in addition to above:
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-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 and annotation processors
-cp <path> Specify where to find user class files and annotation processors
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced 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
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system

SMA
- 36,381
- 8
- 49
- 73