Closed dodomui closed 5 years ago
The full error code is as per below, while I try to run which java, it return /usr/bin/java
Is the java PATH set correctly ? Current Path set is : /usr/bin/java
Fatal error: Uncaught Error: Call to a member function isFound() on null in Stack trace: #0 {main} thrown in
Did you try doing ?
$decoder->setJavaPath('/usr/bin/java');
Yes I did, you can see it also showing Current Path set is : /usr/bin/java
I think is because the shared hosting plan doesn't support JDK. Am I right? Seem most shared hosting doesn't support JDK based on my understanding.
Can you try running the java file directly ? so that you can validate whether what you are saying is a problem ?
@dsiddharth2 @dodomui
I've had a Java path issue recently, which was related to /usr/bin/java being a symbolic link. My solution was to resolve the symbolic link first and setting java path to the actual file path, like this:
$realJavaPath = exec('readlink -f /usr/bin/java');
$decoder->setJavaPath($realJavaPath);
Just be aware that the readlink
is not available on all OSes or at least doesn't work the same. It does work fine for me on Ubuntu 16.04.
@dsiddharth2 @dodomui
I've had a Java path issue recently, which was related to /usr/bin/java being a symbolic link. My solution was to resolve the symbolic link first and setting java path to the actual file path, like this:
$realJavaPath = exec('readlink -f /usr/bin/java'); $decoder->setJavaPath($realJavaPath);
Just be aware that the
readlink
is not available on all OSes or at least doesn't work the same. It does work fine for me on Ubuntu 16.04.
Oh @denizozsen I was unaware of this, I will mention this on the documentation file.
Thanks :)
Hi @dsiddharth2 , thanks! I always thought that symlinks would be automatically resolved via calls to exec()
or system()
, but it seems that there are a few things that can influence whether that's the case, including PHP configuration and file permissions. At least that's what I understand from reading around on the internet. Some examples:
Anyway, I guess there's not much you can do about it, other than mention the issue in the documentation.
Nice project, by the way, keep up the good work!
@dodomui Did you try what @denizozsen is suggesting ? Did this work ?
Is the java PATH set correctly ? Current Path set is : /usr/bin/java
I receive above error on my server. While i try to use which JAVA on my server SSH, it return /usr/bin/java
Wonder will still showing this error? Anyone could advise?
@dsiddharth2 I'm having the exact same issue. I've tried everything on this thread, but to no avail. I'm testing this script locally on macOS Mojave version 10.14.6 (18G103) with the latest version of Java.
I found the path from readlink /usr/bin/java (because -f gave me an error), and used that path in the script. Still nothing.
I'd be grateful for any help! Thank you!
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)
But I am coming across this issue with Java version error showing upas well. I am utilizing shared hosting however Java JRE is working just fine.
Do I need JDK as well?
This is my response when I run the PHP file:
Is the java PATH set correctly ? Current Path set is : /home/earnrnet/java/jre1.8.0_311/bin/java
This is my Java version, JRE only:
java version "1.8.0_311" Java(TM) SE Runtime Environment (build 1.8.0_311-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)
PATH has been setup and I can use java
command within my SSH console.
Is the java PATH set correctly ? Current Path set is : /usr/bin/java
I receive above error on my server. While i try to use which JAVA on my server SSH, it return /usr/bin/java
Wonder will still showing this error? Anyone could advise?