Only C/C++ supported through JNI?

I was wondering if there is any initiative to expose functions in java to languages other than C/C++ like perl/VB/Delphi etc. (create header files in these languages). Or is there a way to do it today?

Anything that can use C++ can use Java. You simply build the bridging code to Java in C++ and then expose whatever API from C++. I am working on a project that has VB using Java, via C++ COM and JNI.

Similar Messages

  • Remote location, 7kbs d'load speed, 10 days to d'load Lion, only software updates are through the App Store. Why can't we d'load and install outside the Cloud anymore? Some of us can't use the cloud.

    Remote location, 7kbs d'load speed, 10 days to d'load Lion, only software updates are through the App Store. Why can't we d'load and install outside the Cloud anymore? Some of us can't use the cloud and never will be able to.

    That is true - I apologize for not being specific - what I was mainly referring to is iLife applications. I have a notice on the App Store that says 3 apps need updates, I look at the apps and they are huge so since my connection is so slow I use my work connection and d'load the files from support to my Windows machine and carry them home, once d'loaded my MacAir states it cannot install, the update must come from the App Store.
    I do the same thing for large Leopard and Lion files and I can install them without error, it is just the App Store files that the system stops.

  • I dropped my Iphone 5 which resulted in it shattering and the screen was still on but it was black with only a white line through it so I couldnt access the phone however I switched over to my Droid and now I cannot send or receive messages?

    I dropped my Iphone 5 which resulted in it shattering and the screen was still on but it was black with only a white line through it so I couldnt access the phone however I switched over to my Droid and now I cannot send or receive messages and I cant turn off imessage because I cant see anything on the screen.  Help?

    Then the bottom of the support document states that if you do not have access to the device (which unfortunately because of the screen issue you do not) to contact Apple Care. That is what you need to do.

  • Why can I only hear my calls through the speaker?

    Why can I only hear my calls through the speaker?

    Because your receiver may not be working anymore. Use http://support.apple.com/kb/TS1630 to troubleshoot this

  • Trying to Load a BufferedImage from a PNG through JNI

    Yes I realize that I can load it directly through Java and not go through JNI, but I need this to test correctly as my C code will aquire images without saving to Disk and I want Java code to manipulate the images without saving to disk. The image Im trying to load is a 800x600 PNG image.
    So I have the code
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import com.sun.media.jai.widget.DisplayJAI;
    class ImageLoader{
         static{
              System.loadLibrary("LoadImage");
         private static native byte[] loadImage();
         public static void main(String[] args){
    byte[] f = loadImage();
              InputStream s= new ByteArrayInputStream(f);
              BufferedImage bi;
              try {
                   bi = ImageIO.read(s);
                   displayBufferedImage(bi, "test");
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
          * Utility method for display a BufferedImage.<br>
          * @param  image input image
          * @param  title window title string
         public static void displayBufferedImage(BufferedImage image, String title)
              JFrame frame = new JFrame();
             frame.setTitle(title);
             //frame.getContentPane().add(new DisplayTwoSynchronizedImages(sourceImgBI, resultImgGray));
             frame.getContentPane().add(new JScrollPane(new DisplayJAI(image)));
             //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             //frame.pack();
             frame.setSize(300,300);
             frame.setLocationRelativeTo( null );
             frame.setVisible(true); // show the frame.
         }and I have the JNI c code as
    char* result;
    JNIEXPORT jbyteArray JNICALL Java_ImageLoader_loadImage
      (JNIEnv * env, jclass jclassj){
                   int fd = open("test.png",  O_RDWR, S_IRUSR|S_IWUSR );
                   int size = (800*600*4);
                   result = (char*)malloc(size);
                   read(fd, result, size);
                   jbyteArray return_result;
                   return_result = env->NewByteArray(800*600);
                   env->SetByteArrayRegion(return_result, 0, 800*600, (jbyte*)result);
                   //free(result);
                   return return_result;
         }but when I try to run the code I get the following error
    javax.imageio.IIOException: Error reading PNG image data
         at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1287)
         at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1552)
         at javax.imageio.ImageIO.read(ImageIO.java:1438)
         at javax.imageio.ImageIO.read(ImageIO.java:1342)
         at ImageLoader.main(ImageLoader.java:31)
    Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
         at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240)
         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
         at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
         at java.io.DataInputStream.readFully(DataInputStream.java:195)
         at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1084)
         at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1188)
         at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1280)
         ... 4 moreI think that Im on the right track because Java is recognizing that this is a PNG image, but Im not sure whats wrong. I don't know much about the formats, so I know nothing about PNG's, maybe someone else can help me here.
    Note: I ran the code
                   BufferedImage bi2 = ImageIO.read(new File("test.png"));
                   displayBufferedImage(bi2, "test2");and the image loads fine, so there is no issue with the image itself.

                   int fd = open("test.png", O_RDWR, S_IRUSR|S_IWUSR );Why are you opening the image file read/write? Why not read-only?
                   int size = (800*600*4);Here you're assuming the image is 800*600. Are you sure that's the case? Also you should write sizeof int here instead of 4.
                   result = (char*)malloc(size);Here you aren't checking for the possibility that result is null.
                   read(fd, result, size);Here you are ignoring the result returned by read(), so you are ignoring the possibilty that it was 0 or less than 'size'. Either are possible.
                   jbyteArray return_result;
                   return_result = env->NewByteArray(800*600);Here again you aren't testing for return_result == null.
                   env->SetByteArrayRegion(return_result, 0, 800*600, (jbyte*)result);Here you should be checking for Java exceptions. Also you shouldn't be repeating the 800*600 here, make it a constant or a variable somewhere.
                   //free(result);You need that free, otherwise you have a memory leak. If the image really is a constant 800*600 in size I would allocate 'result' on the stack so you don't need to housekeep it.
    Also you are never closing the input file!
    Caused by: java.io.EOFException: Unexpected end of ZLIB input streamSo clearly you didn't read all the image. That could be due to guessing wrong about 800*600 or getting a short read when reading the file.
    I think that Im on the right track because Java is recognizing that this is a PNG imageI agree. It starts like a PNG image, so you read something, but it doesn't end like one, so you didn't read it all.> and the image loads fine, so there is no issue with the image itself.
    Good test. Note that your Java code makes no assumption about the size of the image.

  • Passing Image data through JNI?

    Hello,
    I am trying find the fastest way to pass image data from Java through JNI. Passing Java images through JNI seems to be a very common thing to do so I expect there's an oft-used approach. Can anyone give me a good explanation of this or point me to some references?
    I need to pass the image data to a C++ function which operates on this data, writing the results to a destination buffer which goes back to Java and gets put back into an image.
    Currently, I'm using BufferedImages and getRGB to get an int array from my source image, passing this through JNI along with another int array to be used as the destination buffer, then calling setRGB with my destination buffer after the JNI function returns. getRGB() preserves the alpha channel of png files, which is functionality I need. The problem with this approach is that getRGB is extremely slow. It can take up to two seconds with a large image on my 1.2 Ghz Athlon. It seems to be performing a copy of the entire source image's data. Maybe there is a way to decode a jpg or png directly into an int array?
    -Aaron Dwyer

    Here's how you could do it for TYPE_4BYTE_ABGR
    BufferedImage img=new BufferedImage(13,10,BufferedImage.TYPE_4BYTE_ABGR);
    img.setRGB(0,0,0xff0000);     
    img.setRGB(5,1,0x00ff00);        
    img.setRGB(1,1,0xcafebabe);
    DataBuffer db=img.getRaster().getDataBuffer();
    int dataType=db.getDataType();
    if (dataType!=DataBuffer.TYPE_BYTE)
         throw new IllegalStateException("I can do it only for TYPE_BYTE");
    int imgType=img.getType();
    if (imgType!=BufferedImage.TYPE_4BYTE_ABGR)
         throw new IllegalStateException("I can do it only for TYPE_4BYTE_ABGR");
    DataBufferByte dbi=(DataBufferByte)db;
    byte[] array=dbi.getData();
    SampleModel model=img.getSampleModel();
    if (!(model instanceof PixelInterleavedSampleModel))
         throw new IllegalStateException("I can do it only for PixelInterleavedSampleModel");
    PixelInterleavedSampleModel pisModel=(PixelInterleavedSampleModel)model;
    if (pisModel.getPixelStride()!=4)
         throw new IllegalStateException("I can do it only for pixel stride of 4");
    if (dbi.getNumBanks()!=1)
         throw new IllegalStateException("I can do it only for 1 band");
    int scanlineBytes=pisModel.getScanlineStride();
    // Access the green Pixel on Position 5,1
    System.out.println( (int)array[5*4 + scanlineBytes] &0xff);     // Alpha        
    System.out.println( (int)array[5*4+1 + scanlineBytes] &0xff);     // Red        
    System.out.println( (int)array[5*4+2 + scanlineBytes] &0xff);     // Green        
    System.out.println( (int)array[5*4+3 + scanlineBytes] &0xff);     // Blue     I've added some checks to make sure we're accessing the data the right way.

  • Can only sync iPhone/ipad through USB now not WiFi -  help please?

    can only sync iPhone/ipad through USB now not WiFi -  help please?

    Hi Iron Tommy,
    If you are having issues syncing your devices to iTunes via WiFi, you may find the troubleshooting steps outlined in the following article helpful:
    iTunes 10.5 and later: Troubleshooting iTunes Wi-Fi syncing
    http://support.apple.com/kb/ts4062
    Regards,
    - Brenden

  • TS1277 My iTunes won't let me authorize my computer. I have Windows 8 and have only 3 devices authorized through my account. What should I do?

    My iTunes account won't let me authorize my computer. I have Windows 8 and have only 3 devices authorized through my account. What should I do?

    Howdy scrafts,
    I would suggest this article named iTunes: Missing folder or incorrect permissions may prevent authorization found here http://support.apple.com/kb/ts1277
    Open Computer from the Start menu.
    From the Organize menu, choose Folder and Search Options.
    Click the View tab.
    In the "Advanced settings" pane under "Hidden files and folders," make sure that the "Show hidden files and folders" option is selected.
    Click OK.
    Navigate to the following location by either typing it into the address bar, copying and pasting it into the address bar, or clicking through the folder hierarchy listed:C:\ProgramData\Apple Computer\iTunes
    Right-click the SC Info folder shown and on the shortcut menu, choose Delete.
    Restart the computer.
    Take care,
    Sterling

  • After moving to iCloud I can only get my email through the cloud, no new emails are making it to my home computer. Does anyone have any advice on how to fix this issue?

    After moving to iCloud I can only get my email through the cloud, no new emails are making it to my home computer and .mac account. Does anyone have any advice on how to fix this issue?

    Welcome to the Apple Community.
    Which OS are you using.

  • Hi ive upgraded my itouch to ios 6.1.3 but it keeps crashing ounce i put my passcode in is there a way i can fix this? one of my  friends mentioed downgrading it but the only way isnt supported by apple so i dont feel safe with it so plzz help me

    hi ive upgraded my itouch to ios 6.1.3 but it keeps crashing ounce i put my passcode in is there a way i can fix this? one of my  friends mentioed downgrading it but the only way isnt supported by apple so i dont feel safe with it so plzz help me.
    it has worked fine no problems till i updated it i tried restoring itwith my old backup but it doesnt move the ios back so it just keeps on craching when i try to unlock it

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          
    Downgrading the iOS is not supported by Apple

  • HT2736 Can I gift a song to two people at the same time so I only have to go through the process once?

    As the subject says can I gift a song to two people at the same time so I only have to go through the process once? For example can I enter two seperate email addresses in the "To" line seperated by a semicolon like I can in Outlook?
    Thanks for the help

    Is there any way I can be on both of these networks at the same time or is there some other way I can configure this?
    Yes, you can reconfigure the Time Capsule (TC) to "Join a wireless network." In this case the wireless network would be the one created by the other wireless Internet router. In this configuration, the TC can still share its internal (and external) hard drive and a printer attached to the USB port. However, note that this would disable the TC as a router and an Ethernet switch so basically it will perform as a wireless client.

  • I have a new PC and I tunes had to be added from my old PC to my new one, now some of my music is only playing half way through on both my PC and IPOD Classic

    I have a new PC and I had to transfer my I tunes from my old PC to my new PC and now some of the songs only play half way through on both my PC and Ipod Classic
    How can this be fixed, I noticed also that on I tunes on my PC before purchasing a song I listen to it and now it is only playing like 4 seconds of the song and I have opened up the URL and it still won't work correctly. PLEASE HELP

    Are these songs that you purchased from the iTunes Store or imported from outside of iTunes? If there are iTunes purchases, delete them from your main iTunes library and redownload them again at no cost via iCloud.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    B-rock

  • Row based Target only mode not supported

    when i try to execute a mapping i am getting the following error
    Row based Target only mode not supported
    what can be the reasons for this

    Hello Michael
    Check if you have a procedure (other than pre or post mapping) in your mapping. Every part of a mapping after a procedure can only be generated in row-based mode.
    Hope this helps
    Mate

  • Korean characters, not handled through JNI

    Hello:
    I have a C library that is wrapped through JNI. The data is in Korean, and is returning fine in the C code, but then when I access the data through Java (JString), it is all messed up. Any ideas what is the problem?
    Thanks,
    [email protected]

    Adding on, here is the snippet code, where a command is passed in. The C code executes the command, and returns the result. The UTF and jstring string manipulations are shown below. What is wrong with the assumption if the data itself is of Korean language (double-byte enabled)? Any response would be greatly appreciated. Please respond to this message board, or email at [email protected]
    Thanks,
    Bilal
    JNIEXPORT jshort JNICALL
    Java_execCliCommand(
    JNIEnv *env, jobject obj, jstring cliCmd, jobject cliOutObj)
    jshort jresult;
    P_HANDLE cliOut = (P_HANDLE)NULL;
    char cliOutBuf = (char )NULL;
    jclass jcliOutClass;
    jfieldID joutbufID;
    jstring jcliOutStr;
    * Get the cli command & connectstring and execute the cli.
    const char cliCmdStr = (env)->GetStringUTFChars(env, cliCmd, 0);
    printf("CLI COMMAND : %s\n", (char *)cliCmdStr);
    jresult = cliRunServerCommand((char *)cliCmdStr, &cliOut);
    jcliOutClass = (*env)->GetObjectClass(env, cliOutObj);
    joutbufID = (*env)->GetFieldID(env, jcliOutClass, "outbuf", "Ljava/lang/String;");
    if ( cliOutBuf != NULL ) {
    printf("CLI RESULTS: %s\n", cliOutBuf);
    jcliOutStr = (*env)->NewString(env, (jchar *)cliOutBuf, (jsize)(p_strlen(cliOutBuf)+1));
    printf("UNICODE CLI RESULTS: %s\n", (char *)(*env)->GetStringChars(env, jcliOutStr,0));
    } else {
    jcliOutStr = (*env)->NewStringUTF(env, "Command executed successfully");
    (*env)->SetObjectField(env, cliOutObj, joutbufID, jcliOutStr);
    (*env)->ReleaseStringUTFChars(env, cliCmd, cliCmdStr);
    (*env)->ReleaseStringUTFChars(env, connectString, connectStr);
    return jresult;
    }

  • IDOC_ADAPTER.ATTRIBUTE_BE_NOT_SUPP Only asynchronous processing supported

    Hello Expert,
    Error while send IDOC
    " IDOC_ADAPTER.ATTRIBUTE_BE_NOT_SUPP Only asynchronous processing
    supported for IDOC Adapter" is returned.
    Please suggest
    Thulasi

    Hi,
    Make sure that you have mentioned the Recever message interface as Async mode
    Here it is saying that IDOC suports only Async that means some where else u have mentioned as Sync interface
    Regards
    Seshagiri

Maybe you are looking for