Makefile target pattern contains no '%'

1.7k Views Asked by At

This is my makefie

java -cp .:jsoup-1.8.1.jar:mysql-connector-java-5.1.27-bin.jar:. Client.java

and when I run it I'm getting

makefile:1: *** target pattern contains no '%'. Stop.

How to manage that. I'm running it on Ubuntu 13.10

1

There are 1 best solutions below

0
slugonamission On BEST ANSWER

That's not a valid Makefile; you need to wrap the command in a rule instead, e.g.

all:
    java -cp .:jsoup-1.8.1.jar:mysql-connector-java-5.1.27-bin.jar:. Client.java

You should also add dependencies and write the Makefile properly though, so that it will only rebuild if Client.java changes, e.g.

all: Client.java
    java -cp .:jsoup-1.8.1.jar:mysql-connector-java-5.1.27-bin.jar:. Client.java

Side note though; that won't compile your Java file, just try and run it (probably unsuccessfully). You should try and write a Makefile that will take each Java file and compile it into its own class file, then link into a Jar. An example can be found here: http://www.cs.swarthmore.edu/~newhall/unixhelp/javamakefiles.html