« Banded Reports are Evil | Main | Old School Gets it Done »

02/02/2011

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a0115711bf0ae970b0148c84371bb970c

Listed below are links to weblogs that reference Calling J# code from .NET 4.0:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Excellent. Really appreciate your knowledge.

Nice find! This is much more flexible than the inclusion of the DLL in the project.

This is a perfect solution!
This is finally a solution to the following messages:
"The type initializer for 'java.lang.System' threw an exception."
InnerException: "Unable to load DLL 'vjsnativ': The specified module could not be found."

(I tried copying DLL's, using 64bit and 32bit J# DLL's, ... For one NT Service I could call the J# DLL's, for the other one NOT, on the same W2008R2-64bit server :-))

Anyway, here's the VB code for it (For my situation I just put it in my constructor):


Public Sub New()
Try
Dim folder As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "..\Microsoft.NET\Framework\v2.0.50727")
folder = Path.GetFullPath(folder)
LoadLibrary(Path.Combine(folder, "vjsnativ.dll"))
Catch ex As Exception
If ex.InnerException Is Nothing Then
Throw New Exception(ex.Message)
Else
Throw New Exception(ex.Message & vbCrLf & "InnerException: " & ex.InnerException.Message)
End If
End Try

Don't forget: You really have to install the Visual J# Redistributable Package.

Greetz,
Jim Adorno

As for Cole, copying the file didn't work for me either, but your code (adapted for my program) finally helped!
Thank you so much!

Thank you very much for sharing your solution. In my 32bit WebApp this works fine. Unfortunately I have to use a 64bit IIS process. In my case your solution doesn't work.

Is there a way to run J# in a .NET 4.0 64bit worker process?

Greetings

Just found the simple answer by myself... :)


string folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"..\Microsoft.NET\Framework64\v2.0.50727");

The comments to this entry are closed.

David Thielen

B.I. Tweets

    follow me on Twitter

    Windward Reports

    Quantcast

    • Quantcast