ashleypursglove 0 Report post Posted June 16, 2011 I am running Jet 6.4 professional edition and was looking for an example of how to call a java dll compiled using jet from C#. I found out that there is an example of how to do this in later versions of the compiler. Someone kindly uploaded a copy of this example so I was able to run through it. I have followed the steps in the example and upon running the final .exe file I get a badimageformat exception. Is it likely that this is being caused by an error in the example, an error I've made or does jet 6.4 not support C# interop? ** I have since then downloaded a trial of version 7.2 and am getting teh same error after following the instructions. ** Kind Regards Ash Share this post Link to post Share on other sites
AlexM 0 Report post Posted June 21, 2011 Hi Ash, It seems that you are trying to run this sample on x64 system. By default, C# compiler targets "anycpu" platform, which turns into x64 on 64-bit system and x86 on 32-bit system. But DLLs generated in the sample (both C DLL and Java DLL) are 32-bit. 32-bit DLLs cannot be used in x64 process. To solve this problem, force C# compiler to target x86 platform. Edit build.bat and change the line csc Test.cs to csc /platform:x86 Test.cs Then rebuild a sample. Best regards --AlexM Share this post Link to post Share on other sites
ashleypursglove 0 Report post Posted June 21, 2011 Hi Ash, It seems that you are trying to run this sample on x64 system. By default, C# compiler targets "anycpu" platform, which turns into x64 on 64-bit system and x86 on 32-bit system. But DLLs generated in the sample (both C DLL and Java DLL) are 32-bit. 32-bit DLLs cannot be used in x64 process. To solve this problem, force C# compiler to target x86 platform. Edit build.bat and change the line csc Test.cs to csc /platform:x86 Test.cs Then rebuild a sample. Best regards --AlexM Hi Alex, Thanks very much for the response. I will try this now. It sounds like this may be quite a common issue that people face. May I suggest that you include this information in the readme of the example? Thanks again, Kind Regards Ash Share this post Link to post Share on other sites
AlexM 0 Report post Posted June 22, 2011 Hi Ash, Thank you for the suggestion. I have corrected build.bat and included this information into readme.txt of this sample (in the future versions of Excelsior JET). Best regards, --AlexM Share this post Link to post Share on other sites