Failed to install WWW::HtmlUnit in Windows box - java

I'm trying to install WWW::HTMLUnit on Windows 7. There're step that I run through:
Install Inline::Java 0.53
Install WWW::HTMLUnit 0.15
At step 2, after nmake, I type nmake test to test module but it failed. Here's output:
C:\nmake test
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/00_basic...........
t/00_basic...........NOK 1/1# Failed test 'use WWW::HtmlUnit;'
# at t/00_basic.t line 9.
# Tried to use 'WWW::HtmlUnit'.
# Error: Class com.gargoylesoftware.htmlunit.WebClient not found at C:/Perl/site/lib/Inline/Java.pm line 619
# BEGIN failed--compilation aborted at (eval 4) line 2, <GEN7> line 4.
# Looks like you failed 1 test of 1.
t/00_basic...........dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
Failed 1/1 tests, 0.00% okay
t/01_hello...........Class com.gargoylesoftware.htmlunit.WebClient not found at C:/Perl/site/lib/Inline/Java.pm line 619
BEGIN failed--compilation aborted at t/01_hello.t line 4, <GEN7> line 4.
t/01_hello...........dubious
Test returned status 26 (wstat 6656, 0x1a00)
t/02_hello_sweet.....dubious
Test returned status 19 (wstat 4864, 0x1300)
t/03_clickhandler....Class com.gargoylesoftware.htmlunit.WebClient not found at C:/Perl/site/lib/Inline/Java.pm line 619
BEGIN failed--compilation aborted at t/03_clickhandler.t line 6, <GEN7> line 4.
t/03_clickhandler....dubious
Test returned status 29 (wstat 7424, 0x1d00)
DIED. FAILED tests 1-8
Failed 8/8 tests, 0.00% okay
Failed Test Stat Wstat Total Fail List of Failed
-------------------------------------------------------------------------------
t/00_basic.t 1 256 1 1 1
t/01_hello.t 26 6656 ?? ?? ??
t/02_hello_sweet.t 19 4864 ?? ?? ??
t/03_clickhandler.t 29 7424 8 16 1-8
Failed 4/4 test scripts. 9/9 subtests failed.
Files=4, Tests=9, 3 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU)
Failed 4/4 test programs. 9/9 subtests failed.
NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x1d'
Stop.
From above log, I could see that:
class Error: com.gargoylesoftware.htmlunit.WebClient could not be found.
I have no idea that I missed anything.
Any help would be appreciated.
Thanks.
Minh.

