dsiddharth2 / php-zxing

PHP wrapper for Zxing Java library
MIT License
126 stars 25 forks source link

"Is the java PATH set correctly ?" problem. #26

Open endcycles opened 3 years ago

endcycles commented 3 years ago

I can run the Jar files directly from my SSH command line.

java -cp javase-3.3.3.jar:core-3.3.3.jar:jcommander-1.72.jar com.google.zxing.client.j2se.CommandLineRunner ../../../../../images/testimage.jpg
file:///home/earnrnet/public_html/barcode/vendor/dsiddharth2/php-zxing/src/bin/../../../../../images/testimage.jpg (format: PDF_417, type: TEXT):
Raw result:
6200868213185368
Parsed result:
6200868213185368
Found 8 result points.
  Point 2: (599.0,673.0)
  Point 3: (599.0,754.0)
  Point 6: (534.0,673.0)
  Point 7: (534.0,754.0)

This is my response when I run the PHP file: Is the java PATH set correctly ? Current Path set is : /home/earnrnet/java/jdk-17.0.1/bin/java"

This is my Java version:

java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

PATH has been setup and I can use java command within my SSH console.

which java command returns:

~/java/jdk-17.0.1/bin/java

readlink -f returns

/home/earnrnet/java/jdk-17.0.1/bin/java

I have tried the$realJavaPath = exec('readlink -f [FILEPATH]'); with no luck.

I also attempted to edit PHPZxingDecoder.php basePrepare() method from $this->getJavaPath() to java and it still won't work, throwing the same exact error.