I want to create a DLL from a JAR for use in Unity.
I create a jar file using JavaSE-1.7, then I create the dll from it using ikvmc v7.2.4630.5
When I use this dll in a new C# Windows application it works fine without any exceptions or errors, but when I use it in Unity it also works even though I'm getting the following TypeLoadException:
Could not load type 'java.util.Date' from assembly IKVM.OpenJDK.Core
But although this works, Unity won't export or build my project due to this exception. How can I get around this?
EDIT: Ok the only way I can get this to work is if I use JRE 1.5 and an older version of IKVM like 0.28 which doesn't solve my problem because some functionality from JRE 1.7 is not supported in JRE 1.5
Despite this is an old question, I leave some advices for future reference:
try to use the last version of IKVM (8.0 at time of writing).
Go to: Edit -> Project Settings -> Player. Under Other settings for PC / Mac change the API Compability Level from ".NET 2.0 Subset" to ".NET 2.0". Recompile.
Copy all of the DLLs provided with IKVM inside the Assets folder of your project (NOT in a subfolder).
All of the Java versions are supported (even Java 8, see Release Notes).
Related
I need to handle bitcoin in my unity project
I tried to install some nuget packages to support that
like this for example : https://github.com/blockchain/api-v1-client-csharp
but I always get this error
Could not install package 'BlockchainAPI 2.0.0'. You are trying to
install this package into a project that targets
'.NETFramework,Version=v4.0', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
unfortunately - no current unity3d plugins that support bitcoin yet
any suggestions , solutions ?
The plugin is using .NET version that is > Unity's supported .NET version.
The easiest solution I know about is to download the project directly from the link you posted.Delete any file that is NOT a C# file(.cs). Extract those folders with the remaining files and put them in your Unity project. Now look for errors. If you find any script with an error or script that uses C# 4 classes, modify it and fix the errors by hand.
This is easier than trying to implement your own bitcoin API from scratch.
NOTE: The only reason I recommend this method is because I looked inside the project and there were no DLL files inside it. So it is possible to port it if there is no DLL file in the API. Assuming there were DLL files compile with C# 4, then that would be a problem.
There's a beta edition of Unity that now supports a newer Mono version, which can let you compile .NET 4.5.2 (or older) projects.
I recommend you Nicolas Dorier's NBitcoin library for this then.
So i'm kind of new to programming but i started using Xamarin and i tried to add NHunspell package from NuGet on Xamarin Studio, it downloads it and the .dlls appear in Resources and NHunspell appear in Packets, but it doesn't appear in References and so when i try "using NHunspell" it doesn't work.
I have tried running the "install" script with Power Shell but apparently nothing changed.
How do I add NHunspell to my project?
Not every .NET library is compatible with Xamarin. They generally have to be either built against the appropriate Xamarin Framework, or build using a compatible PCL Profile.
scan.xamarin.com can tell you if a given DLL is compatible or not.
As I answered you already per Email the problem with NHunspell is that it is in fact an wrapper to Hunspell. Hunspell is written in c or C++ so it compiles to a native Dll. At this time the build produces two native DLLs for Windows 32 Bit and 64Bit. It would be necessary to produce native DLLs for ARM / Android or Linux or ... to use it on these platforms. I will do this for X86/X64 Linux in the future. But at the moment I'm snowed under so there is no timeframe. If you or someone else is willing to contribute, you're welcome.
BTW. NHunspell has an resolver for the correct native DLL. If your project has the native DLLs in the output directory, it resolves X86 or x64 in windows. You can do this in Xamarin studio by adding the native DLLs in your project and configure "copy to output directory". But this works only in Windows.
The latest packages (without NuGet) are here:
http://download.crawler-lib.net/NHunspell/
I have recently acquired the student licence of Mono Android from Xamarin.
After making a simple project, i decided to start using some DLL's i am familiar with such as Json.Net and H.A.P on my Android Application (mono project), and that's when the problems started.
After trying to pull those references from NuGet, they failed since the "Android Application" project is not known leading to no .dll installed (NuGet tries to match the project type with the correct .dll to be downloaded be it WindowsPhone, .NET4, .NET 3.5 and so on).
So i moved on to mannually referencing the libraries, since i have them downloaded on my PC. Referencing Works, but as soon as i try to access the HtmlAgilityPack it raises an exception.
Error CS0012:
The type 'System.Xml.XPath.IXPathNavigable' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Xml, Version=x.x.x.x, Culture=neutral
The exception is raised on the first execution of the code because of J.I.T compilation of .NET, i know this.
Question:
How can i use my "so loved" .dlls on my Mono Android Project?
Do i need the source code of those libraries in order to use them on my projects?
Thanks in Advance
In order to recompile an assembly you will need the source.
To see what assemblies are provided by Xamarin.Android and Xamarin.iOS you can visit these two pages:
http://docs.xamarin.com/guides/android/advanced_topics/assemblies
http://docs.xamarin.com/guides/ios/advanced_topics/assemblies
One way to recompile it would be to make a Android Class Library or iPhone Class Library and add a link to all the files in the original source and then compile it. Or when Xamarin have their PCL support done, do something similar just in a PCL so that you have one DLL targeting multiple platforms.
You may also find this post useful, which briefly describes how to compile HtmlAgilityPack against Xamarin.Android: http://forums.xamarin.com/discussion/comment/2139/#Comment_2139 You might need to alter some things as this is from December 2012, since then things might have changed.
I have a c# solution that accesses a c++ project through COM. The project has to be targeted to a specific processor, in this case x64. I am using the Windows installer to install the application.
The first problem I ran into was the c++ dll was not being registered properly when installed, and the program couldn't access it. I solved this by adding the c++ project to the solution.
For a while this worked, and everything installed properly, but then I started getting the following warning when I tried to build:
The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '.NET Framework 3.5'. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).
The setup would not install if I tried ignoring the warning. After some searching, I found that the c++ project was building in .NET 4.0, while my solution used .NET 3.5. I tried changing my solution to 4.0, but for some reason it stopped working, so I changed the c++ to 3.5.
This worked for a couple of builds, but then I began getting the following errors:
Error: LNK1104 cannot open file 'mfc90.dll'.
I added the file to the Additional Dependencies section, but then another link error occured (mfcs90.dll) and when adding that one, I got an x86 x64 conflict.
I'm not sure why these solutions worked for a while and then stopped, and I can't seem to find a resolution at any step that works. If anyone has seen anything similar to this, the insight would be appreciated.
In order to include the Microsoft runtime dlls, you should not simply include the dll in your application directory. This won't help when the dlls have various dependencies and you might run into different conflicts and versioning issues.
The way I would recommend installing the runtime dlls for you application is to include the official merge module in your MSI.
See the following link for your options to redistribute the runtime library:
http://msdn.microsoft.com/en-us/library/ms235316(v=vs.90).aspx
I've been trying to port a .NET library built on/for Windows to Ubuntu 11.04 using Mono. The library uses .NET 4.0 so the version of mono (2.6.7) that is standard with Ubuntu 11.04 doesn't cut it. Specifically, I'm trying to use Microsoft.VisualBasic.Devices.Computer.Info.TotalPhysicalMemory. I've searched high and low for packages or parallel build scripts that install Microsoft.VisualBasic.dll, but none of them do.
Ideally I'd like to find a way to get the best of both worlds, Mono with .NET 4.0 support and Microsoft.VisualBasic so that the code won't have to be modified. I would settle for an alternative that uses another method (although, the P/Invoke method I saw in this previous post does not appeal to me).
Any help is greatly appreciated.
It looks like getting VB.dll won't help you either. This method is not implemented in Mono:
https://github.com/mono/mono-basic/blob/master/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.Devices/ComputerInfo.vb
You could try to fool Cudafy by creating your own version of the DLL.
Use reflector or check here to see the interface
https://github.com/mono/mono-basic/blob/master/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.Devices/ComputerInfo.vb
You can use a performance counter on Mono to actually get the amount of memory;
var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory");
var mem = pc.RawValue();
You can use the MoMA tool to check how compatible mono is for your project.
In your particular case the method you need isn't implemented, if that's the only thing preventing your project from working, you can implement it, and build and provide your own MS.VB.dll until mono releases a version with the change in it. Once you've built mono-basic it's simple to install on any machine (with mono already installed), just run:
gacutil -i path/to/MS.VB.dll
and the dll will be installed into the gac.