I found it.
There's different between path in Unix and Windows system. Unix uses ':' for a delimiter but Windows uses ';'. So what I've done is that open HTMLUnit.pm and change all of ':' to ';'.
With HTMLUnit version 0.15 I made changes at these lines below:
Line 78:
return join ';', map { "$jar_path/$_" } qw( # return join ':', map { "$jar_path/$_" } qw(
Line 127:
$custom_jars = join(';', #{$parameters{'jars'}}); # $custom_jars = join(':', #{$parameters{'jars'}});
Line 148:
CLASSPATH => collect_default_jars() . ";" . $custom_jars, # CLASSPATH => collect_default_jars() . ":" . $custom_jars,
And it works like a magic.

(it wouldn't let me comment on an existing answer)
I see your answer about ':' vs ';'. I'll try to include a fix in the next WWW::HtmlUnit release (I am the author of the perl bindings).

Related

Command line arguments in scala

Recently I posted a question about some basic scala code. I got some useful responses that emphasized that scala2 and and scala3 are very different programming languages. Since I have scala3, I was careful enough to work out only scala3 examples, such as this one:
#main def happyBirthday(age: Int, name: String, others: String*) =
val suffix =
age % 100 match
case 11 | 12 | 13 => "th"
case _ =>
age % 10 match
case 1 => "st"
case 2 => "nd"
case 3 => "rd"
case _ => "th"
val bldr = new StringBuilder(s"Happy $age$suffix birthday, $name")
for other <- others do bldr.append(" and ").append(other)
bldr.toString
I compile it as scalac happyBirthday.scala and run as scala happyBirthday 23 Lisa Peter
Illegal command line: java.lang.NumberFormatException: For input
string: "happyBirthday"`
This reminded me very much the issue observed in a comment to this post. #LuisMiguelMejíaSuárez suggested that a workaround could be to compile to jar. I did exactly that using this recipe
scalac happyBirthday.scala -d happyBirthday.jar
and run
java -jar happyBirthday.jar 23 Lisa Peter
Error: A JNI error has occurred, please check your installation and
try again Exception in thread "main" java.lang.NoClassDefFoundError: scala/util/CommandLineParser$ParseError
I wonder what's wrong with this code? Notice that "#main methods are the recommended scheme to generate programs that can be invoked from the command line in Scala 3." according to this reference.

getting errors in cross-compiling openjdk 11u to aarch64

I am trying to cross-compile openjdk 11u to aarch64. I am using following command:
bash configure --openjdk-target=aarch64-linux-gnu --disable-warnings-as-errors
next I use make command to compile openjdk, but iam getting output errors below:
ERROR: Build failed for target 'default (exploded-image)' in
configuration 'linux-aarch64-normal-server-release' (exit code 2)
=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_gtest_objs_BUILD_GTEST_LIBJVM_link:
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld:
/mnt/c/Users/ACER/downloads/jdk11-source/build/linux-aarch64-normal-server-release/hotspot/variant-server/libjvm/objs/macroAssembler_aarch64.o:
in function `RegSet::operator-(RegSet) const':
/mnt/c/Users/ACER/downloads/jdk11-source/src/hotspot/cpu/aarch64/register_aarch64.hpp:239:
undefined reference to `JavaThread::aarch64_get_thread_helper()'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld:
/mnt/c/Users/ACER/downloads/jdk11-source/build/linux-aarch64-normal-server-release/hotspot/variant-server/libjvm/objs/macroAssembler_aarch64.o:
in function `MacroAssembler::push(RegSet, RegisterImpl*)':
/mnt/c/Users/ACER/downloads/jdk11-source/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp:518:
undefined reference to `JavaThread::aarch64_get_thread_helper()'
collect2: error: ld returned 1 exit status
* For target hotspot_variant-server_libjvm_objs_BUILD_LIBJVM_link: /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld:
/mnt/c/Users/ACER/downloads/jdk11-source/build/linux-aarch64-normal-server-release/hotspot/variant-server/libjvm/objs/macroAssembler_aarch64.o:
in function `RegSet::operator-(RegSet) const':
/mnt/c/Users/ACER/downloads/jdk11-source/src/hotspot/cpu/aarch64/register_aarch64.hpp:239:
undefined reference to `JavaThread::aarch64_get_thread_helper()'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld:
/mnt/c/Users/ACER/downloads/jdk11-source/build/linux-aarch64-normal-server-release/hotspot/variant-server/libjvm/objs/macroAssembler_aarch64.o:
in function `MacroAssembler::push(RegSet, RegisterImpl*)':
/mnt/c/Users/ACER/downloads/jdk11-source/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp:518:
undefined reference to `JavaThread::aarch64_get_thread_helper()'
collect2: error: ld returned 1 exit status
* All command lines available in /mnt/c/Users/ACER/downloads/jdk11-source/build/linux-aarch64-normal-server-release/make-support/failure-logs.
=== End of repeated output ===
No indication of failed target found. Hint: Try searching the build
log for '] Error'. Hint: See doc/building.html#troubleshooting for
assistance.
make[1]: ***
[/mnt/c/Users/ACER/downloads/jdk11-source/make/Init.gmk:305: main]
Error 2 make: ***
[/mnt/c/Users/ACER/downloads/jdk11-source/make/Init.gmk:186: default]
Error 2
I don't know how to fix this errors.

"Java not found" in using tabula-py

everyone, I am using tabula-py in python to extract table from pdfs. I used following codes.
import tabula
table_temp = tabula.read_pdf('./example_pdf/sample1.pdf',pages=11)
However, I got the error message as pasted below, in which I was told "no such file or directory: 'java'". I have installed Java in the following folder
"/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home".
Could anyone help me on solving the problem?
Thanks.
FileNotFoundError Traceback (most recent call last)
<ipython-input-4-41c9ba6fd519> in <module>()
----> 1 table_temp = tabula.read_pdf('./example_pdf/sample1.pdf',pages=11)
/Users/Myworld/anaconda/lib/python3.5/site-packages/tabula/wrapper.py in read_pdf(input_path, **kwargs)
64
65 try:
---> 66 output = subprocess.check_output(args)
67 finally:
68 if is_url:
/Users/Myworld/anaconda/lib/python3.5/subprocess.py in check_output(timeout, *popenargs, **kwargs)
314
315 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 316 **kwargs).stdout
317
318
/Users/Myworld/anaconda/lib/python3.5/subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
381 kwargs['stdin'] = PIPE
382
--> 383 with Popen(*popenargs, **kwargs) as process:
384 try:
385 stdout, stderr = process.communicate(input, timeout=timeout)
/Users/Myworld/anaconda/lib/python3.5/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
674 c2pread, c2pwrite,
675 errread, errwrite,
--> 676 restore_signals, start_new_session)
677 except:
678 # Cleanup if the child failed starting.
/Users/Myworld/anaconda/lib/python3.5/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1280 else:
1281 err_msg += ': ' + repr(orig_executable)
-> 1282 raise child_exception_type(errno_num, err_msg)
1283 raise child_exception_type(err_msg)
1284
FileNotFoundError: [Errno 2] No such file or directory: 'java'
I had run into the same error. The line actually causing the error for me was subprocess.call('java').
Installing Java on my machine fixed the error for me.
If installing Java still doesn't solve the problem for you, try running which java, and add the output directory to your PATH environment variable.

Android build error: ro.build.fingerprint cannot exceed 91 bytes

I'm building an android rom from the android source code but after about 5 minutes it gives this error.
error: ro.build.fingerprint cannot exceed 91 bytes: Android/mini_emulator_x86/mini-emulator-x86:5.0.555/AOSP/username02280306:userdebug/test-keys (97)
make: *** [out/target/product/mini-emulator-x86/system/build.prop] Error 1
make: *** Deleting file `out/target/product/mini-emulator-x86/system/build.prop'
make: *** Waiting for unfinished jobs....
How do I increase the ro.build.fingerprint size limit?
Plus I'm building on a Mac.
Edit build/tools/post_process_props.py. Change lines as follows:
PROP_NAME_MAX = 31
# PROP_VALUE_MAX = 91
PROP_VALUE_MAX = 128
Edit bionic/libc/include/sys/system_properties.h. Change lines as follows:
#define PROP_NAME_MAX 32
// #define PROP_VALUE_MAX 92
#define PROP_VALUE_MAX 128
Do
make clean
make
You can also run the second make command in parallel using syntax such as
make -j8
Alternatively, you can specify the build fingerprint string as command line argument to make using:
make -j5 BUILD_FINGERPRINT="....."
This will allow you to stay within the 91 byte limit.

Launching JRE in Linux from a FAT32 USB

I have a Java application installed on a USB which the user should be able to run from any OS.
For this,
I'm packaging a JRE instance on the USB along with my application.
I'm having a FAT32 file-system on the USB.
However, the problem is, FAT32 has no concept of execute ("+x") permissions. While I can launch a shell script, like so:
$ sh /path/to/fat32-usb/helloWorld.sh
, and while I can launch a simple ELF binary, like so:
$ /lib64/ld-linux-x86-64.so.2 /path/to/fat32-usb/helloWorld
, I can't seem to be able to launch the Java ELF program. I get these errors:
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.
Before launching java, I've tried setting these environment variables as follows:
export JAVA_HOME=/path/to/fat32-usb/jre
export LD_LIBRARY_PATH="$JAVA_HOME/lib/amd64:.:$LD_LIBRARY_PATH"
export PATH="$JAVA_HOME/bin:.:$PATH"
I have also tried launching java from inside the $JAVA_HOME/bin directory. Finally, I've also tried copying all the libXXX.so's from $JAVA_HOME/lib/amd64/ to $JAVA_HOME/bin, hoping that they would get picked up from the current directory, ., somehow.
But nothing has worked.
EDIT
Here are the last few lines of strace output:
$ strace -vfo /tmp/java.strace /lib64/ld-linux-x86-64.so.2 /path/to/fat32-usb/jre ...
...
readlink("/proc/self/exe", "/lib/x86_64-linux-gnu/ld-2.17.so", 4096) = 32
write(2, "Error: could not find libjava.so", 32) = 32
write(2, "\n", 1) = 1
write(2, "Error: Could not find Java SE Ru"..., 50) = 50
write(2, "\n", 1) = 1
exit_group(2) = ?
EDIT2
And here is the output of ltrace (just a single line!):
$ ltrace -s 120 -e '*' -ifo /tmp/java.ltrace /lib64/ld-linux-x86-64.so.2 /path/to/fat32-usb/jre ...
30913 [0xffffffffffffffff] +++ exited (status 2) +++
EDIT 3
This is ltrace excerpt around loading of libjava.so by a Java on an ext4 partition (and not the problem FAT32 partition), which I can load fine:
5525 [0x7f7627600763] <... snprintf resumed> "/home/aaa/bbb/jdk1.7.0_40/lib/amd64/libjava.so", 4096, "%s/lib/%s/libjava.so", "/home/aaa/bbb/jdk1.7.0_40", "amd64") = 46
5525 [0x7f762760076d] libjli.so->access("/home/aaa/bbb/jdk1.7.0_40/lib/amd64/libjava.so", 0) = -1
5525 [0x7f762760078d] libjli.so->snprintf( <unfinished ...>
5525 [0x3085246bdb] libc.so.6->(0, 0x7fffffd8, 0x7f7627607363, 39) = 0
5525 [0x3085246be3] libc.so.6->(0, 0x7fffffd8, 0x7f7627607363, 39) = 0
5525 [0x7f762760078d] <... snprintf resumed> "/home/aaa/bbb/jdk1.7.0_40/jre/lib/amd64/libjava.so", 4096, "%s/jre/lib/%s/libjava.so", "/home/aaa/bbb/jdk1.7.0_40", "amd64") = 50
5525 [0x7f7627600797] libjli.so->access("/home/aaa/bbb/jdk1.7.0_40/jre/lib/amd64/libjava.so", 0) = 0
And this is the strace output of, again, the healthy/loading java.
5952 readlink("/proc/self/exe", "/home/aaa/bbb/jdk1.7.0_40/bin/ja"..., 4096) = 34
5952 access("/home/aaa/bbb/jdk1.7.0_40/lib/amd64/libjava.so", F_OK) = -1 ENOENT (No such file or directory)
5952 access("/home/aaa/bbb/jdk1.7.0_40/jre/lib/amd64/libjava.so", F_OK) = 0
5952 open("/home/aaa/bbb/jdk1.7.0_40/jre/lib/amd64/jvm.cfg", O_RDONLY) = 3

Categories

Resources