Compile Java program using -classpath option:javac -classpath ~/jjava/class -d ~/jjava/class TimeTest. java<cr>--This command tells the javac to compile TimeTest. java and put the resulted bytecodes in ~/jjava/class/.
You use the m command-line option to add custom information to the manifest during creation of a JAR file. This section describes the m option. The Jar tool automatically puts a default manifest with the pathname META-INF/MANIFEST. MF into any JAR file you create.
your command line is correct, but there are some considerations:
I'm assuming that the JAR file has the proper directory structure as you stated.
javac does not understand *.jar in the classpath argument. You need to explicitly specify each jar. e.g.
javac -cp ".;mina.jar" MyRtmpClient.java
In javac JDK 6 and above You could use (note lack of .jar):
javac -cp ".;*" MyRtmpClient.java
to quote javac - Java programming language compiler
As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.
For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to A.jar;b.JAR, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of * expands to a list of all the jar files in the current directory.
If you have utilities find
and tr
at your disposal (e.g. you're working Linux), you could do:
javac -cp .:`find * -name "*.jar" | tr "\n" ":"` MyRtmpClient.java
All jar files in the current directory and all it's sub-directories will be added (shell command lists all jar files and puts colons as separators between them).
find * -name "*.jar"
finds and lists all jar files in hierarchy whose root is current folder,find
to the input of next command,tr "\n" ":"
replaces all newline characters with colon characters.In your case, I think JAVAC can not found jars file.
Please try:
PROJECT_PATH
- lib\a.jar
- src\package\b.java
cd @PROJECT_PATH
javac -classpath lib\a.jar src\package\b.java
Probably below syntax will work on windows dos command
javac -cp ".;first.jar;second.jar;third.jar" MyRtmpClient.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With