Reputation: 391
I am trying to compile a java project from the command line using javac but I am getting no output on the command line. Also, the .class files are not being generated.
The exact syntax I am using to invoke the javac command is below:
javac @options @javaFiles
The contents of the options file is below:
-g
-verbose
-d classes
-classpath cp1;cp2;cp3
where cp1, 2, 3 etc refer to jar files on my machine. The javaFiles file has a list of java files that I wish to compile:
C:\path\to\dir\one.java
C:\path\to\dir\two.java
The problem is that there is no output on the command line (If I miss-spell one of the command line switches then there is error output on the command line) and no .class files are generated in the classes folder. Also, if I add the '-Xstdout output.txt' switch to the options files and try and compile. The javac command, exits and the output.txt fiel is created but there is no information in the file.
My question, is: Am I using the wrong syntax to invoke javac and how should I change this?
EDIT:
I changed the options and javaFiles files as mentioned in Jasper's answer, but am getting the below error now:
*__* javac @options @javaFiles
javac: file not found: com\compname\cloud\automation\portal\definitions\landing\LandingPage.java
Usage:javac <options> <source files>
use -help for a list of possible options
EDIT 2:
Ok, this issue was with one of the jars on the classpath. When that jar was removed (pain in the a$$ removing each jar at a time) everything compiles correctly and the .class files are created.
I'm still not sure why javac fails silently when this jar is on the classpath, even with the verbose switch being used.
For the moment, I can get around not using this jar. I appreciate the help people have provided...
Upvotes: 3
Views: 6175
Reputation: 2687
I just ran into the same problem, and it seems related to signed vs. unsigned third-party jar files:
Hope this helps, .Andrea
Upvotes: 0
Reputation: 206816
In the second file, instead of using full pathnames, use only the pathnames from the base directory of the package. Suppose your code is in a package org.mypackage
, and your source files are in the directory C:\myproject\src\org\mypackage
, put this in the second file:
org\mypackage\One.java
org\mypackage\Two.java
In the first file, add a -sourcepath
option:
-sourcepath C:\myproject\src
Upvotes: 0