1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Java: J2ME & J2SE on cell phones/OSX using BT

Discussion in 'Mac Programming' started by Earendil, Jan 26, 2007.

  1. macrumors 68000


    I'm about to cry.

    I'm taking a crash course in Java during our "January Term" which is exactly like it sounds. It's intense. I'm a junior CS major, and though I didn't know Java, I wasn't going to let that stop me from picking a project that wasn't seemingly impossible :rolleyes: The Prof also gave us a week, so thought I had plenty of time.

    Some 20 hours of research later, and many failed implementations and unanswered forum posts and java.sun.com I'm here to you guys. I don't mean to come to y'all last, but MacRumors normally isn't at the top of my list for programming help :)

    What I really need is a few things explained. I need some "That will work" or "that won't work", because I'm tired of failing in environments that are near impossible to debug efficiently.

    What I was trying to do is get two way data communication between two Java apps that I write, one residing on my Powerbook with bluetooth, the other residing on my cell phone (SonyEricsson T610). But I'm starting to think that I can not use Java to interact with the hardware on the cell phone.

    However I have failed to use Java and the Bluetooth APIs to create a simple Bluetooth device finder/scanner, so I dunno :(

    I have successfully created little apps for my phone, so I know I have the code frame and the build/loading done correctly. But java seems to be limited to UI and logic.

    Any huge problem is that the lab computers I have access to do not have bluetooth, so it's a pain in the neck to dev under Windows, and bounce the app through my Mac, then to my phone.
    Not to mention that Windows = Java 1.6
    OSX = Java 1.5
    J2ME = 1.1 (for my phone)
    BlueTooth API's = ???

    I dunno... After getting 9 days for our final project I have 4 remaining and I have no code or design ideas. I have a ton of knowledge but it's shotgun style, I can't tie it together :(

    Ideas? Pointers? Bluetooth+Java warnings?

    Thanks for reading,
  2. macrumors 603


    I did a little Java & Bluetooth development, but it was a few years ago so my knowledge could well be out of date.

    Not all phones that have Java(J2ME) and Bluetooth will support Bluetooth through Java. To do this, they must also implement the optional JABWT package. When I was developing, very few phones supported this (I used a P900 and Nokia 6600 for testing), but that may have changed greatly in the meanwhile.

    Here is a midlet (with source code) that does device & service discovery which should put you on the right road, just look for JABWT Browser in the list above.

    Best of luck! ;)
  3. macrumors 603


    When I was developing a Java app for Windows Mobile, running on IBM J9 JVM - I simply created a custom runtime in Eclipse that only contained the jars that were on the device and developed only against those. That made sure I was using APIs available on the device itself - a mistake I kept making was assuming that J2SE is the same as IBM J9 JVM.

    Since there are many factors that will determine what APIs are available to you (MIDP, CDC, CLDC), I would suggest you head over to the Sony Ericsson developer forums as there seems to be plenty of information over there.
  4. macrumors 68000


    Whooleytoo, thank you very much for the reply and the link!
    It would seem as if my phone falls into the no Bluetooth through Java. I know my phone also supports C++, and I know that programs like Salling Clicker work on my phone. I betting that was deved in C++ though, and I made the assumption that both languages would have the same level of control, especially with Java's "cool slick" small device Java set.

    Part of my problem, I think, is that my phone came out before anyone cared to program things for their phone outside little games. Most internet documentation on the internet revolves around smart phones and J2ME 2.0.

    I can't no straight answer for SonyEricssons developer website on my phone +bluetooth. I can't get a straight answer from anyone. Of course at this point even if I did get a straight answer, there wouldn't be any documentation to help me actually acomplish the task.

    Going to work through today and then probably give up. I present my project Tuesday morning, so my coding hours are dimishing fast.

    I hate fridays....
  5. macrumors 68000


    MIDP is what I can use, MIDP 1.1.
    My problem is finding a clear set of documentation that shows me how all the different devices, API's, Java subsets, and additional libraries like JSR82 all tie together, and what is required for what.

    And in the last 5 minutes I've come across something called AT commands, that I actually saw at the start of my research, but have not come across since. However after 15 minutes with google I can find no information on what "AT Commands" are, and how to use them. I have a vague idea, but that isn't going to help me implament them into Java. I know my phone supports AT commands though...

    Thank you very much for you reply though. I love this forum so much, so many other places aren't replying to my posts. Granted, I'm not asking specific questions :(
  6. macrumors 603


    If memory serves me right, we had to license a library from Rococosoft to develop our Bluetooth midlet. I think the product was called Impronto Simulator, and it includes an emulator so you can test your Bluetooth Java midlet even if you don't have a JABWT (JSR 82) phone.

    Our development environment was simply:
    - a PC (could never get it to work on a Mac)
    - J2SE
    - J2ME
    - the Impronto lib.

    An app in the J2ME SDK lets you create a bare project, then you drop in your Java class text files and your resource files into the relevant folders, drop the Impronto lib into the lib folder, and compile using the same app. We just used a text-editor for coding (very quick 'n' dirty).

    However, I think you'll struggle to get it done now, with so little time left, I'm sorry to say.
  7. macrumors newbie


    Of the threads that I found searching the forums, I think this is probably the best place to post (I did post in one other thread as well):

    I am trying to write an application to send and receive SMS messages. Eventually, this will be on the Palm, but, I figured I'd start on my Mac as a way to easily develop, test and debug. Then it should be relatively simple to take the modules/objects/logic/etc. over to the palm.

    The problem so far is that I want to develop in Java (using NetBeans IDE) for easy development, but, there doesn't seem to be a Mac BlueTooth API (at least that's free).

    I have found some old mention of a Java->OBJ-C Bridge, but, can't figure out what that is or how to use it. My thought though is I should be able somehow to get the NetBeans IDE tied into the BlueTooth Framework.

    Any ideas? Hints? Thoughts? Clues?

  8. macrumors G4


    ^^ I guess you are the guy who contacted me earlier about SMS Commander. I just sent you another email suggesting this thread, sorry :eek:. The problem is that the Cocoa/Java Bridge is depreciated so its best to avoid it.

    You may find this page on Apple's website useful.
  9. macrumors newbie


    Yes, that was me :) I did get it, but, I can't make any sense of it. I'm completely self taught when it comes to programming and I can't even get that code to single step in which is why I've had such a hard time figuring out the XCode/OBJ-C code.

    I understand that the bridge may have been deprecated, but, since the final resting place for this application will be the Palm, I don't see why I couldn't use it for the development. Any information on how to simply link the Bluetooth library into the NetBeans IDE?

    Thanks for the help!
  10. macrumors newbie


    I was pointed to a google group by another user that is working on a Bluetooth library for OSX.

    Here's the link to the discussion on the Mac version: BlueCove 2.0.2

    And their home page: BlueCove

Share This Page