Practical application of JNI

I don't really understand the need of JNI (Java Native Interface). Because when a code written in a language like C is used, it is pure machine instructions even when called by a call in Java and the execution is totally out of control of the JRE. I hate JNI concept anyway. But can anybody tell me to what extent JNI has practical application?
JNI causes potential security threats as well as hampers portability. I don't see any meaning in using JNI when Java by itself has such a powerful library.
Any suggestions?
VJ

At some point the standard java libraries that do I/O
or graphics MUST take to the host operating system,
and they do this by JNI.But is'nt the class System sufficient enough to get all the host systems/ details? I mean, since the System class encapsulates the System run-time environment, what other functionalities caould there be?
>
So without JNI, java could not function, except on a
machine that interpets bytecode directly.Well if its an applet, it does not matter if the machine does or does not have any JVM. If its an application that needs to be run, then obviously we would make sure that the system that on which any Java application needs to be deployed on has a JVM and JRE is'nt it? I am telling this because I had programmed a TINI (Tiny InterNet Interface) chip to act like a Remote Temperature measurement instrument over the inetrnet. This had a JVM already integrated into the System. So, I found it more than enough to use the System and I/O classes (along with the java.net package). Is there also a possiblity that Java applications will be sometimes expected to run on Systems even without a JVM?
>
Personally I have used JNI to give my programs access
to the telephony facilities available in Windows,
allowing my programs to make and receive telephone
calls over the internet.Wow! You seem like a high profile guy!...just like xiarcel!
Vijay :-)

Similar Messages

  • How can i call a VB6 project from my java application using JNI

    hi
    can anyone tell me the procedure of calling a VB6 project from any java application using JNI
    if anyone does know then tell me the detail procedure of doing that. I know that i have to create a dll of that VB6 project then to call it from the java application.
    if anyone know that procedure of creating dll file of an existing VB6 project please reply
    please if anyone know then let me know

    Ahh, kind of a duplicate thread:
    http://forums.java.sun.com/thread.jspa?threadID=631642
    @OP. You could have clarified your original post and the relationship of your question to java. You did not need a new thread.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Error running SendMail when launch application from JNI

    Hello,
    I am getting the following exception when I try to send email using JavaMail. This error began happening when we upgraded to Java 1.6. It does not happen with earlier versions of Java.
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
         javax.mail.MessagingException: IOException while sending message;
    nested exception is:
         javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_2882193.1230049431911"
    I have browsed through the forums and read the many postings with a similar error. I have tried the variety of suggestions, but nothing seems to work. My understanding is the JAF is included in Java 1.6, so we should not need the activation.jar in our classpath anymore. Even so I have tried with and without the activation.jar in the classpath. I do not think it is a class loader issue because we do not build any of this into our application. It is all referenced in jar files on the classpath.
    The interesting thing is that I can launch the application with a normal JVM launch and it works just fine. The error only occurs when I launch the application from a C++ application using JNI. In both cases I am using the exact same classpath. The error occurs whether I include activation.jar in the classpath or not.
    I have tried to programmatically add the MIME types using the MailCommandMap class, but this had no effect.
    The most recent test I ran was to put the activation.jar and mail.jar files in my C:\Java\jre6\lib\endorsed directory. This actually cleared up the error. This is not a viable solution for us, but it leads me to believe the .mailcap file is not being loaded correctly for some reason. I just cannot figure out what the issue could be as it seems to be associated with JNI.
    Thank you for any help,
    Mary Kathryn

    Because JAF is now part of the JDK, the JAF classes are loaded by the system class loader
    instead of the application class loader. If the thread's context class loader is not set, JAF
    uses its class loader to load the mailcap files. Since JavaMail's mailcap file is in mail.jar,
    and mail.jar is still loaded by the application class loader, the system class loader can't
    find JavaMail's mailcap file.
    Normally, when starting the application using the "java" command, the thread's context
    class loader will be set to the application's class loader. This may not be happening
    automatically when starting the application with JNI.

  • Remote-Conrol a COM-Application via JNI Error: RPC_E_WRONG_THREAD

    hi,
    we have written a DLL which launches and remotecontrols an application via Microsoft COM. This DLL is called by a Swing-GUI-Application via JNI. It works fine over years. Now we have rewritten our application as an rcp-plugin. The COM-Appplication still launches fine, but when I call a COM-function of the remote-controlled application i get back an error:
    RPC_E_WRONG_THREAD
    ...which means that the wrong threading model is used. Does anyone know about differnt threading models of a swing application and an rcp-plugin?
    thanks for your help
    robert

    Kapila_Shantha wrote:
    But they are saying that they can use and do program using it but they are using RHEL 4 . They are wrong.
    A well done JNI library, regardless of how it is used, should not cause system exceptions.
    That would be true whether you created the library or whether someone else creates it.
    Although if they don't wish to certify it for specific configurations then that could be the cause. If that and only that is the cause then you are out of luck.
    If the real problem is that you are using it incorrectly (which should still not cause that problem) then you need to figure out how to use it correctly.

  • Best Practice: Application runs on Extend Node or Cluster Node

    Hello,
    I am working within an organization wherein the standard way of using Coherence is for all applications to run on extend nodes which connect to the cluster via a proxy service. This practice is followed even if the application is a single, dedicated JVM process (perhaps a server, perhaps a data aggregater) which can easily be co-located with the cluster (i.e. on a machine which is on the same network segment as the cluster). The primary motivation behind this practice is to protect the cluster from a poorly designed / implemented application.
    I want to challenge this standard procedure. If performance is a critical characteristic then the "proxy hop" can be eliminated by having the application code execute on a cluster node.
    Question: Is running an application on a cluster node a bad idea or a good idea?

    Hello,
    It is common to have application servers join as cluster members as well as Coherence*Extend clients. It is true that there is a bit of extra overhead when using Coherence*Extend because of the proxy server. I don't think there's a hard and fast rule that determines which is a better option. Has the performance of said application been measured using Coherence*Extend, and has it been determined that the performance (throughput, latency) is unacceptable?
    Thanks,
    Patrick

  • Can I control windows Application without JNI?

    Hi,
    I knew that in JDK1.3 or JDK 1.4, the Robot(java.awt.Robot) support sending to front Application of Windows OS.
    In other words, It cant send to specific window of Application. In other to do it, I never touch the other Application using mouse or key directly. Finally, I think Robot class just has the limited control.
    also Robot class has the screen capture function. but it is doing in Full screen of Windows although I wanna capture active window of ONE application.
    Isnt JDK 1.4 supported?
    Do I just capture window image using JNI?
    Let me know... wish your help.

    Install Windows on a partition of your Mac's hard drive using Boot Camp. You can then boot into Windows any time you want, the same as if you were running it on a Windows PC:
    http://www.apple.com/support/bootcamp/
    Run a "virtual environment" within your Mac OS. There are many solutions for this:
    https://www.virtualbox.org/
    http://www.parallels.com/products/desktop/
    http://www.vmware.com/products/fusion/overview.html
    ...and many others.

  • DLL file to be integrated in Java/J2EE application using JNI interface.

    Hey,
    I am able to make a .h file from Java Class. Now I am not able to compile .c file because the eclipse IDE is complaining
    UNRESOLVED INCLUSION <stdio.h> etc...
    1. I have downloaded MinGW. How do I include in Classpath? OR Could you give me any ideas as to how to proceed from here?
    2. How do I get .DLL file?
    3. How do I integrate(which folder etc...) in a web application the .DLL file which gets produced thereafter?
    Thank you very very much.

    Reinstalling the driver is the first course of action with such problems. Seems the file has gone somehow from your system. How that could happen would be another interesting question, that nobody else but you can answer.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to use the direct bytebuffer in JNI? Accessing JDBC from C application.

    I am working on a project to access JDBC Driver within C application. The invocation JNI is used.
    To get better performance, I use the preparedStatement for dynamic sql. This need to transfer much parameter data from C to JDBC for PreparedStatement object in JVM. I think this maybe get improvements by using the new direct bytebuffer function from JDK1.4. However I cannot find an example code to get start. Could someone provide some ideas for this?
    Currently, I directly call JDBC API in C application through JNI, so there is no java codes. Only c file using JNI call.
    My understanding is to use the direct bytebuffer feature, I also need to have java codes to process the JDBC API call and then can share the same memory between Java and C. Please correct me if wrong.
    Any input is appreciated.

    tzhouxian wrote:
    thanks, jschell
    I am trying to get the best performance for the solution, using JDBC libs in a C application. So I am considering to use the direct bytebuffer in the solution to pass parameters to JDBC and get result sets from JDBC side.
    For your questions,
    1. Why don't you just write the database access in C?
    You mean to directly call JDBC API in C through JNI, right? My plan is to wrap the JDBC API by java and expose seldom interface to C native code, so reduce the JNI call between C and JAVA. If directly call the JDBC API call from C, the number of JNI call maybe more.
    No I mean what I said. In C, no java at all, why don't you write code to access the database?
    2. The database access itself is going to be slower than anything that you do in C or java.
    Exactly. I just want to find each potential points to get performance improvements for the whole solution. I also did some optimization work for the database call. The goal is to get the best performance from C application to database through JDBC libs.
    Then I suggest you profile it.
    3. Why don't you use import/export files and the database tools? This is often significantly faster with volume processing.
    Sorry, I am not very familar with some functions of JNI. Could you explain, " +Why don't you use import/export files and the database tools+"?
    Nothing to do with java, jni nor C.
    Major (or perhaps everything that is a real 'database') comes with additional tools. Amounst those tools will be command line tools capable of importing and exporting data from the database. In processing bulk data they will always be faster than anything you can do in JDBC.

  • Anyone can prove JNI is safe? My application crashes after many calls.

    I heard that JNI is not safe. In fact I made an application base on many JNI calls.
    C level is API supplied by IBM. And I was told the C API is tested and safe.
    Java application and JNI calls is writen by myself. It crashed after about 3000 times call. I tried other JDK and other OS. On some platform, the thread hold there after many calls. No error, no crash. But others crashed even early.
    Here's my JNI call's code:
    JNIEXPORT void JNICALL Java_com_ibm_mm_sdk_cim_internal_PServiceFACImp_cEvaluate
    (JNIEnv *env, jclass jobj, jlong jhandle, jstring jmanualedListFilename, jstring jclassedListFileName, jstring jresultFilename){
         char *manualedListFilename = jstringToWindows(env, jmanualedListFilename);
         char *classedListFileName = jstringToWindows(env, jclassedListFileName);
         char *resultFilename = jstringToWindows(env, jresultFilename);
         int rc;                         // API return code
         void* handle;               // FAC Handle
         // convert C pointer from java long type
         handle = (void*)jhandle;
         rc = KmFAC_Evaluate(
              handle,                                   // FAC Handle
              (char*)manualedListFilename,     // File name of list of files
              (char*)classedListFileName,          // File name of list of files
              (char*)resultFilename               // Result file
         if (manualedListFilename)
              free(manualedListFilename);
         if (classedListFileName)
              free(classedListFileName);
         if (resultFilename)
              free(resultFilename);
         if (rc != KM_RC_OK) {
              //Throw exception
              jclass exceptClass;          // JNI exception class
              char errorMsg[256];          // Used to build error msg for exceptions
              jmethodID methodid;          // Exception constructor method id
              sprintf(errorMsg, "KmFAC_Evaluate() [CKM=%d]", (int)rc);
              exceptClass = env->FindClass("com/ibm/mm/sdk/cim/DKServiceExceptionCIM");
              methodid = env->GetMethodID(exceptClass,"<init>","(Ljava/lang/String;II)V");
              jstring str = env->NewStringUTF(errorMsg);
              jthrowable excobj = (jthrowable)env->NewObject(exceptClass,methodid,str,100, (int)rc);
              env->Throw(excobj);
         return;

    I agree with fury88. Try the code below it works fine!
    // **************** Java portion ************************
    public class Test {
    // Load the dll that exports functions callable from java
    static {System.loadLibrary("TestImp");}
    // Imported function declarations
    public native void print(String msg);
    public void Test() {
    public static void main(String [] args) {
    Test t = new Test();
    // Printf example
         t.print("->Testing JNI - Hello from c++\n");
    // **************** Windows portion - TestImp.dll **********************
    // Exported function
    JNIEXPORT void JNICALL Java_Test_print(JNIEnv *env, jobject obj, jstring msg)
    const char *str = env->GetStringUTFChars(msg, 0);
    printf("%s\n", str);
    env->ReleaseStringUTFChars(msg, str);
    // Entry point
    BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
         switch(ul_reason_for_call)
              case DLL_PROCESS_ATTACH:
                   return TRUE;
              case DLL_PROCESS_DETACH:
                   return TRUE;
    return TRUE;
    }

  • Can i run java applications in native code (JNI) using IBM J9

    Hi,
    If i use IBM J9 for windows mobile 5.0, can i call java in C applications using JNI. Does J9 have AWT native interface support to embed java GUI in native window.
    thanks and regards,
    Vishnu

    I am also interested in the answer to these questions.

  • Best practice for moving from a G5 to a new Mac with SL

    I am receiving my new iMac today (27") and am very excited
    However I want to move over using the best practices to assure that I remain excited and not frustrated
    My initial thoughts are to boot it up and doe the initial set up - to move my iPhoto library over and to use migration assistance to move the rest of my data files
    Then to install all of the extra software that I can find the packages for from the original installation disks
    And then finally to use migration assistant again to move over any software that I can not find original disks for (I've moved from Mac to Mac to Mac over and over and some of the software goes back to OS 9 (and won't run anymore I guess)
    Is this a good way
    OR
    will I mess up doing it this way
    OR
    am I spending far too much time worrying about moving old problems over and would be better off to just turn MA loose and let it do its thing form the beginning?
    BTW - mail crashes a lot on my existing system - pretty much everything else seems ok - except iPhoto is slow - hoping that the new Intel dual core will help that
    LN

    Migration Assistant is not a general file moving tool. MA will migrate your Applications and Home folders transferring only your third-party applications. MA will transfer any application support folders required by your applications, your preferences, and network setup. You do not have a choice of what will be migrated other than the above. MA cannot determine whether anything transferred is compatible with Snow Leopard. I recommend you look at the following:
    A Basic Guide for Migrating to Intel-Macs
    If you are migrating a PowerPC system (G3, G4, or G5) to an Intel-Mac be careful what you migrate. Keep in mind that some items that may get transferred will not work on Intel machines and may end up causing your computer's operating system to malfunction.
    Rosetta supports "software that runs on the PowerPC G3, G4, or G5 processor that are built for Mac OS X". This excludes the items that are not universal binaries or simply will not work in Rosetta:
    Classic Environment, and subsequently any Mac OS 9 or earlier applications
    Screensavers written for the PowerPC
    System Preference add-ons
    All Unsanity Haxies
    Browser and other plug-ins
    Contextual Menu Items
    Applications which specifically require the PowerPC G5
    Kernel extensions
    Java applications with JNI (PowerPC) libraries
    See also What Can Be Translated by Rosetta.
    In addition to the above you could also have problems with migrated cache files and/or cache files containing code that is incompatible.
    If you migrate a user folder that contains any of these items, you may find that your Intel-Mac is malfunctioning. It would be wise to take care when migrating your systems from a PowerPC platform to an Intel-Mac platform to assure that you do not migrate these incompatible items.
    If you have problems with applications not working, then completely uninstall said application and reinstall it from scratch. Take great care with Java applications and Java-based Peer-to-Peer applications. Many Java apps will not work on Intel-Macs as they are currently compiled. As of this time Limewire, Cabos, and Acquisition are available as universal binaries. Do not install browser plug-ins such as Flash or Shockwave from downloaded installers unless they are universal binaries. The version of OS X installed on your Intel-Mac comes with special compatible versions of Flash and Shockwave plug-ins for use with your browser.
    The same problem will exist for any hardware drivers such as mouse software unless the drivers have been compiled as universal binaries. For third-party mice the current choices are USB Overdrive or SteerMouse. Contact the developer or manufacturer of your third-party mouse software to find out when a universal binary version will be available.
    Also be careful with some backup utilities and third-party disk repair utilities. Disk Warrior 4.1, TechTool Pro 4.6.1, SuperDuper 2.5, and Drive Genius 2.0.2 work properly on Intel-Macs with Leopard. The same caution may apply to the many "maintenance" utilities that have not yet been converted to universal binaries. Leopard Cache Cleaner, Onyx, TinkerTool System, and Cocktail are now compatible with Leopard.
    Before migrating or installing software on your Intel-Mac check MacFixit's Rosetta Compatibility Index.
    Additional links that will be helpful to new Intel-Mac users:
    Intel In Macs
    Apple Guide to Universal Applications
    MacInTouch List of Compatible Universal Binaries
    MacInTouch List of Rosetta Compatible Applications
    MacUpdate List of Intel-Compatible Software
    Transferring data with Setup Assistant - Migration Assistant FAQ
    Because Migration Assistant isn't the ideal way to migrate from PowerPC to Intel Macs, using Target Disk Mode, copying the critical contents to CD and DVD, an external hard drive, or networking
    will work better when moving from PowerPC to Intel Macs. The initial section below discusses Target Disk Mode. It is then followed by a section which discusses networking with Macs that lack Firewire.
    If both computers support the use of Firewire then you can use the following instructions:
    1. Repair the hard drive and permissions using Disk Utility.
    2. Backup your data. This is vitally important in case you make a mistake or there's some other problem.
    3. Connect a Firewire cable between your old Mac and your new Intel Mac.
    4. Startup your old Mac in Target Disk Mode.
    5. Startup your new Mac for the first time, go through the setup and registration screens, but do NOT migrate data over. Get to your desktop on the new Mac without migrating any new data over.
    If you are not able to use a Firewire connection (for example you have a Late 2008 MacBook that only supports USB:)
    1. Set up a local home network: Creating a small Ethernet Network.
    2. If you have a MacBook Air or Late 2008 MacBook see the following:
    MacBook (13-inch, Aluminum, Late 2008) and MacBook Pro (15-inch, Late 2008)- Migration Tips and Tricks;
    MacBook (13-inch, Aluminum, Late 2008) and MacBook Pro (15-inch, Late 2008)- What to do if migration is unsuccessful;
    MacBook Air- Migration Tips and Tricks;
    MacBook Air- Remote Disc, Migration, or Remote Install Mac OS X and wireless 802.11n networks.
    Copy the following items from your old Mac to the new Mac:
    In your /Home/ folder: Documents, Movies, Music, Pictures, and Sites folders.
    In your /Home/Library/ folder:
    /Home/Library/Application Support/AddressBook (copy the whole folder)
    /Home/Library/Application Support/iCal (copy the whole folder)
    Also in /Home/Library/Application Support (copy whatever else you need including folders for any third-party applications)
    /Home/Library/Keychains (copy the whole folder)
    /Home/Library/Mail (copy the whole folder)
    /Home/Library/Preferences/ (copy the whole folder)
    /Home /Library/Calendars (copy the whole folder)
    /Home /Library/iTunes (copy the whole folder)
    /Home /Library/Safari (copy the whole folder)
    If you want cookies:
    /Home/Library/Cookies/Cookies.plist
    /Home/Library/Application Support/WebFoundation/HTTPCookies.plist
    For Entourage users:
    Entourage is in /Home/Documents/Microsoft User Data
    Also in /Home/Library/Preferences/Microsoft
    Credit goes to Macjack for this information.
    If you need to transfer data for other applications please ask the vendor or ask in the Discussions where specific applications store their data.
    5. Once you have transferred what you need restart the new Mac and test to make sure the contents are there for each of the applications.
    Written by Kappy with additional contributions from a brody.
    Revised 1/6/2009
    In general you are better off reinstalling any third-party software that is PPC-only. Otherwise update your software so it's compatible with Snow Leopard.
    Do not transfer any OS 9 software because it's unsupported. You can transfer documents you want to keep.
    Buy an external hard drive to use for backup.

  • MVC model in Web systems and applications

    MVC model in Web systems and applications
    Object-oriented design model is experience, MVC idea is a user interface for the original. This article discusses how the major application areas in the new Web design patterns and the use of MVC framework. The article first introduced the concept of design patterns and characteristics, and MVC architecture design concepts and analysis of the MVC framework contains several key models. Based on the characteristics of Web applications on how to use patterns and MVC framework made some design ideas.??
    1. Introduction
    1.1 design model
    Object-oriented technology and the emergence of software applications has greatly enhanced the trusted and software quality. Object-oriented programming than previous models to various programming simple and efficient, but the object-oriented design methodology than the previous design methods to complex and much more skill, a good design should be both on the issue of gender, but also to take full account of the problems and needs sufficient interoperability. In the past 10 years, people in the object-oriented technology and the practical application of research to explore certain issues in relation to the creation of a number of good solutions, the so-called object-oriented design patterns. Object-oriented technology is one of the purposes of enhancing the software trusted, and to design model, design programmes in important positions from a deeper sense of meaning and essence embodies trusted. There are many people in the design model definition, which cited Christopher Alexander is the largest design model definition : Each design model is a tripartite rule, which expresses a contextual environment (Context), a problem and a solution. Design models generally following basic elements : model name, the purpose solution effect 1995-1998 code and related design models. There are several classifications design patterns can be divided into a model based on the purpose (Creational), structural type (Structural) and the type of behaviour (Behavioral) three. It is mainly used in the creation of a model-based object model-based structure to deal primarily with the category or combination of objects, used to describe behavior-based model is the main target for the category or how stress and how to allocate responsibilities. Design patterns can be divided into categories based on the scope and target mode model type model dealing with the relationship between the categories and sub-categories, these relations through the establishment of succession in Translation moment to be finalized, are static. Model is targeted at addressing the relationship between the moment of change these relations in the operation, more dynamic. Model features : through the experience acquired in a structured format to write down, avoid encountering the same problems on the first design, exist in different abstract level, in continuous improvement, can be trusted artificial product for the design and best practice in the world to be combined to address larger issues.
    1.2 MVC framework
    MVC was first used in a user interface Smalltalk-80 China. M representative models Model, representatives maps View V, C representatives controller Controller. MVC trusted code with the aim of increasing the rate of data reduction expressed, the data describing the operation and application coupled degrees. Also makes software Keweihuxing, restorative, expansionary, flexibility and packaging of greatly enhanced. Single-user applications are usually incident-driven user interface to the organizational structure. Staff development tool with an interface painting of a user interface interface code based on user input and then prepare to implement the corresponding moves, many interactive development environment encouraged to do so, because it emphasizes first and then a functional interface. Some software design model is the strategy that will be fixed before the code into the regular system of the final. Result is that the procedures and organizations around the user interface elements in the user interface elements of those moves, data storage, applications and functions of the code is used to indicate the way intertwined. In single-user system code structure can be so, because the system will not demand frequent changes. But for a large system such as large Web systems, or e-commerce systems to be applied. Model by incorporating data from a variety of access and control data can be separated to improve distributed system design. MVC design pattern is composed of three parts. Model is the application object, no user interface. Type in the screen showing that it represents the flow of data users. Controller user interface definition response to user input, the users responsible for the action against the Model into operation. Model View data updated to reflect the adoption of data changes.
    2. MVC design pattern,
    An MVC framework for the design of the system includes many models, but with MVC is most closely related to the following three models : Observer, Cambridge and Strategy.
    2.1 Observer models
    MVC through the use of purchase / notification form and the separation of the Model View. View to ensure that their content accurately reflected Model and state. Once Model content changes, there must be a mechanism to allow notification to the relevant Model View, View can be made relevant at the appropriate time updating of data. This design is also more general problems can be solved, the target separation, making a change to the target audience affect others, which targets those who do not know the details of the object being affected. This is described as Observer in the design model. Model type : Observer model is the object-oriented model, it is behaviour-based model. Model purposes : definition of hierarchical dependence relations between objects, or when a target value of the state change, all its dependent relationship with the object are notified and automatically updated. There are a variety of data may show a way, in different ways and may also show. When a way through a changed data, then the other should be able to show immediately that the data change and do accordingly.
    Effect :
    1. Abstract coupling. I only know that it has a target audience of some observers, the observers met each abstract Observer category simple interface, does not know their specific affiliation categories. This makes the coupling between goals and observers smallest and abstract.
    2. Support radio communications. Needless to notify designated observers goals, how to deal with the observer informed decisions.
    3. Possible accidents updated. We update logic, avoiding mistakes updated.
    2.2 Faculty model
    MVC is an important feature of View can nest. Nest can be used for any type of combination of local maps available, but also management of type nest. This thinking reflects the type and mix of components will be equal treatment design. This object-oriented design ideas in the area of Cambridge has been described as a design model. Model types : Cambridge model is the object-oriented model, it is also the structure type model. Model purpose : to target portfolio into tree structures to express "part-whole" level structure. Prepared for the use and combination of individual target audiences with the use of consistency.
    Effect :
    1. Definition of a target portfolio includes simple objects and the structure of the category level. Simple objects may be complex combinations of objects, and can be targeted portfolio mix. This customer-code used in the target areas can use simple combinations target.
    2. Simplify customer-code. Needless to know their customers - a mix of target audiences is a simple target or can use these items in a consistent manner.
    3. Easier to add new types of components. New components can easily be changed to a combination of customer-targeted codes.
    2.3 Strategy model
    Another important characteristic is the MVC can not change the View of changes View response to user input. This often requires a change in response to the logic of the system is very important. MVC to respond to the logic involved in the Controller. Controller of a category level structure could easily change to the original Controller appropriate, a new Controller. View Controller son used to achieve a specific example of such a response strategy. To achieve different response strategy, as long as examples of the use of different types of replacement will Controller. Also in the running time by changing the View Controller for users to change View of response strategies. This View-Controller relationship was described as an example of Strategy design pattern. Model types : Strategy model is the object-oriented model, it is behaviour-based model. Model purposes : definition of a series of algorithms, and their packaging, and ensure that they can replace each other, making algorithms can independently use its customer-change.
    Effect :
    1. Strategy category levels for Context definition of the relevant algorithms can be trusted or behaviour.
    2. Alternative methods of succession. If the direct successor Context, with different acts will be added Context act, the realization of which would algorithm mixed up with Context, Context hard to preserve and expand, but can not dynamically changing algorithms. Will be enclosed in a separate Strategy category algorithms to enable algorithm independent Context change easily cut over expansion.
    3. Can provide the same acts different date.
    4. Strategy-must understand what customers between different.
    5. Context and Strategy communications between costs.
    6. An increase in the number of targets.
    3. MVC in Web application system
    Now some of the distributed systems such as Web-based B2B e-commerce system, suitable for use MVC framework. Through analysis from the perspective of high-level applications can be a target divided into three categories. Category is shown for the target audience consists of a group of commercial rules and data, there is a category that is receiving requests to control commercial target to complete the request. These applications often need to change is shown, such as web style, color, but also need to demonstrate the contents of the display. And the business rules and data to be relatively stable. Therefore, said that the frequent need to change the View objects that the business rules and data model to be relatively stable target, and that the control of the Controller is the most stable. When the system is usually issued after the View objects by artists, designers or HTML/JSP system managers to manage. Controller target applications development personnel from the development and implementation of rules for commercial and business development personnel from the target data, database managers and experts in the field of common completed. Show in Web?? or customers - control logic can be Servlet or JSP, dynamically generated Html. Generally used Servlet better than using JSP. JSP will be better with the Html code of separate codes for page designers and developers of separation efficiency. Servlet and JSP can complete all complete functions, actually JSP eventually converted into a Servlet. And control of the target system exists in every level, the coordination of cross-layer moves. Contain business rules and data objects exist in the EJB layer (EJB-centred model) or Web?? (Web-centred model).
    3.1 View in the Web application system
    View of the system shows that it fully exist in Web??. General by JSP, Java Bean and Custom Tag. JSP can generate dynamic web content using Java Custom Tag easier Bean, but it can show the logic of packaging, and more conducive to modular trusted. Some well-designed in a number of JSP Custom Tag can even be used in different system duplication. Model for control of JSP and Java Bean objects. JSP through Java Bean objects to retrieve the data model, the Model and Controller object is responsible for updating the data on Java Bean. In general, can we devise all possible screen that users can see all the elements of the system. Based on these elements, to identify the public part of passive components and dynamics. Can consider the use of templates means to separate the content generated JSP public, also need to change their generation Html or JSP from a JSP templates to dynamically introduce these different parts (include methods). Another issue to consider is screen option, when dealing with End users request template automatically available to show that the concern that users must know what is the screen components. So can consider all screens on the definition of a centralized document, such as a document or text document java. Taking into account the possibility of changes in future document definition screens, the best use of text documents such as a XML document, so future changes to the recompilation. According to the URL and user input parameters to shine upon the results of a screen, of course, likely to be made on the basis of the outcome of the implementation of actions to choose different results screen. Therefore, the need for a request for matching resources with document (XML), if a URL request several different results, it must specify in the document need to control the flow (a controller object), as well as the corresponding screen different flows.
    3.2 Model in the Web application system
    Model objects represent business rules and business data exist in EJB layer and Web??. In J2EE norms, the system needs some data stored in the database, such as user account information (account model), the company's data (company model), some not recorded in the database. If a user browsing the current catalogue (catalog model), the contents of his shopping (shopping cart model). Which one of these models exist in the data according to their life cycle and scope to decide. In Web?? a HttpSession and ServletContext and Java Bean objects to store data in the EJB layer is a data storage and logic EJB to. Web?? the Java Bean objects stored in the model layer model of the EJB object data copy. Because there are many different EJB tier model targets, so Web?? through a ModelManager to control the EJB layer object model in ModelManger background model can be used for packaging methods. In the EJB layer and the rules have all the data into EJB model is inappropriate. If the database can visit the Dao object model into objects. Dao can be encapsulated and the specific details of the database in the world, if we can write a different table, a number of databases, or even multiple databases. If the orders can be a model for OrderDAO, it may have to deal with Order table, table and OrderItemLines OrderStatus table. Value can also consider the use of targets. Value can be a target of securing long-range targets, because every time the remote object attributes could be a long-range redeployment process will consume network resources. EJB objects in the distance can be used instead target. In the distance, one-time items to be targeted instead of the value of all attributes.
    3.3 Controller in Web application system
    Coordination with the Model View Controller object to the request of users into the system to identify incidents. In Web?? generally a MainServlet (or Main.jsp), and receiving all requests, it can use screen flow management devices (ScreenFlowManger) decided next screen. There is a general request processors RequestProcessor contains all requests are needed to be done to deal with logic, such as the request translated into system events (RequestToEvent). Acting processors usually also includes a request for ClientControlWebImpl, it is logical to deal with the EJB layer in Web?? Acting. In EJB layer, a layer for EJB tier Web ClientController provide the CD visit. Another StateMachine used to create and delete ejb handle Web?? sent to the incident. Controller Another important function is synchronous View and Model data. ModelManger contained in a ModelUpdateManger, it puts events into a Model System assembly that all the needs of synchronous Model, and then notify Listeners do synchronous operation.
    4. Concluding remarks
    In recent years, with the Internet technology development and the emergence of new business models, the Web is based on a large number of applications. On how to design these systems architecture, and gradually there has been some convergence of opinion, the most important point is that its structure should be rational in the open. Demand than ever faster development of technology and design concepts, systems for the future, the cost of upgrading the smallest, research software systems architecture still very useful and necessary.

    Bravo. And your point is?

  • IMac applications/data transfer

    I just unpacked and activated my new iMac and wish to transfer to this new iMac all of my applications and data files that are imbedded in my old eMac, including Quicken 2004 for Mac, Adobe Photoshop CS2, Adobe Bridge, iWork'08 and Apple Works 6. Since I don't have a firewire cable with an 400 Mb/sec plug on one end and a 800 MB/sec plug at the other end I am unable to use the Setup assistant to help me in transferring my applications. Can I use an Ethernet cable to accomplish this transfer. Also, must I install OS X 10.4.11 in my new iMac in order to run some of the older applications like Quicken and Apple Works? Any help will be greatly appreciated by this old (81 ys) man.

    Hmmm, not a good idea. Most of your applications are too old to work. You will need to locate and download upgrades to Leopard compatible versions where available. This includes replacing CS2 apps with CS3 or CS4 (preferably the latter) versions. Not sure that Quicken has a compatible version but you can check Intuit's site. You may need to find a replacement such as Tax Cut. Replace AppleWorks with iWork '09, although iWork '08 will work. If you plan to continue using AppleWorks you will need to download the AppleWorks 6.2.7 OS X version. It may continue to work tolerably with Leopard.
    You cannot install Tiger on the new iMac. Don't even try.
    You can connect the two computers vis Ethernet or if you have a home network both computers could be connected to your router either by Ethernet or wirelessly if the router supports wireless. Select Mac Help from the Finder's Help menu and search for "sharing" or "file sharing" for help with this. However, for your personal data files you may find it's easier to transfer them to a USB flash drive then copy them from the flash drive. Alternatively, backup the hard drive on your eMac to an external FireWire or USB drive in order to transfer your files.
    Be careful about what your chose to transfer because there's a world of difference between a PPC and an Intel Mac as well as between Tiger and Leopard. See the following:
    A Basic Guide for Migrating to Intel-Macs
    If you are migrating a PowerPC system (G3, G4, or G5) to an Intel-Mac be careful what you migrate. Keep in mind that some items that may get transferred will not work on Intel machines and may end up causing your computer's operating system to malfunction.
    Rosetta supports "software that runs on the PowerPC G3, G4, or G5 processor that are built for Mac OS X". This excludes the items that are not universal binaries or simply will not work in Rosetta:
    Classic Environment, and subsequently any Mac OS 9 or earlier applications
    Screensavers written for the PowerPC
    System Preference add-ons
    All Unsanity Haxies
    Browser and other plug-ins
    Contextual Menu Items
    Applications which specifically require the PowerPC G5
    Kernel extensions
    Java applications with JNI (PowerPC) libraries
    See also What Can Be Translated by Rosetta.
    In addition to the above you could also have problems with migrated cache files and/or cache files containing code that is incompatible.
    If you migrate a user folder that contains any of these items, you may find that your Intel-Mac is malfunctioning. It would be wise to take care when migrating your systems from a PowerPC platform to an Intel-Mac platform to assure that you do not migrate these incompatible items.
    If you have problems with applications not working, then completely uninstall said application and reinstall it from scratch. Take great care with Java applications and Java-based Peer-to-Peer applications. Many Java apps will not work on Intel-Macs as they are currently compiled. As of this time Limewire, Cabos, and Acquisition are available as universal binaries. Do not install browser plug-ins such as Flash or Shockwave from downloaded installers unless they are universal binaries. The version of OS X installed on your Intel-Mac comes with special compatible versions of Flash and Shockwave plug-ins for use with your browser.
    The same problem will exist for any hardware drivers such as mouse software unless the drivers have been compiled as universal binaries. For third-party mice the current choices are USB Overdrive or SteerMouse. Contact the developer or manufacturer of your third-party mouse software to find out when a universal binary version will be available.
    Also be careful with some backup utilities and third-party disk repair utilities. Disk Warrior 4.1, TechTool Pro 4.6.1, SuperDuper 2.5, and Drive Genius 2.0.2 work properly on Intel-Macs with Leopard. The same caution may apply to the many "maintenance" utilities that have not yet been converted to universal binaries. Leopard Cache Cleaner, Onyx, TinkerTool System, and Cocktail are now compatible with Leopard.
    Before migrating or installing software on your Intel-Mac check MacFixit's Rosetta Compatibility Index.
    Additional links that will be helpful to new Intel-Mac users:
    Intel In Macs
    Apple Guide to Universal Applications
    MacInTouch List of Compatible Universal Binaries
    MacInTouch List of Rosetta Compatible Applications
    MacUpdate List of Intel-Compatible Software
    Transferring data with Setup Assistant - Migration Assistant FAQ
    Because Migration Assistant isn't the ideal way to migrate from PowerPC to Intel Macs, using Target Disk Mode, copying the critical contents to CD and DVD, an external hard drive, or networking
    will work better when moving from PowerPC to Intel Macs. The initial section below discusses Target Disk Mode. It is then followed by a section which discusses networking with Macs that lack Firewire.
    If both computers support the use of Firewire then you can use the following instructions:
    1. Repair the hard drive and permissions using Disk Utility.
    2. Backup your data. This is vitally important in case you make a mistake or there's some other problem.
    3. Connect a Firewire cable between your old Mac and your new Intel Mac.
    4. Startup your old Mac in Target Disk Mode.
    5. Startup your new Mac for the first time, go through the setup and registration screens, but do NOT migrate data over. Get to your desktop on the new Mac without migrating any new data over.
    If you are not able to use a Firewire connection (for example you have a Late 2008 MacBook that only supports USB:)
    1. Set up a local home network: Creating a small Ethernet Network.
    2. If you have a MacBook Air or Late 2008 MacBook see the following:
    MacBook (13-inch, Aluminum, Late 2008) and MacBook Pro (15-inch, Late 2008)- Migration Tips and Tricks;
    MacBook (13-inch, Aluminum, Late 2008) and MacBook Pro (15-inch, Late 2008)- What to do if migration is unsuccessful;
    MacBook Air- Migration Tips and Tricks;
    MacBook Air- Remote Disc, Migration, or Remote Install Mac OS X and wireless 802.11n networks.
    Copy the following items from your old Mac to the new Mac:
    In your /Home/ folder: Documents, Movies, Music, Pictures, and Sites folders.
    In your /Home/Library/ folder:
    /Home/Library/Application Support/AddressBook (copy the whole folder)
    /Home/Library/Application Support/iCal (copy the whole folder)
    Also in /Home/Library/Application Support (copy whatever else you need including folders for any third-party applications)
    /Home/Library/Keychains (copy the whole folder)
    /Home/Library/Mail (copy the whole folder)
    /Home/Library/Preferences/ (copy the whole folder)
    /Home /Library/Calendars (copy the whole folder)
    /Home /Library/iTunes (copy the whole folder)
    /Home /Library/Safari (copy the whole folder)
    If you want cookies:
    /Home/Library/Cookies/Cookies.plist
    /Home/Library/Application Support/WebFoundation/HTTPCookies.plist
    For Entourage users:
    Entourage is in /Home/Documents/Microsoft User Data
    Also in /Home/Library/Preferences/Microsoft
    Credit goes to Macjack for this information.
    If you need to transfer data for other applications please ask the vendor or ask in the Discussions where specific applications store their data.
    5. Once you have transferred what you need restart the new Mac and test to make sure the contents are there for each of the applications.
    Written by Kappy with additional contributions from a brody.
    Revised 1/6/2009

  • JNI native threads causing JRE to fail to shut down?

    Hello,
    I am using JNI to communicate with a COM object. I am reasonably certain at this point that my JNI code is handling this properly and the third party COM library is releasing the object in question. We allocate and release hundreds of these objects and we aren't observing any memory leaks. Likewise in our handling of events we receive from the COM object. We attach the thread to Java, deliver the event, and then detach the thread from Java, with very careful error handling around the event delivery to ensure that whatever else happens the detach gets called. This code is very robust and stable in operation and has been working at load in the field for over a year now without any customer problems in the JNI area.
    However, since day one, when I go to shut down the application, the JNI isn't winding down properly. As it happens, since the JRE is running a Tomcat, driven by a wrapper service, the wrapper eventually gives up waiting and shoots the JRE in the head, but the user experience of stopping the wrapper service is ugly and we'd like to clean that up. The JNI code, of course, runs as shared code in the Tomcat.
    It is possible that the third-party library, which does network communications, is keeping a thread pool for use with any of the COM objects even after all COM objects are released. This would be experienced as a one-time hit when the first object is allocated and not as a continual leak, so we'd be unlikely to notice it otherwise.
    Will native non-Java threads running in the JRE but not allocated by the JRE itself cause the JRE to hang on until they've spontaneously decided to clean themselves up? Threads that have never been attached to the JVM? How about threads that were briefly attached to the JVM but then detached? Any worse?
    Ralph

    Hi Ralph,
    I will need some more information regarding this issue.
    1. What platform are you on?
    2. Which JRockit version are you running?
    3. If you remove the wrapper service, does JRockit freeze without exiting properly?
    As a general recommendation I would try to upgrade to the latest JRockit version. It can be downloaded from the OTN http://www.oracle.com/technology/software/products/jrockit/index.html
    You may also try some verbose printouts to debug the issue a little further. Try
    -Xverbose:thread=debug,jni=debug
    This might give us some more insight in what is going on.
    Also when JRockit freezes you can output a Java stack trace using our 'jrcmd' tool which you can find in the same folder as the java executable. Run this tool without any parameters and it will output identifiers (numbers) for every running JRockit instance on your machine. Run the same tool again, this time append the identifier you believe is the one running the Tomcat and add the command 'print_threads', ie
    jrcmd <some_id_here> print_threads
    This may show what JRockit is waiting for.
    Cheers,
    /Henrik

  • JNI and J2ME

    Hello all. These days i've been asked to make a little aplication for a PDA and while looking for information about j2me it says jni its not supported. But the app i need to make needs to use some library written in C, and my question is if there is any way o making an application in j2me that can use those libraries.
    Thanks all.

    Yes i've found a compiler for my target platform and compiling and running the C libraries doesnt seem a problem at the time. My main problem is that I can't call them from my java application because jni is not supported and i dont know how to import them.
    Thanks for your answer
    Message was edited by:
    trospito

Maybe you are looking for

  • Problem with iPhone and built in camera

    As others have expressed in this forum, I have a similar concern, working at a defense company where cameras are not allowed. As cool as the iPhone is, I would want to show it off to my peers, and it is not worth getting fired for if Security discove

  • Premiere Elements 8 - "not compatible with Premiere Pro"?

    I have installed, uninstalled, and reinstalled Premiere Elements 8 program twice. Updated to 8.01. When I save a "new project" file, then try to open it with the same program I created it with (Elements 8), it will not open the file and says: "Projec

  • Problem with NETWORK_CHANGE

    I used this code in Flash CS4 and it worked. Now using Flash Builder 4.0.1, AIR 2.0.2 on a Mac OS 10.6.4 and I get an error. NativeApplication.nativeApplication.addEventListener(Event.NETWORK_CHANGE, onNetworkChangeHandler); private function onNetwor

  • Require to validate the xml

    I have two requirements: 1. to Validate the xml to follow a predefined structure - this is done. 2. to validate the xml on basis of some conditions - this is to be done. To eleborate, suppose i have a xml structure such as: <books>   <book>       <au

  • I have a g5 desktop and I am having an issue with it turning off while im using it. I think it may be something to do with the cooling system

    I am wondering what could be causing my computer to shut off while i'm using it. I think it is something to do with the cooling system because it feels hot to the touch and will not turn back on for awhile until it cools down