Exposingcn163

cn163.net  时间:2021-03-02  阅读:()
IKVM.
NETBuildingaJavaVMonthe.
NETFrameworkJeroenFrijtersWhoamIJeroenFrijters/YeroonFrighters/Co-founderofasmallISVinTheNetherlandsLeaddeveloperofIKVM.
NETanOpenSourceJVMfor.
NETWhatisIKVM.
NETJavaVMontopof.
NET&Mono–JITcompilertotranslateJavabytecodeintoMSIL–Reflection–Etc.
StaticcompilerthattranslatesJavaclasses/jarsinto.
NETassemblies–BasicallyaheadoftimecompilerforabovementionedJIT.
NETportofOpenJDKclasslibrary–Somegaps,butmostAPIspartof"Java"areavailableWhyisIKVM.
NETStartedinthespringof2002asanexperimentMyblogonJune19th,2002:"IhavealargeJavaapplicationthatIwouldliketoslowlymigrateto.
NET,inordertobeabletodothat,IneedawaytointeroperatewithJavacode,theexistingsolutionsIhavelookedatareinadequate.
Besides,It'slotsoffuntobuildsomethinglikethis:-)"CompatibilityJava7–BasedOpenJDKclasslibrarywithoutthenativecode.
–Swing/AWT/Fonts/Graphics/Printingnotsupported.
TherearesomeminorVMlevelincompatibilities,butsofarthesearejusttheoretical.
Practicalsourcesofincompatibilities:–sun.
*packages–"Theclassloaderproblem"[System|IKVM].
ReflectionThankstoAppDomain.
TypeResolveeventitispossibletobuildamanaged"JIT".
But,System.
Reflectionhassomeseriouslimitationsforcompilers.
IKVM.
Reflectionisnowusedbyikvmc,MonoC#compiler,Scala.
NETandothers.
TypeSystemcli.
System.
Objectextendsjava.
lang.
Objectjava.
lang.
Object:System.
Objectjava.
lang.
Stringisonlyacontainerforstaticmethods.
InstancesarealwaysSystem.
String.
cli.
System.
Exceptionsextendsjava.
lang.
Throwablejava.
lang.
Throwable:System.
Exception(checkedexceptions)TypeSystemcont.
java.
lang.
Comparable:System.
IComparablejava.
lang.
Cloneable,java.
io.
Serializable&java.
lang.
CharSequenceneedtobespecialcased(stringsandarrays)Exposing.
NETfeaturestoJavaDelegatesByRefmethodargumentsCustomattributesValueTypesEnumsProperties&EventsDelegatesinJavapublicfinalclassRunnableDelegateextendscli.
System.
MulticastDelegateimplementsRunnable{publicRunnableDelegate(Methodm){}publicnativevoidInvoke();publicinterfaceMethod{voidInvoke();}publicvoidrun(){Invoke();}}DelegatesinJavapackageikvm.
runtime;publicfinalclassDelegates{publicstaticRunnabletoRunnable(RunnableDelegatedelegate){returndelegate;}}java.
lang.
Threadthread=newjava.
lang.
Thread(ikvm.
runtime.
Delegates.
toRunnable(delegate{Console.
WriteLine("HelloWorld");}));thread.
start();ByRefMethodArgumentsSameasinJava,hackitwithanarrayWouldliketousegenerics,buterasuremakesthishard(duetoinabilitytodomethodoverloading)CustomAttributesExposingthemasannotationsworks(mostofthetime)packagesun.
misc;classUnsafe{@SecurityPermissionAttribute.
Annotation(value=SecurityAction.
__Enum.
LinkDemand,UnmanagedCode=true)@cli.
System.
Security.
SecurityCriticalAttribute.
AnnotationpublicvoidfreeMemory(longaddress){Marshal.
FreeHGlobal(IntPtr.
op_Explicit(address));}}ValueTypesWeaksupport:–YoucanonlyusethemfromJava,notdefinethem.
–Willusuallybeboxed.
EnumsWouldliketheabilitytodomethodoverloadingbasedonenumtypeNeedabilityto"bittwiddle"Usableincustomattributeannotationspackagecli.
System;publicfinalclassDayOfWeekextendscli.
System.
Enum{publicstaticfinalintSunday=0;publicstaticfinalintMonday=1;…publicfinalintValue;publicstaticnativeDayOfWeekwrap(inti);}Properties&EventsNospecialsupportDirectlyusetheunderlyingmethodsimportcli.
System.
Windows.
Forms.
*;classDemo{publicstaticvoidmain(String[]args){Formform=newForm();form.
set_Width(400);form.
set_Height(400);form.
add_FormClosing(newFormClosingEventHandler(newFormClosingEventHandler.
Method(){publicvoidInvoke(Objectsender,FormClosingEventArgsargs){System.
out.
println("Closing.
.
.
");}}));Application.
Run(form);}}ExposingJavato.
NETKeepingIntelliSensecleanStaticfieldsininterfacesAnnotationsGenericsWorkaroundsExposingJavato.
NETKeepingIntelliSensecleanStaticfieldsininterfacesAnnotationsGenericsWorkarounds__WorkaroundBaseClass__publicabstractclassBase{protectedabstractvoidM();}publicabstractclassDerived:Base{publicoverridevoidM(){}}classProgram:Derived{}errorCS0534:'Program'doesnotimplementinheritedabstractmember'Base.
M()'publicabstractclassBase{protectedabstractvoidM();}[HideFromJava][EditorBrowsable(EditorBrowsableState.
Never)]publicabstract__WorkaroundBaseClass__Derived:Base{protectedoverridevoidM(){thrownewAbstractMethodError();}}publicabstractclassDerived:__WorkaroundBaseClass__Derived{publicoverridevoidM(){}}__WorkaroundBaseClass__classProgram:Derived{}Interop"Magic"Limitedsupportforautomagic.
NETserializationsupportforJavaserializableclasses.
NETexceptionsareserializedascom.
sun.
xml.
internal.
ws.
developer.
ServerSideExceptionjava.
io.
Closeable=>System.
IDisposablejava.
lang.
Iterable=>System.
IEnumerablejava.
lang.
AutoCloseableSystem.
IDisposable"JarHell"HardtodeterminejardependenciesCirculardepenciesoccurmoreoftenthanyou'dthinkikvmc{foo.
jar-out:Foo.
dll}{bar.
jar-out:Bar.
dll}PerformanceTypicallyprettygood.
NEToftenwinsonstringprocessingExceptionheavycodesuffersDon't"benchmark"underthedebugger!
UsersSeveralcommercialandopensourceapplicationsuseIKVM.
NET"AtmycompanywearestillamazedtoseelargepartofourJavasystemsuccessfullyrunningon.
NETplatformthankstoIKVM.
"AndyMalakov,DeltixLab,Inc.
"WeareveryhappywithIKVM.
ItenablesustodevelopourcorelibrariesinJavaandcompileforusein.
NET.
TheIKVMteamisveryresponsiveandknowledgeableabouttheissueswewerefacing.
"ShamusNeville,eTradingandAnalyticsGroupatHSBC"HavingusedIKVMforoverayear,wehavefoundIKVMtoworkreliablyandofferproductionqualityoperation.
Theonetimewherewedidrunintosomespecificproblem,theopensourcenatureofIKVMallowedustoquicklytrackdownthebugandverifythecauseoftheproblem.
Wehadafixfortheproblemtheverysameday.
"OttoPerdeck,ChordiantSoftwareMoreathttp://www.
ikvm.
net/stories.
htmlQuestionsMoreInformationProjectWebsite:http://www.
ikvm.
net/jeroen@frijters.
nethttp://weblog.
ikvm.
net/@JeroenFrijters

RAKsmart:美国洛杉矶独服,E3处理器/16G/1TB,$76.77/月;美国/香港/日本/韩国站群服务器,自带5+253个IPv4

RAKsmart怎么样?RAKsmart机房即日起开始针对洛杉矶机房的独立服务器进行特别促销活动:低至$76.77/月,最低100Mbps带宽,最高10Gbps带宽,优化线路,不限制流量,具体包括有:常规服务器、站群服务器、10G大带宽服务器、整机机柜托管。活动截止6月30日结束。RAKsmart,美国华人老牌机房,专注于圣何塞服务器,有VPS、独立服务器等。支持PayPal、支付宝付款。点击直达...

器安装环境和运维管理工具推荐

今天看到一个网友从原来虚拟主机准备转移至服务器管理自己的业务。这里问到虚拟主机和服务器到底有什么不同,需要用到哪些工具软件。那准备在下班之间稍微摸鱼一下整理我们服务器安装环境和运维管理中常见需要用到的软件工具推荐。第一、系统镜像软件一般来说,我们云服务器或者独立服务器都是有自带镜像的。我们只需要选择镜像安装就可以,比如有 Windows和Linux。但是有些时候我们可能需要自定义镜像的高级玩法,这...

ZJI-全场八折优惠,香港服务器 600元起,还有日本/美国/韩国服务器

月付/年付优惠码:zji  下物理服务器/VDS/虚拟主机空间订单八折终身优惠(长期有效)一、ZJI官网点击直达ZJI官方网站二、特惠香港日本服务器香港大埔:http://hkdb.speedtest.zji.net/香港葵湾:http://hkkw.speedtest.zji.net/日本大阪:http://jpsk.speedtest.zji.net/日本大阪一型 ...

cn163.net为你推荐
UNIDOENVIRONMENTALANDSOCIALSAFEGUARDSPOLICIESANDPROCEDURES桌面chrome支持ipad支持ipadC1:山东品牌商品馆ipad如何上网如何用手机流量在IPAD上上网勒索病毒win7补丁win7有针对勒索病毒的补丁吗iphonewifi苹果手机怎样设置Wi-Fi静态IP?www.baidu.jp日本视频怎样看苹果5.1.1完美越狱iphone4 5.1.1完美越狱怎么安装中文Siri?
域名交易 免费动态域名 服务器配置技术网 樊云 174.127.195.202 线路工具 typecho qq数据库 shuang12 成都主机托管 阵亡将士纪念日 hdchina 什么是dns linux服务器系统 卡巴斯基免费版下载 以下 g6950 西安电信测速网 装修瓦工培训 瓦工招聘 更多