5

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

3
  • have you tried javac -d classes -sourcepath src src/sign/*.java?
    – deanosaur
    Mar 20, 2014 at 22:57
  • why classes? i want to place the compiled files in bin and not in classes.
    – RuuddR
    Mar 20, 2014 at 23:00
  • javac -d bin -sourcepath src src/sign/*.java
    – deanosaur
    Mar 20, 2014 at 23:12

2 Answers 2

2

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
1
  • That works but i want it in the main directory that's handier.
    – RuuddR
    Mar 20, 2014 at 23:12
2

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.

2
  • You are already putting the path on the java files manually, so just remove the -sourcepath option and it should work
    – azurefrog
    Mar 20, 2014 at 23:41
  • Ok, and how should my code get when i do use -sourcepath? that's so i know when to use it and when not ok?
    – RuuddR
    Mar 21, 2014 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.