Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javac fails to find symbol when wildcard is used, but works when .java file is manually specified

Tags:

java

javac

When I compile with this compiler code:

@echo off
javac -d bin -sourcepath src/*.java src/sign/*.java src/Alert.java
pause

I don't get any errors. but when i compiler with this code

@echo off
javac -d bin -sourcepath src/*.java src/sign/*.java
pause

I do get errors Compiler errors

the alert.java is the first file

Alert.java

like image 582
RuuddR Avatar asked Oct 01 '22 06:10

RuuddR


2 Answers

Have you tried this one

Navigate to src directory  
javac -d ../bin *.java sign/*.java

All the required jars and dependencies must be set in class path before compilation or you can use -classpath option while compiling.

--EDIT--

Try this one without -sourcepath option

javac -d bin src/*.java src/sign/*.java
like image 94
Braj Avatar answered Oct 05 '22 12:10

Braj


The -sourcepath option expects a path, and you aren't giving it one.

When you do this

javac -d bin -sourcepath src/*.java src/sign/*.java

You are only picking up the files in src/sign/, since src/*.java is being evaluated as the source path.

like image 32
azurefrog Avatar answered Oct 05 '22 12:10

azurefrog