3

My makefile is below

Also, I would appreciate it if you told me how to move my .class files to ../bin/

JFLAGS = -cp
JAR = "RSBot*.jar"
JC = javac
.SUFFIXES: .java .class
.java.class:
                $(JC) $(JFLAGS) $(JAR) $*.java

CLASSES = \
                src/Banker.java \
                src/Eater.java \
                src/Fighter.java \
                src/grotgui.java \
                src/InventTab.java \
                src/Looter.java \
                src/Potter.java \
                src/W8babyGrotworm.java \
                src/Walker.java

default: classes

classes: $(CLASSES:.java=.class)

clean:
                $(RM) *.class
  • Similar question here: http://stackoverflow.com/questions/1064481/newbie-question-how-to-include-jar-files-when-compiling – Girish Rao Jun 11 '12 at 23:08

2 Answers2

2

As you can see here, How to wildcard include JAR files when compiling?, you cannot use the wildcard '*' in the classpath to get several jar files unless you are using java 1.6 or above. Otherwise, you should write each concrete jar you need.

To put your .class files in the bin directory, you can use the -d <directory> option of javac to specify where to place generated class files.

Community
  • 1
  • 1
jalopaba
  • 8,039
  • 2
  • 44
  • 57
-1

just out of curiosity, why make? why not use a more modern tool like maven, ant or gradle?

They are designed for this sort of thing and usually give you what you want out of the box.

But to answer your question:

javac -d outputdir

Matt
  • 11,523
  • 2
  • 23
  • 33