How to install php_java extension in wamp? - php-java-bridge

I have tried this in my php.ini file:
extension=php_java.dll
[java]
java.java = “C:/Program Files (x86)/Java/jdk1.7.0_03/bin/javaw.exe”
java.java_home = “C:/Program Files (x86)/Java/jre7”
java.class.path = “G:/wamp/bin/php/php5.3.9/ext/JavaBridge.jar”
java.library = “C:/Program Files (x86)/Java/jre7/bin/client/jvm.dll”
java.library.path = “G:/wamp/bin/php/php5.3.9/ext;C:/Program Files (x86)/Java/jre7/lib”
Now WAMP shows php_java extention, but php_info() does not shows java configurations.

use phpjavabridge to make communication between PHP and Java.
I have a youtube vid in French on it: https://www.youtube.com/watch?v=pHtgPrFOChQ

Related

How to set default download path for chrome using selenium webdriver in ubuntu 20.04?

I am trying to save a zip file by using download as option inside a specific folder. I found a way by which I am able to download the file. But the problem where I am stuck is while setting default path in ubuntu it is taking frontslash /, whereas in windows it takes backslash \.
Below is my code which i am using to set the default path.
HashMap<String, Object> hashmap = new HashMap<>();
String defaultPath = System.getProperty("user.dir")+ "\\src\\main\\resources";
hashmap.put("download.default_directory", defaultPath);
options.setExperimentalOption("prefs", hashmap);
During execution the default path is set as below in Ubuntu 20.04 which causing the test case to fail as the file is downloaded in the default location.
/home/user/git/ui-automation\src\main\resources
Can someone help me to resolve this issue ?
You can use the Paths class to resolve file paths that are normalized to the underlying host system:
import java.nio.file.Paths
String userDir = System.getProperty("user.dir");
Strung defaultPath = Paths.get(userDir, "src", "main", "resources").toString();

On deploying latest Aspose 10.6.2 v getting NULLPOINTEREXCEPTION on save in UNIX env

I had migrated the jar to Aspose latest version(10.6.2) and successfully deployed on UNIX env. While saving the form in UNIX env I am getting NullpointerPointer exception.
My name is Tilal Ahmad and I am a developer evangelist at Aspose.
Please note on non-windows OSs subjected exception arises due to font folder path setting. You need to set font folder path according to your machine setting before using any other code, it will resolve the issue. For example on my Ubuntu server, I set font folder path as following.
// Set font folder path
String path = "/usr/share/fonts/truetype/msttcorefonts/";
// Adding a single font directory
// com.aspose.pdf.Document.addLocalFontPath(path);
// seting the user list for standard font directories
java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();
list.add(path);
com.aspose.pdf.Document.setLocalFontPaths(list);
.....
.....

Program using selenium fails after building with cx_freeze

I'm developing an automatic web tester using Selenium (v2.37.2). Program works properly until I run the test built with cxfreeze (there is also tkinter gui).
there is the init function
def initDriver(self):
if self.browser == FIREFOX:
profile = webdriver.FirefoxProfile(profile_directory=self.profile);
self._driver = webdriver.Firefox(firefox_profile=profile)
elif self.browser == CHROME:
self._driver = webdriver.Chrome(self.executable, chrome_options=profile)
elif self.browser == IEXPLORER:
self._driver = webdriver.Ie(self.executable)
Now when I build it using Cx_freeze I get this error
method redirectToBlank(...) calls initDriver(..) as the first thingSo how I pack the .xpi file to the library.zip file - which option in setup.py I have to use? And do I even have to this?
And the second strange thing is, that the other browsers work fine, when I execute the .exe file in by clicking on its icon, but when I run it from command line, I get errors even for chrome and IE. (Sorry that the traceback isn't complete)
All paths are relative from the executed file (no matter from where you run it),
Thank you for any ideas to solve this problem.
(method redirectToBlank(...) calls initDriver(..) as the first thing)
First issue solved
It's problem with selenium - FirefoxProfile - class, which tries to load webdriver.xpi as a normal file, but selenium pack all libraries to a zip file, so selenium can't find it.
Even forcing cx_freeze in setup file to add webdriver.xpi to a proper directory in zip won't help.
It is necessary to edit FirefoxProfile (in firefox_profile module) class for example like this
def _install_extension(self, addon, unpack=True):
"""
Installs addon from a filepath, url
or directory of addons in the profile.
- path: url, path to .xpi, or directory of addons
- unpack: whether to unpack unless specified otherwise in the install.rdf
"""
if addon == WEBDRIVER_EXT:
# altered lines
import sdi.env
WEBDRIVER_SUBSTITUTE = "path/to/unpacked/webdrive.xpi"
addon = os.path.join(os.path.dirname(__file__), WEBDRIVER_SUBSTITUTE)
# Original lines:
# addon = os.path.join(os.path.dirname(__file__), WEBDRIVER_EXT)
< the rest of the method >
Issue 2
OSError: win error 6: the handle is invalid problem wasn't caused by either cxfreeze or selenium. I run the final exe file from git bash. There's the problem. For some reason git bash doesn't open stdin for the program and that's why it fails. When I run it in standard windows command line, everything is ok or if i run it from git bash like program.exe < empty_file
what i did was remove selenium form packages list.
and put it inside includefiles, then it works.
like this :
includefiles = [(seleniumPackage,'')]
...
options = {'build_exe': {'includes':includes,
'excludes':excludes,
'optimize':2,
'packages':packages,
'include_files':includefiles,
...

How installshield searches and create jvm path hint file?

I'm using installshield to install a product, it will first read the is:javahome tag to specify and verify the jre position, if not set then read a tmp file /tmp/istemp2223070045253/xxx_linux_150.jvm to install with. Here is content of this jvm hint file:
DESC: IBM Java Runtime Environment (JRE) 1.5.0 for Linux
JVM_EXE: bin/java
SKIP_PATH_SEARCH: true
CLASSPATH: "-cp "
CLASSPATH_SEPARATOR: :
SYSTEM: "-D"
SYSTEM_SEPARATOR: =
INITIAL_HEAP_SIZE: "-Xms"
MAXIMUM_HEAP_SIZE: "-Xmx"
JVM_PROPERTIES:
"java.vendor=IBM..."
"java.version=1.5.0..."
/:
SET_ENV_FOR_WIZARD:
JAVA2D_USEAWTFONTS=0
/:
PATH_HINT:
was/linux/java
../linux
linux/java
/:
SEARCH_ALL: 0
JVM_HOME:/update/xxx/was/linux/java/
I want to know how this jvm file works and how the path_hint generated? Is there any doc that I can refer? Thanks

How to load file from the Bundle in eclipse & My Eclipse?

This is very strange behavior I have noticed while developing Plugin.
I have a file in the bundle that has to be loaded for wizard.
I tried to load the file in eclipse using following code.
Bundle bundle = Platform.getBundle(MTPAppPlugin.getDefault()
.getBundle().getSymbolicName());
URL fileURL = bundle.getEntry(relativeFilePath);
File file = new File(FileLocator.resolve(fileURL).toURI());
But this didnt worked in MyEclipse.So I used other way for my eclipse
url = new URL("platform:/plugin/"
+ MTPAppPlugin.getDefault().getBundle().getSymbolicName()
+ relativeFilePath);
InputStream inputStream = url.openConnection().getInputStream();
in = new BufferedReader(new InputStreamReader(inputStream));
Now I need to know is there any common way to load the file for eclipse & My Eclipse?
The first one will not work if you have space in your folder path like C:\program files....
The first one seems to be correct. What was the error given in MyEclipse?