`
aerchi
  • 浏览: 427777 次
  • 性别: Icon_minigender_1
  • 来自: 昆明
文章分类
社区版块
存档分类
最新评论

Using Watij with Windows 7

 
阅读更多

Hi,


I've been using Watij very successfully for some time now, and have
many tests running under Windows XP and Vista. I have recently
installed Windows 7 and am having some problems with Watij, and
wondered if anyone could help me out.

I'm finding that some functionality it working (like simply opening an
IE instance at a designated URL), and some isn't, the main area I'm
having a problem with is using:

IEUtil.browserCount()

When I try to use this method I get the following exception:

com.jniwrapper.win32.com.ComException: COM object method returns error
code: 0x80040154; Class not registered
at com.jniwrapper.win32.com.ComException.checkResult(SourceFile:72)
at com.jniwrapper.win32.com.ComFunctions.coCreateInstance(SourceFile:
149)
at com.jniwrapper.win32.com.impl.IUnknownImpl.<init>(SourceFile:79)
at com.jniwrapper.win32.automation.impl.IDispatchImpl.<init>
(SourceFile:53)
at com.jniwrapper.win32.shdocvw.impl.IShellWindowsImpl.<init>
(SourceFile:38)

at com.jniwrapper.win32.shdocvw.ShellWindows.create(SourceFile:30)



Just a wild guess but I suspect the jniwrapper.dll is not compatible
with Windows 7. This is not a free DLL. The creators of Watij have a
special license for the DLL so it can be distributed for use with
Watij. The best solution I can give is to run Watij in Windows XP
compatible mode. To do this, find the java.exe used to run your Watij
code. Right click on it and go to Properties. There should be a
compatibility tab. It should be obvious what to do from there.

at watij.runtime.ie.IEUtil$3.create(IEUtil.java:137)
at watij.utilities.IUnknownBinder$1.run(IUnknownBinder.java:19)
at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run
(MessageLoopThread.java:569)
at com.jniwrapper.win32.MessageLoopThread$LoopThread.run
(MessageLoopThread.java:511)

I did spot another post on here from a similar exception on Windows
200o which stated to try:

regsvr32 shdocvw.dll

However, when I run this, I get the following error:

"The module "shdocvw.dll" was loaded but the entry-point
DllRegisterServer was not found. Make sure that "shdocvw.dll" is a
valid DLL or OCX file and then try again."

Obviously, trying this made no difference to the problem, can anyone
help me out here?

Thanks in advance,

Mike.



I've tried out a number of other things and there are quite a number
of pieces of Watij functionality that also aren't working under
Windows 7, such as IE.close(), IEUtil.closeAllBrowsers() and IE.attach
().

Does anyone have any insight on this to help me out?

Thanks,

Mike.

On 31 Dec 2009, 11:55, rhone08 <mike.sm...@virginmobile.com> wrote:


Hi Darrell,

Thanks for this, however setting java.exe to Compatibility Mode for
Windows XP (SP 3) or Vista (SP 2) still gives the same problem, do you
have any other ideas? Do you think there are another files that need to
be run in compatibility mode for this to work?

Mike.



How are you running the code? If you are running it from an IDE like
Eclipse then confirm you have set the compatibility of the correct
java.exe. If the project is running using the JRE from Eclipse then it
is probably using javaw.exe and not java.exe. Or if you are running
from a tool like Ant and it is using the PATH to find java.exe, it
could be finding java.exe in the Windows system32 directory.

Alternatively, open up the task manager and go to the Processes tab.
From the View->Select Columns... menu option you can turn on the
'Command Line' column. Then you can see which JRE/JDK is being used to
run Watij.

Other than that, you have me stumped. My guess is that the
jniwrapper.dll is not compatible with Windows 7 and you'll need to get
a copy which is compatible.

Darrell


Hi Darrell,

Thanks for the info once again. I have both java.exe and javaw.exe set
as running in compatibility mode for XP SP3 and no luck I'm afraid. I
have tried running from Eclipse and directly through a simple DOS script
running java.exe directly, and still no luck. I've also checked
c:\windows\system32 and there is no java.exe present at this location to
confound things, so it looks like its a no go with Windows 7 unless any
other thoughts come your way?

Thanks for your help anyway,



The only thing I could suggest is to confirm that the jniwrapper.dll
is not compatible with Windows 7. You can check at http://www.teamdev.com
to see if they have anything about compatibility with Windows 7. If
they indicate that version 3.6 is not compatible with Windows 7, that
would explain why Watij is not working. You could either purchase a
license for a new version of jniwrapper.dll (assuming they have a
version compatible with Windows 7) or you can wait for the developers
of Watij to investigate and fix this issue.

Darrell



Looking at the release notes from TeamDev, and quoting the parts
relevant to this issue, the following is stated in their release notes:

JNIWrapper 3.1 Release Notes (30-Jan-2006)

Added the ability to run JNIWrapper on 64-bit x86 platforms in 32-bit mode.

JNIWrapper 3.3 Release Notes (20-Jul-2006)

Added support for Windows 64-bit platform.

JNIWrapper 3.6.1 Release Notes (06-Apr-2007)

Added support for Solaris x86 and x86-64 platforms.

Nothing more on Windows capatibility since then. From this, it looks
like it should work fine in Windows 7, even though this last note is for
3.6.1, the previous notes state that compatibility shouldn't be the
problem here as long as we are running in compatibility mode only, would
you concur? Looks like 3.6.1 may improve things for full compatibility
with Windows 7, but should be fine in 32-bit compatibility mode.


My personal experience with Windows is things fail with the first
release of a new version. If it does not explicitly state it works
with Windows 7 (which has only been out for a few months) then I would
not assume it is compatible. If you found an entry AFTER the official
release of Windows 7 and it stated what you posted below, I'd assume
it should be compatible with Windows 7 but since the last date is
years before Windows 7, I'd not make that assumption.

On Jan 8, 9:11 am, Mike Smith <mike.smi...@sky.com> wrote:



That's probably a fair point. Do you have any idea when the Watij
developers are likely to start looking at this issue?
I'd imagine that there will be an increasing number of people with
this issue as more and more people move to Windows 7.

I've also tried Watij with a 64-bit JRE and this also doesn't work as
you get an error stating that jniwrap64.dll cannot be found. Is
there any chance of looking into a 64-bit compatible version of Watij
using this jniwrap64.dll?



run all my code in Vmware sessions. I was originally planning on
using a 64-bit Windows environment but just opted for 32-bit versions
of Windows; most our customers run 32-bit versions of Windows XP or
Windows Vista. As we move to Windows 7, I can see more and more
customers using 64-bit Windows 7. I'm moving away from Watij so I'm
not going to pursue a 64-bit version. I like Watij but Internet
Explorer hangs and locks so much that I often find my scripts timing
out. If I could get Watij for Firefox I would stick with it but
because it is based on such a flakey web browser, I'm going to quit
using it.




Collected by: aerchi 查看原文










分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics