Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the java PATH set correctly ? Current Path set is : C:\Program Files\Java\jdk-14.0.2 #23

Open
Aldana1985 opened this issue Sep 7, 2020 · 5 comments

Comments

@Aldana1985
Copy link

Hi! I keep getting the same message: Is the java PATH set correctly ? Current Path set is : C:\Program Files\Java\jdk-14.0.2
I know my path and it's well written but still doesn't recognize it.
Also I don't know where to install this:
{
"require": {
"dsiddharth2/php-zxing": "1.0.3"
}
}

If you can help me I'd aprecciated.
Thanks.

@SuperFred
Copy link

You need to set the path with the java.exe and add doublequote

this work for me :
$decoder->setJavaPath('"C:/Program Files/Java/jdk-11.0.6/bin/java.exe"');

@gouyuwang
Copy link

@SuperFred is right.

in addition:

//==> This is a bug
$img_path = str_replace('\', '/', $img_path);
$decoder->decode("file:///" . $img_path);

@lintangtimur
Copy link

lintangtimur commented Jun 24, 2021

You need to set the path with the java.exe and add doublequote

this work for me :
$decoder->setJavaPath('"C:/Program Files/Java/jdk-11.0.6/bin/java.exe"');

not work for me, message still appear

@SuperFred
Copy link

@lintangtimur be sure the path to your java.exe is correct

In Windows at the command prompt

where java

@endcycles
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants