JNI Question 2

Hello again,
I am seeing an intermittent error come up that's hanging my application. This is occurring when I make the following call into my cocoa library using Java JNI:
JNIEXPORT jint JNICALL JavaMacTaskTrayIconcreateTaskTrayIcon(JNIEnv* env, jobject caller, jstring iconFilePath)
NSStatusItem * statusItem = [[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength];
Here's the error I see:
2006-07-18 10:02:49.821 java[6511] * Assertion failure in -[NSViewHierarchyLock unlockTopMostReader], AppKit.subproj/NSViewHierarchyLock.m:444
2006-07-18 10:02:49.822 java[6511] Apple AWT Startup Exception : Invalid parameter not satisfying: th
2006-07-18 10:02:49.822 java[6511] Apple AWT Restarting Native Event Thread
I've elminated all other code in my cocoa library and still get the problem, so I have isolated the problem to the one call listed above.
Since this error occurrs intermttently, I think that it's some kind of threading issue. When java calls into JNI, should I move the NSStatusItem creation call to some other privileged thread, or do I need to acquire some kind of lock before making the call?
Any input would be appreciated.
Many Thanks,
Patrick Arnesen
VivraTerra Software Corp.
  Mac OS X (10.4.6)  

Hi
A google search of this error indicates that it appears from time to time and can be quite difficult to tie down, however, it appears to have nothing to do with JNI.
On one forum I saw this comment in relation to this error:
"The most common cause is unmatched -[NSView unlockFocus] invocations."
http://www.cocoabuilder.com/archive/message/cocoa/2006/1/11/154180
If this can shed some light on your problem then great, otherwise I suggest you put the error message into google and see if the responses can help you.
Good luck
Bob

Similar Messages

  • JNI Question

    hope someone can help me with this because I have to get this working today. I am pulling my hair out, and I have little to begin with.
    I am trying to compile the C program, invoke.c, that comes as part of the "Invoking the Java Virtual Machine" tutorial. The issue I am having trouble getting past is: On Solaris I am getting the following errors:
    invoke.c:23: request for member `version' in something not a structure or union
    invoke.c:28: request for member `classpath' in something not a structure or union
    invoke.c:29: request for member `classpath' in something not a structure or union
    invoke.c:32: warning: passing arg 2 of `JNI_CreateJavaVM' from incompatible pointer type
    On Windows 2000 with a Visual C++ 6.0 compiler I am getting the following issues.
    #include <jni.h>
    #ifdef _WIN32
    #define PATH_SEPARATOR ';'
    #else /* UNIX */
    #define PATH_SEPARATOR ':'
    #endif
    #define USER_CLASSPATH "." /* where Prog.class is */
    main()
    JNIEnv *env;
    JavaVM *jvm;
    JDK1_1InitArgs vm_args;
    jint res;
    jclass cls;
    jmethodID mid;
    jstring jstr;
    jobjectArray args;
    char classpath[1024];
    vm_args.version = 0x00010001;
    JNI_GetDefaultJavaVMInitArgs(&vm_args);
    sprintf(classpath, "%s%c%s",
    vm_args.classpath, PATH_SEPARATOR, USER_CLASSPATH);
    vm_args.classpath = classpath;
    res = JNI_CreateJavaVM(&jvm, &env, &vm_args);
    if (res < 0)
    fprintf(stderr, "Can't create Java VM\n");
    exit(1);
    cls = (*env)->FindClass(env, "Prog");
    if (cls == 0)
    fprintf(stderr, "Can't find Prog class\n");
    exit(1);
    mid = (*env)->GetStaticMethodID(env, cls, "main", "([Ljava/lang/String;)V");
    if (mid == 0)
    fprintf(stderr, "Can't find Prog.main\n");
    exit(1);
    jstr = (*env)->NewStringUTF(env, " from C!");
    if (jstr == 0)
    fprintf(stderr, "Out of memory\n");
    exit(1);
    args = (*env)->NewObjectArray(env, 1, (*env)->FindClass(env, "java/lang/String"), jstr);
    if (args == 0)
    fprintf(stderr, "Out of memory\n");
    exit(1);
    (*env)->CallStaticVoidMethod(env, cls, mid, args);
    (*jvm)->DestroyJavaVM(jvm);
    }

    It looks like you are not compiling the code with the required header files. Can you cut and paste the command you are executing

  • JNI question about EnumChildWindows

    I originally wrote a java app that would run in Linux and play some video files using MPlayer. MPlayer has an option to take a window id and will pile video through to the window you specify. I was able to use the xwininfo command and a unique window name to create a JFrame in my app to paint the video to.
    When using xwininfo command it gave me 2 child components of the JFrame, the inner most child was the one necessary to use MPlayers -wid feature and successfully view the video.
    Now I am faced with the problem of making this work in windows. I have successfully written JNI code to get the JFrame 's hwnd, unfortunately I can't seem to get EnumChildWindows to work properly. When I call the function the callback never gets called (code below). Are the JFrames different in windows with no child components? or have I missunderstood what the EnumChildWindows function will do? Is there a better function to be using?
    Thanks!
    PS. I know the methods are UGLY. I call getHwndChild( parentHwnd) followed by looping through the getHwndIndex() function while the result != 0 but they are all never anything but 0
    java methods
    public static native int getHwndChild( int parentHwnd );
    public static native int getHwndIndex( int index );JNI code
    int childhwnds[ 100 ];
    int childhwndindex;
    BOOL CALLBACK cwcb( HWND hwnd, LPARAM lparam )
         childhwnds[ childhwndindex ] = ( int ) hwnd;
         childhwndindex = childhwndindex + 1;  
         return TRUE;
    JNIEXPORT jint JNICALL Java_com_laancor_win32_JUtil_getHwndChild(JNIEnv *env, jclass obj, jint parentHwnd, )
         HWND hwnd = NULL;
         const char *str = NULL;
         int i;
         // clear hwnd array
         childhwndindex = 0;
         for ( i = 0; i < 100; i++)
              childhwnds[ i ] = 0;
         EnumChildWindows( (HWND)parentHwnd, cwcb, NULL );
         return (jint) 0;
    JNIEXPORT jint JNICALL Java_com_laancor_win32_JUtil_getHwndIndex( JNIEnv *env, jclass obj, jint index )
        return (jint) childhwnds[ (int)index ];
    }

    I want to show a child window on top of its parent. The parent gets hidden before. When i show the parent again the child is still hidden.
    I try to use JNATIVE.
    Thats the code i tried so far. Of course it's not working.
    Would you explain what I have to do? (I already spend a lot time by searching the internet)
                        Callback c = new Callback() {
                            private int address = 0;
                            @Override
                            public int callback(long[] arg0)
                                // ??? what code here?
                                System.out.println("test");
                                return 0;
                            @Override
                            public int getCallbackAddress() throws NativeException
                                if (address == 0)
                                    address = JNative.createCallback(0, this);
                                return address;
                        boolean succeed = User32.EnumChildWindows(cc.getHandle(), c, 0);
                        JNative.releaseCallback(c); //???Would be very pleased about help. Regards.

  • JNI Question,help me thx!!

    Setp1:
    //Setdisp.java
    class Setdisp {    
    public native static void greeting();
    static {         
    System.loadLibrary("Setdispdll");
    Setp2:
    cmd>javac Setdisp.java
    Setp3:
    cmd>javah Setdisp
    Setp4:
    /*Setdisp.c
    * DO NOT EDIT THIS FILE - it is machine generated
    #include <jni.h>
    #include <windows.h>
    /* Header for class Setdisp */
    #ifndef IncludedSetdisp
    #define IncludedSetdisp
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: Setdisp
    * Method: greeting
    * Signature: ()V
    JNIEXPORT void JNICALL Java_Setdisp_greeting
    (JNIEnv * env, jclass cl) {
    DEVMODE Mode;
    EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &Mode);
    Mode.dmPelsWidth = 800; //screen width
    Mode.dmPelsHeight = 600; //screen height
    Mode.dmDisplayFrequency =75; //screen bits
    if (ChangeDisplaySettings(&Mode,CDS_TEST)==DISP_CHANGE_SUCCESSFUL)
    ChangeDisplaySettings(&Mode, 0);
    #ifdef __cplusplus
    #endif
    #endif
    Setp5:
    cmd>cl -IF:\jdk\include -IF:\jdk\include\win32 -LD Setdisp.c -FeSetdisp.dll
    errors:
    Setdisp.obj : error LNK2001: unresolved external symbol __imp__ChangeDisplaySett
    ingsA@8
    Setdisp.obj : error LNK2001: unresolved external symbol __imp__EnumDisplaySettin
    gsA@12
    Setdisp.dll : fatal error LNK1120: 2 unresolved externals
    Why ??
    Help me,thank you very much!

    are you sure you are linking to user32.dll?

  • JNI Question Executing Question

    Dear member,
    I have my C invocation program and Java executable on a Solaris 8 machine using SDK 1.2; I also have the permission on the C executable set as "chmod dm_check 6750". I have changed the owner to "root" and changed the group to "topic". The 6750 gives the file the following permissions: " 64 -rwsr-s--- 1 root topic 30896 Jul 31 01:05 dm_check". There is an another application which runs this C program transparent to the user, i.e., this C program integrates with another application. When this application tries to call this C program as user "dmadmin", the application cannot invoke the C program.
    When I run the C program from the command line as "root" or "dmadmin", I get an error that a library file cannot be found; however, I have added to the LD_LIBRARY_PATH the necessary directory "/usr/lib:/vx00/ora/app/product/9iv2/jdk/jre/lib:/vx00/ora/app/product/9iv2/jdk/jre/lib/sparc:" for both "root" and "dmadmin". Can anyone suggest an alternative solution?

    I had a similar problem, I think there might be another env variable besides LD_LIBRARY_PATH. I can't tell you what it is because I am working the my Windows Partition right now. Also it could be something in your makefile too. Sorry I wish I could be more help. If this does not help post and when I go over to the linux parition I check a project I was working on and see what the other env variable was.

  • Is it possible to call c# dll using JNI

    Using JNI we can invoke native code written in c or c++.
    Steps:
    1) All we have to do is write a class and have a method of type native.
    2) Invoke javah with -jni option to create a .h file.
    3) Include this header file and implement the method in c or c++ code.
    Now my question is:
    Is it possible to call I want to know whether we can implement the native method in c# instead of c or c++.
    Thanks

    No you can't, but you can have the JNI C/C++ code call C# code. How to do that is no longer a JNI question but a C# question.

  • How to solve these Errors when generating .dll (using JNI) ?

    Hello,
    I am very new about JNI. As I have been trying to generate my dll (sysHook.dll) as I followed this topic http://forums.sun.com/thread.jspa?threadID=632369 (by Jbgohlke ) by putting this command:
    cl -I"C:\Program Files\Java\jdk1.6.07\include" -I"C:\Program Files\Java\jdk1.6.07\include\win32" sysHook.cpp -FesysHook.dll Then many errors are popped up as follows:
    sysHook.obj :error LNK2019: unresolved external symbol __imp__CallNextHookEx@16 referenced in function "long__stdcall HookKeyboardProc(int,unsigned int,long)" (?HookKeyboardProc@@YGHIJ@Z)
    sysHook.obj :error LNK2019: unresolved external symbol __imp__SetWindowsHookExA@16 referenced in function " void__cdecl Init(void)" (?Init@@YAXXZ)
    sysHook.obj :error LNK2019: unresolved external symbol __imp__UnHookWindowsHookEx@4 referenced in function "void__Cleanup(void)" (?Cleanup@@YAXXZ)
    sysHook.dll : fatal error LNK1120: 3 unresolved externals
    If anyone of you know this PLEASE!! point me out!!
    [email protected]
    Thanks in advance

    Specify the appropriate library when linking.
    This is not a JNI question. It is a Windows/C/C++ programming question.
    Locking this thread.

  • Java.lang.UnsatisfiedLinkError: D:\...*dll: Can't find dependent libraries

    Hello,
    Every time I try run my application I get this:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java_przyklady\Met
    ody_macierzyste\HelloNative.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:834)
    at HelloNative.<clinit>(HelloNative.java:12)
    at HelloNativeTest.main(HelloNativeTest.java:10)
    This application is example which was provided with book- Core Java 2
    Here is exactly what I have:
    HelloNative.java
    class HelloNative
       public static native void greeting();
       static
          System.loadLibrary("HelloNative");
    }HelloNativeTest.java
    class HelloNativeTest
       public static void main(String[] args)
           HelloNative.greeting();
    }Here is my HelloNative.c
    #include "HelloNative.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_HelloNative_greeting(JNIEnv* env,
       jclass cl)
       printf("Hello world!\n");
    }and HelloNative.h
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class HelloNative */
    #ifndef _Included_HelloNative
    #define _Included_HelloNative
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     HelloNative
    * Method:    greeting
    * Signature: ()V
    JNIEXPORT void JNICALL Java_HelloNative_greeting
      (JNIEnv *, jclass);
    #ifdef __cplusplus
    #endif
    #endifI did:
    javac HelloNative.java (I got HelloNative.class)
    javah HelloNative (I got HelloNative.h)
    gcc -c -D__int64="long long" -Ic:\j2sdk1.4.2\include\ -Ic:\j2sdk1.4.2\include\win32 HelloNative.c (I got HelloNative.o)
    dllwrap --add-stdcall-alias -o HelloNative.dll HelloNative.obut here I got:
    dllwrap: no export definition file provided
    Creating one, but that may not by what you wantand
    HelloNative.dll
    May by I made mistake used dllwrap, what this feedback means for me?
    So, when I did everything what I wrote abow I got:
    HelloNative.class
    HelloNative.h
    HelloNative.o
    HelloNative.dll
    and I run
    HelloNativeTest.class and I got above Error
    I use j2sdk1.4.2 and Windows XP
    Could anybody tell me what I did wrong???
    I will be appreciate

    The "Native Methods" forum is for JNI questions.
    See this thread...
    http://forum.java.sun.com/thread.jspa?forumID=52&threadID=534964

  • Calling extern functions in a c library

    Hi I am new to JNI and I am trying to use an existing c library that I have in a java application.
    I have written a c function which is called from java class, this works fine, the problem is when i try to call functions located in my c library from this function the code wont compile, giving a linker error. Specifically it wont compile the functions marked as being extern in the header file.
    I tried removing extern, but had the same error, I am not a c programmer.
    Any help would be really appreciated

    Hi,
    I doubt you will get a response since this thread is 7 years old. You are better off looking up the documentation for your compiler as this is not really a JNI question.
    With gcc you would use -L<lib_dir> -l<lib>
    Cheers,
    Shane

  • Camera Event Handler

    I handled camera event on changing of views from view list.
    I wrote following js code on 3D annotation----
    var collectViews = new CameraEventHandler();
    collectViews.onEvent = function(event)
    console.println("view changed");
      var camera = scene.cameras.getByIndex(0);
      camera.transform.rotateAboutXInPlace( -90 * Math.PI / 180);
      camera.targetPosition.set(scene.computeBoundingBox().center)
    runtime.addEventHandler(collectViews);
    But when i changed view from viewlist of 3D tool bar then camera event function get called 2 times......
    please solve this problem.............?
    Why it is calling two times on changing of view ?

    Unfortunately, we're not experienced enough with C.C++ and VC++ to know exactly how to fill in the gaps.Then I suggest you hire someone who is. This forum is for JNI questions. It is not a C/C++ programming service. Locking this thread.

  • Problem related to C program

    I have a char pointer and we have to define its size as 10 and a String inserted in it ("SANJAY");
    How i can solve this problem in C using dynamic memory allocation

    I have a char pointer and we have to define its size as 10 and a String inserted in it ("SANJAY");Is that a JNI question? Can you be more accurate about your requirements?
    How i can solve this problem in C using dynamic memory allocationIs that a homework question? Can you be more open about whether this is the case, and what yourself already analyzed and suggest (we'll gladly comment on your attempt to help you improve it if needed).

  • Cannot get bitmap from native DLL from multi threaded Java app.

    I have a native DLL that gives me a HBITMAP (Windows handle to bitmap). I have made a JNI wrapper for this that gives me a BufferedImage back. The native code simple gets the actual bitmap for the handle, converts the RGB byte triplets to RGB ints, puts this in a jintArray and creates a BufferedImage.
    This all works fine within a single Java thread. If I do this multi threaded (thread 1 calls the native function and several seconds later, thread 2 calls the native function) I keep getting the last image of the first thread. Can enyone help me out?
    I know that this is probably a question for MSDN but I just know that they will tell me its a JNI question.
    The native code:
    JNIEXPORT jobject JNICALL Java_somenamespace_getPicture
    (JNIEnv *env, jclass cl, jstring serialNumber)
    jobject jImage;
    jclass jImageClass;
    jmethodID jMethod;
    jfieldID jField;
    jintArray rgbArray;
    char *str;
    char *charArray;
    int *intArray;
    int w, h, index, type;
    HBITMAP hbmp;
    BITMAP bmp;
    str = (char*)((*env)->GetStringUTFChars(env, serialNumber, NULL));
    // Gets the HBITMAP handle from the native DLL. The first argument is to select the device, based on serial number.
    getPicture(str, &hbmp);
    (*env)->ReleaseStringUTFChars(env, serialNumber, str);
    // Get the BITMAP for the HBITMAP
    GetObject(hbmp, sizeof(BITMAP), &bmp);
    // Create my BufferedImage
    jImageClass = (*env)->FindClass(env, "java/awt/image/BufferedImage");
    jMethod = (*env)->GetMethodID(env, jImageClass, "<init>", "(III)V");
    jField = (*env)->GetStaticFieldID(env, jImageClass, "TYPE_INT_RGB", "I");
    type = (*env)->GetStaticIntField(env, jImageClass, jField);
    jImage = (*env)->NewObject(env, jImageClass, jMethod, bmp.bmWidth, bmp.bmHeight, type);
    // Get the RGB byte triplets of the BITMAP
    charArray = (char *)malloc(sizeof(char) * bmp.bmHeight * bmp.bmWidth * 3);
    GetBitmapBits(hbmp, sizeof(char) * bmp.bmHeight * bmp.bmWidth * 3, charArray);
    // Allocate space to store the RGB ints and convert the RGB byte triplets to RGB ints
    intArray = (int *)malloc(sizeof(int) * bmp.bmHeight * bmp.bmWidth);
    index = 0;
    for (h = 0; h < bmp.bmHeight; ++h)
    for (w = 0; w < bmp.bmWidth; ++w)
    int b = *(charArray + index * 3) & 0xFF;
    int g = *(charArray + index * 3 + 1) & 0xFF;
    int r = *(charArray + index * 3 + 2) & 0xFF;
    *(intArray + index) = 0xFF000000 | (r << 16) | (g << 8) | b;
    ++index;
    // Create a jintArray for the C RGB ints
    rgbArray = (*env)->NewIntArray(env, bmp.bmHeight * bmp.bmWidth);
    (*env)->SetIntArrayRegion(env, rgbArray, 0, bmp.bmHeight * bmp.bmWidth, (jint*)intArray);
    // Use BufferedImage.setRGB() to fill the image
    jMethod = (*env)->GetMethodID(env, jImageClass, "setRGB", "(IIII[III)V");
    (*env)->CallVoidMethod(env, jImage, jMethod,
    0, // int startX
    0, // int startY
    bmp.bmWidth, // int width
    bmp.bmHeight, // int height
    rgbArray, // int[] rgbArray
    0, // int offset
    bmp.bmWidth); // int scansize
    // Free stuff
    (*env)->DeleteLocalRef(env, rgbArray);
    free(charArray);
    free(intArray);
    return jImage;
    }I already tried working with native HDCs (GetDC, CreateCompatibleBitmap, SelectObject, GetDIBits, ...) but this just complicates stuff and gives me the same result.

    Have you verified what the "native DLL" gives you back on the second call?The HBITMAP handle returned is the same each call (no matter which thread). The actual BITMAP associated with this handle is only updated in the first thread.
    How are you determining that the image is the same?If I point the camera (I don't get a stream, I just get individual images) to a moving scene, I get different images for each call from within the first thread. The second thread only gets the latest image from the first thread. There is no concurrency of the threads and all methods are synchronized.
    Specifically did you verify that the problem is not that your test code itself is using the same instance?Yes, I tested the native side as well as the Java side. The BufferedImage is always an exact copy of the native BITMAP.
    Try printing out the hash for each instance.I have written the image to a file in the native code itself to eliminate anything related to the mechanism of returning the BufferedImage. This had the same result.
    The return values of all native calls all indicate successful calls.
    I am suspecting the native side of creating a second graphical context for the second thread while it keeps refering to the first context.
    (I will start a thread on the MSDN as well and will post here if anything turns up.)

  • JNI / Garbage Collection question

    I have a C++ library I am calling into from our application. The question I have is I want the library to return a jintarray or a jstringarray (not sure which yet). If they create that array in the function and then return it to me as the return type, will the Garbage collector automatically free the memory for that array once I am done using it, or do I need to manually free it some how since the array was created in the c code?
    Thanks,
    Jeffrey Haskovec

    Java objects whether they are create in java or JNI are all managed by the VM.

  • Some questions on JNI Specification(s)

    Which is the definitive spec? Is it the book "Programmer's Guide and
    Specification" (Guide) by Sheng Liang, or the online doc "Specification" v1.5
    (Spec)? The trouble is they don't agree on some matters. It's not simply a
    question of which is right, but rather what various JVM vendors have
    regarded as correct (regarding the Spec or the Guide as normative) at
    various points in time. I'm intending my code to be portable across multiple
    platorms and vendors, so it depends to which document they've worked. Do I
    have to program within the intersection of the two specs?
    The big one is that In the online Spec, it says that only ExceptionOccurred(),
    ExceptionDescribe(), and ExceptionClear() can be called when an exception
    is pending (end of Chapter 2). But the Guide (11.8.2) lists several other
    functions, among them ExceptionCheck(). For instance, according to the
    Guide if I call DeleteLocalRef() with a valid argument, nothing bad will
    happen, but according to the online Spec I could heading into crashes or
    other forms of Undefined Behaviour because there might be a pending
    exception. (Having been coding according to the Spec, the Guide now
    implies I could afford to have been a lot less cautious, so if the Guide is
    normative I can happily rip out lots careful error-handling code.)
    One apparently exception-unsafe function is PopLocalFrame(), which
    makes it unique amongst the resource cleanup functions. Is this
    accurate? Is there a reason for this?
    To clarify, what are all the functions that might FatalError() due to
    inability to allocate LocalRefs? Is it anything that returns a LocalRef
    except NewLocalRef (which just returns NULL and posts an exception)?
    What about PopLocalFrame() with a non-NULL argument?
    With those functions that take JNI Version parameter, will the resulting
    JNIEnv only have those function table entries for that version, or the
    most recent one? (i.e. is the supplied version a request for a minimum,
    or more exact)? If the former, does this mean that the JNI version
    hierarchy is guaranteed never to fork, so there is no ambiguity over the
    "latest version"? (My library may create a JVM or attach to a thread in
    a variety of circumstances, and it may not be possible to know what the
    most appropriate version to request is; I'm hoping the JNI just Does The
    Right Thing and saves me some trouble). The same holds for the JavaVM
    interface.
    For RegisterNatives, the Spec says the functions passed in must
    "nominally" have sig
    ReturnType (*)(JNIEnv*, jobject objectOrClass,...);
    Does this actually mean they should use a va_list and the C calling
    convention, rather than JNICALL and explicit params (as in "ordinary"
    native methods)?
    Thanks for your help
    John

    > With those functions that take JNI Version parameter, will the resulting JNIEnv only have those function table entries for that version, or the most recent one?
    It sounds safest to assume it implements only the version you requested, unless you call GetVersion first to determine the true version.
    > Does this actually mean they should use a va_list and the C calling convention, rather than JNICALL and explicit params (as in "ordinary" native methods)?
    The book makes this clear. You pass pointers to "ordinary" native methods, having the exact same prototype and implementation as if you used implicit linking rather than RegisterNatives.
    -slj-

  • JNI related question

    Hi,
    I've downloaded some files from the following site;
    http://www.geocities.com/Juanga69/parport/
    you may be familiar with them, the class basically write/read a byte to/from the parallel port using a c file (i was trying with the comm api but it was giving too much trouble).
    My question is this, the class ParallelPort.java is located at C:\parport\ (as is the install instruction).
    Now if i have another class, Port.java, which will access the class ParallelPort in another location, lets say, C:\java\, how do i make Port.java see ParallelPort.java ??????
    I've tried to add the following to ParallelPort
    package parport;
    but is it already a package or something because it uses JNI?
    Is there a way that you can say,
    import c:\parport\ParallelPort or something?

    ParallelPort does not belong to a package. c:\parport is only the directory where it is located at. If you have that directory in your CLASSPATH then Java should be able to find it with no problem. If you absolutely must import it, then you can do this:
    import ParallelPort;That's it. Another thing that might be happening is if you dont have '.' (dot, current directory) in your class path, Java won't find your Port class. Therefore, you might want to add it to your CLASSPATH like this:
    set CLASSPATH=.;c:\parport;%CLASSPATH%notice the '.' at the begining.

Maybe you are looking for

  • Remote App and Azure VM

    Hi All.  I have a scenario that I wanted to throw out there to see if anyone has either implemented something familiar or whether or not it can be done at all.  I have a small dental practice who is in the process of opening up a couple new remote lo

  • How can I copy my iTunes library with playcount information to a new computer?!?

    Hello, I'm about to get a new computer. I have all my music on a external HD, so I won't have problems preserving my music. But I would like to preserve other information too. Especially the play count information. I think it's interesting how my top

  • Index Compression in SAP - system/basis tables?

    Hi! In thread Oracle comression in SAP environments the Oracle 10g feature index compression was discussed. We are now going to implement it also. SAP and Oracle say, this can be done for any index. So we selected the biggest and the most frequently

  • Address book photo in Mail

    Is there anyway to remove the Address Book photo when printing a Mail message? I print some of my stuff to pdf and would rather not have the photo printed as well. Thanks. iMac G5 20    

  • NEED HELP: No Sound / Audio "No Devices Found". Tried many solutions, none work

    I have had this issue two months back, where my internal speakers just stopped working. I have tried all alternatives and what solved my problem was resetting SMC. This time around, I have been watching some videos when all of a sudden my laptop star