资源描述:
《使用非java代码(Use non java code)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、使用非java代码(Usenonjavacode)UsenonJAVAcodeJAVAlanguageanditsstandardAPI(ApplicationProgrammingInterface)aremorethanenoughtowriteapplications.Butinsomecases,thenonJAVAcodemustbeused.Forexample,wesometimesaccessspecificfeaturesofoperatingsystems,dealwithsp
2、ecialhardwaredevices,reuseexistingnonJavainterfaces,orusetimesensitivecodesegments,andsoon.WithnonJavacodecommunicationrequiresspecialsupportfromthecompilerandthe"virtualmachine",andtheJavacodeismappedtoJavacodeadditionaltools(thereisalsoasimplemethod
3、:inthefifteenthchapter"aWeb"section,thereisanexampletoexplainhowtousethestandardinputandoutputwithnonJavacodetoconnect).Atpresent,differentdevelopersprovidedifferentsolutionsforus:Java1.1"Java(JavaNativeInterfacenaturalinterface,JNI,Netscape)proposedt
4、heJavaruntimeinterfaceintheirown"(JavaRuntimeInterface)program,MicrosoftprovidesJ/Direct,"thesourceinterface"(RawNativeInterface,RNI)andJava/COMintegrationscheme.Thedifferentattitudesofdevelopersonthisissueareverybadforprogrammers.IftheJavaapplication
5、mustinvoketheinherentmethod,theprogrammermayhavetoimplementdifferentversionsoftheinherentmethod-specificallydeterminedbytheplatformthattheapplicationruns.ProgrammersmayactuallyneeddifferentversionsofJavacode,aswellasdifferentJavavirtualmachines.Anothe
6、rsolutionisCORBA(GenericObjectRequestBrokerArchitecture),whichisanintegrationtechnologydevelopedbyOMG(objectmanagementgroup,anon-profitassociationofcompanies).CORBAisnotapartofanylanguage,butaspecificationforuniversalcommunicationsbusesandservices.Itc
7、anrealizetheabilityof"mutualoperation"betweenobjectsimplementedbydifferentlanguages.Thenameofthecommunicationbus,calledORB(objectrequestbroker),isaproductimplementedbyotherdevelopers,butnotpartoftheJavalanguagespecification.JavainherentinterfaceJNIisa
8、nextremelyinclusiveprogramminginterfacethatallowsustoinvokeinherentmethodsfromJavaapplications.ItisaddedinJava1.1,maintainingthecorrespondingcharacteristicofJava1-"inherentmethodinterface"(NMI)-tosomedegreeofcompatibility.SomeofthefeaturesofNM