0

I'm trying to start my jar-file on a debian in a console. It gets 5 parameters, which look like is shown in the following peace of code:

     if (args.length!=5) { 
       System.out.println("Usage: java popscan.Waterflood" 
                       + " [source image filename]" 
                       + " [destination image filename]" 
                       + " [flood point count (1-256)]" 
                       + " [minimums window width (8-256)]" 
                       + " [connected pixels (4 or 8)]" 
                       ); 
       return; 
   }   

Another part is that it requires the class path to an external library which in this case is OpenCV.

My question is how to start it correctly. I tried a few combinations like:

user@server:~/Waterflood$ java -jar WaterFlood.jar 1.png 1res.png 2 8 8 -cp ~/opencv/installed opencv 3.1/opencv-3.1.0/build/bin/opencv-310.jar

But I always get the message:

Usage: java popscan.Watershed [source image filename] [destination image filename] [flood point count (1-256)] [minimums window width (8-256)] [connected pixels (4 or 8)]

Thanks for any ideas

Jürgen K.
  • 3,427
  • 9
  • 30
  • 66

1 Answers1

1

Move -cp ...jar to directly after java. It's not an argument to the program, it's for the java virtual machine.

java -cp "~/opencv/installed opencv 3.1/opencv-3.1.0/build/bin/opencv-310.jar" -jar WaterFlood.jar 1.png 1res.png 2 8 8
Mattias Isegran Bergander
  • 11,811
  • 2
  • 41
  • 49