Help in J2ME

Hello Sir/Mam,
Im Sanjeev Das from Bhilai(C.G.). Doing my B.E.(C.S.) and in final year from RCET, Bhilai.And has been selected by RISPL, Bhilai and Lambent, Nagpur mobiles companies.
My J2ME training was completed from RISPL on June of calendar year. RISPL is the Bhilai`s only InfoTech company that works on J2ME and Brew Tech.
Now with my hand I have three Game :-
1. Chakravue....(The Maze).
2. Tic-Tac-Toe.
3. Brick Game.
Now Im interested in application program that�s why my next project is �MobileBluetoothApplication� in which Im providing user to exchange data like image, text, sound�etc files through Bluetooth.
But one problem is there. Im not able to send the text and sound files through the Bluetooth. Please help me so that my project can grow up and perform the best result.

Hi !
Place this code net benas file or any editor
it will work on stand alone phone
Premal
* TicTacToe.java
* Created on April 4, 2006, 10:14 PM
* @author  premal lathiya
* @version
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TicTacToe extends MIDlet
    private Display display;
    private MyCanvas canvas;
    public TicTacToe ()
        display = Display.getDisplay(this);       
    protected void startApp()
        canvas = new MyCanvas (this);
        display.setCurrent( canvas );
    protected void pauseApp()
    protected void destroyApp( boolean unconditional )
    public void exitMIDlet()
        destroyApp(true);
        notifyDestroyed();
class MyCanvas extends Canvas implements CommandListener
    private Command exit, restart;
    private TicTacToe ticTacToe;
    int[] gameArr= new int[10];
    int position[][]=new int[10][2];
    int startX=2;
    int startY=2;
    boolean b=true, gameOverFlag=false;
    Image img1,img2;
    public MyCanvas (TicTacToe ticTacToe)
        this.ticTacToe = ticTacToe;
        exit = new Command("Exit", Command.EXIT, 1);
        restart = new Command("Restart", Command.SCREEN, 1);
        addCommand(exit);
        setCommandListener(this);
        position[1][0]=startX;
        position[1][1]=startY;
        position[2][0]=(getWidth())/3;
        position[2][1]=startY;
        position[3][0]=2*((getWidth())/3);
        position[3][1]=startY;
        position[4][0]=startX;
        position[4][1]=(getHeight()-50)/3;
        position[5][0]=(getWidth())/3;
        position[5][1]=(getHeight()-50)/3;
        position[6][0]=2*((getWidth())/3);
        position[6][1]=(getHeight()-50)/3;
        position[7][0]=startX;
        position[7][1]=2*((getHeight()-50)/3);
        position[8][0]=(getWidth())/3;
        position[8][1]=2*((getHeight()-50)/3);
        position[9][0]=2*((getWidth())/3);
        position[9][1]=2*((getHeight()-50)/3);
        for(int i=0;i<10;i++)
        {   gameArr[i] =0;
    protected void paint(Graphics graphics)
        int width=getWidth();
        int height=getHeight();
        boolean flag=false;
        graphics.setColor(255,255,255);
        graphics.fillRect(0, 0, width, height);
        graphics.setColor(255,0,0);
        graphics.drawRect(startX, startY, width-10, height-50);
        graphics.drawLine(width/3,2,width/3,height-50+2);
        graphics.drawLine(2*(width/3),2,2*(width/3),height-50+2);
        graphics.drawLine(2,(height-50)/3,width-8,(height-50)/3);
        graphics.drawLine(2,2*(height-50)/3,width-8,2*(height-50)/3);
        for(int i=1;i<10;i++)
            if (gameArr[i] != 0)
                if(gameArr==1)
graphics.drawString("0", position[i][0]+5,position[i][1]+5,0); //zero
else
graphics.drawString("X", position[i][0]+5,position[i][1]+5,0); //zero
if(gameArr[i] == 0)
     flag = true;
if(flag == false)
     graphics.drawString("No Result", getWidth() / 3, getHeight() - 30, 0);
     addCommand(restart);
else if(gameOverFlag && !b)
graphics.drawString("Player-1 wins", getWidth() / 3, getHeight() - 30, 0);
else if(gameOverFlag && b)
graphics.drawString("Player-2 wins", getWidth() / 3, getHeight() - 30, 0);
public void commandAction(Command command, Displayable displayable)
if (command == exit)
ticTacToe.exitMIDlet();
else if(command == restart)
ticTacToe.startApp();
protected void keyPressed(int key)
if(gameOverFlag)
return;
switch ( key )
case KEY_NUM1:
setValue(1);
break;
case KEY_NUM2:
setValue(2);
break;
case KEY_NUM3:
setValue(3);
break;
case KEY_NUM4:
setValue(4);
break;
case KEY_NUM5:
setValue(5);
break;
case KEY_NUM6:
setValue(6);
break;
case KEY_NUM7:
setValue(7);
break;
case KEY_NUM8:
setValue(8);
break;
case KEY_NUM9:
setValue(9);
break;
repaint();
checkWin();
public void setValue(int subScript){
if(gameArr[subScript] == 0){
if(b)
gameArr[subScript] = 1; //zero
else
gameArr[subScript] = 2; //cross
b=!b;
public void checkWin()
if((gameArr[1] == 1 && gameArr[2] == 1 && gameArr[3] == 1) ||
(gameArr[4] == 1 && gameArr[5] == 1 && gameArr[6] == 1) ||
(gameArr[7] == 1 && gameArr[8] == 1 && gameArr[9] == 1) ||
(gameArr[1] == 1 && gameArr[4] == 1 && gameArr[7] == 1) ||
(gameArr[2] == 1 && gameArr[5] == 1 && gameArr[8] == 1) ||
(gameArr[3] == 1 && gameArr[6] == 1 && gameArr[9] == 1) ||
(gameArr[1] == 1 && gameArr[5] == 1 && gameArr[9] == 1) ||
(gameArr[3] == 1 && gameArr[5] == 1 && gameArr[7] == 1))
gameOverFlag = true;
addCommand(restart);
if((gameArr[1] == 2 && gameArr[2] == 2 && gameArr[3] == 2) ||
(gameArr[4] == 2 && gameArr[5] == 2 && gameArr[6] == 2) ||
(gameArr[7] == 2 && gameArr[8] == 2 && gameArr[9] == 2) ||
(gameArr[1] == 2 && gameArr[4] == 2 && gameArr[7] == 2) ||
(gameArr[2] == 2 && gameArr[5] == 2 && gameArr[8] == 2) ||
(gameArr[3] == 2 && gameArr[6] == 2 && gameArr[9] == 2) ||
(gameArr[1] == 2 && gameArr[5] == 2 && gameArr[9] == 2) ||
(gameArr[3] == 2 && gameArr[5] == 2 && gameArr[7] == 2))
gameOverFlag = true;
addCommand(restart);

Similar Messages

  • Need a help in j2me-send file to a bluetooth address(mobile to mobile)

    Dear All;
    I am new in J2ME programing...
    I have an application, in which i want to send a copy of my application (application.jar) to other bluetooth enabled mobiles.
    I have code for searching and listing other bluetooth mobiles.
    i want to send file to this bluetooth address..i have the address..
    Please help me if anybody can..
    It is so urgent..

    Siyampa, don't multipost. I've deleted your other threads.

  • Need urgent  help on J2ME Bluetooth.

    Hi all,
    I really need help about run example code of j2me bluetooth.
    I'm doing a MSc project about bluetooth for delivery system, I just want to use bluetooth to send an object to PDA.
    I,ve tried example on "Bluetooth for Java" with Atinav library but, it couldn't work.
    Do you have an example code that can run on NetBeans 5.0 with
    - AvetanaBluetooth Library (purchased)
    or
    - normal Bluetooth.java library
    I need some examples for develop on it. and also please advice me on how to run and test the programs. I really need urgent help Please help me. my email is [email protected] or [email protected]

    Hi Hari,
    I think that the logic needs to be build up in the DISP part of the Search help exit.
    What you can do is also get the Plant in the search help as an export parameter.
    Then in the Return Tab you can check if the plant = 'AA', delete the data.
    e.g.
          LOOP AT record_tab.
            IF RECORD_TAB-STRING+22(2) = '90'.
              DELETE record_tab INDEX sy-tabix.
            ENDIF.
          ENDLOOP.
    Hope this helps.
    Regards,
    Himanshu
    Message was edited by:
            Himanshu Aggarwal

  • Help with J2ME streaming

    Hi,
    My name is Constantinos Loizou and I am a student and currently developing a project for my Master's degree.
    I need to stream audio and/or video to a PDA device. There is a trick here which is:
    The PDA must receive the stream from a multicast address. For this I have implemented a Bridge application which joins the multicast group on behalf of the PDA and receives the Multicast RTP packets (which are sent from JMStudio) and Unicasts them to the PDA.(HP iPAQ) I had no problem implementing this. The streaming is done using JMStudio player which encodes the streaming audio data into a number of encodings (DVI/RTP in my case). I choose DVI/RTP and stream a .wav audio file.
    Now I have to accept the packets and play the stream on the PDA.
    The j2me application receives all the RTP packets successfully and I can extract usefull information from the packets such as: Timestamp, sequence number, payload type. The payload type is 5 which means it is a DVI4 encoding therefor the packets are accepted without any problem. I then save the data of the packet into a byte[] array and in regular intervals (50 000 bytes) I load them into a new ByteArrayInputStream(buffer); When I try to load the BytearrayInputStream and open it with a player I get the following error message:
    javax.microedition.media.MediaException: Failed to realize Player: Malformed wave media: expected 'RIFF'
    at com.sun.mmedia.WavPlayer.doRealize(+160)
    at com.sun.mmedia.BasicPlayer.realize(+84)
    at src.ViewVideoCanvas.run(ViewVideoCanvas.java:112)
    The command I run is: player = Manager.createPlayer(input, "audio/x-wav");//create new player
    And the error occurs on player.realize();
    I believe that this happens beacause the data is encoded to DVI/rtp. I have searched a lot and found the algorithm of decompressing the DVI data but again I get the same error
    Anyway, this is a brief description of my problem and I hope you can help me.
    Contact me for any more details or help you can provide (code sammples, decoding algorithms and implementations in java)
    Thank you
    Constantinos Loizou

    Hi my name is shaun benjamin and I am sorry I dont have the solution to this problem but could you please do me a fovor. I am looking for j2me source code for an audio streaming midlet tha can stream mp3 or wav. Could you please kindly send me some source code because I am not too fimiliar with j2me and am learning.

  • Help regarding J2ME CDC for VxWorks target

    hi
    i'm getting a NoClassDefFoundError when attempting to run a "HelloWorld" test class in J2ME CDC for VxWorks target.
    i created the boot image for VxWorks through J2ME CDC and made use of that boot image to boot VxWorks.
    in the target, i navigated to "bin" directory using
    cd "<j2me-home>/cdcfoundation/build/vxworks/bin"
    and issued the command
    runJava "-Djava.class.path=../testclasses.zip HelloWorld".
    i got a NoClassDefFoundError when i ran the above command.
    i'm herewith attaching the stack trace for u'r kind perusal.
    please help me out of this situation.
    thanks in advance,
    ashok
    java.lang.NoClassDefFoundError : java.io.VxWorksFileSystem
         at java.io.FileSystem.getFileSystem()Ljava/io/FileSystem;(Native Method)
         at java.io.File.<clinit>()V(File.java:98)
         at java.lang.Class.runStaticInitializers()V(Class.java:1499)
         at sun.misc.Launcher$ExtClassLoader.getExtClassLoader.getExtDirs()
              [Ljava/io/File;(Launcher.java:164)
         at sun.misc.Launcher$ExtClassLoader.getExtClassLoader()
              Lsun/misc/Launcher$ExtClassLoader;(Launcher.java:130)
         at sun.misc.Launcher.<init>()V(Launcher.java:70)
         at sun.misc.Launcher$1.run()Ljava/lang/Object;(Launcher.java:52)
         at java.security.AccessController.doPrivileged0
              (Ljava/security/PrivilegedAction;
                   [Ljava/lang/Object;)Z(AccessController.java:265)
         at java.security.AccessController.doPrivileged
              (Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)
                   Ljava/lang/Object;(AccessController.java:278)
         at java.security.AccessController.doPrivileged
              (Ljava/security/PrivilegedAction;)
                   Ljava.lang/Object;(AccessController.java:251)
         at sun.misc.Launcher.<clinit>()v(Launcher.java:43)
         at java.lang.Class.runStaticInitializers()V(Class.java:1499)
         at java.lang.ClassLoader.getStaticClassLoader()
              Ljava/lang/ClassLoader;(ClassLoader.java:968)

    Did you solve the problem?
    You probably have to need to input "-Xbootclasspath".
    I also have the silimar problem.(UnsatisfiedLinkError)
    If you know about below, let me know. please.
    Thanks in advance.
    -> runJava "-Xbootclasspath=/Flash0/cdc.jar -Djava.class.path=/Flash0 HelloWorld"
    rfaSetMappingContext called!
    rfaSetMappingContext called!
    rfaSetMappingContext called!
    java.lang.UnsatisfiedLinkError: java.io.VxWorksFileSystem.initIDs()V
    at java.io.VxWorksFileSystem.<clinit>()V(Unknown Source)
    at java.lang.Class.runStaticInitializers()V(Unknown Source)
    at java.io.FileSystem.getFileSystem()Ljava/io/FileSystem;(Native Method)
    at java.io.File.<clinit>()V(Unknown Source)
    at java.lang.Class.runStaticInitializers()V(Unknown Source)
    at sun.misc.Launcher.getClassPath(Ljava/lang/String;)[Ljava/io/File;(Unknown Source)
            at sun.misc.Launcher.access$200(Ljava/lang/String;)[Ljava/io/File;(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.getAppClassLoader(Ljava/lang/ClassLoader;)Ljava/lang/ClassLoader;(Unknown Source)
            at sun.misc.Launcher.<init>()V(Unknown Source)
            at sun.misc.Launcher$1.run()Ljava/lang/Object;(Unknown Source)
            at java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;(Unknown Source)
            at java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object;(Unknown Source)
            at sun.misc.Launcher.<clinit>()V(Unknown Source)
            at java.lang.Class.runStaticInitializers()V(Unknown Source)
            at java.lang.ClassLoader.getSystemClassLoader()Ljava/lang/ClassLoader;(Unknown Source)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help with J2ME installation !

    Hi all,
    I am a complete newbie to J2ME.
    I need to start working small applications for Ericsson K750i as a part of my project.
    Can anyone let me know which package I will need to install to be able to write apps for k750i ? Is it the Java Wireless Toolkit that I need ?
    All help much appreciated.
    Thank you.

    First of all I'd suggest you read through MIDP 1.0a and 2.0 specs (see http://www.jcp.org/). This will give you overview of what to expect from J2ME. Additionaly you could read Bluetooth API spec and others.
    For books, Core J2ME by John W. Muchow (http://www.amazon.com/exec/obidos/tg/detail/-/0130669113/002-3226980-2560825?v=glance) is a good starter. If you require it, check out also J2ME Game Programming (http://www.amazon.com/exec/obidos/tg/detail/-/1592001181/002-3226980-2560825?v=glance)
    Hope this helps,
    Peter

  • Need some help on j2me,kvm and microcontroller

    Hi
    I am developing a project in which i want to connect to internet and send data.I have got a modem .I do not have PC at the scene of project.So i want to use a microcontroller to do the job.As you know micro like 8051,AVR,PIC can not do the job well.I mean programming them to do the TCP?Ip and Http is difficult.I am looking for A micro which can be programmed by j2me using a KVM.
    I would be pleased if anybody could help me on a special brand of a micro and some guide to do the job.
    BRs
    Saeed

    I would check your cable supports HDCP first. It is the likely cause and the cheapest to solve it it is the case!
    Jules

  • Help with j2me games

    I'm a student that needs help for my school thesis.I'm new to j2me. I'm trying to develop a multiplayer game via GPRS. i have a few general question to ask.I',m doing a round robin game.
    1) I saw in the nokia forum about the http server and tcp server. What is the main difference?Isn't the internet stack is divided to application, transport and network layer and so on?why will have http server and tcp server?isn't that tcp connection also implemented in http server?
    2) In the http server, the server won't start a connection with the client. If i send a http request to the server to start a new game with my opponent, how do the server will nodify my opponent?My opponent don't know i'm sending a game to him.
    3) Is that tcp server has already successfully implemented now?Is there any free tcp server or i need to code it in J2se?
    4) Is that using WAP or IP router to send the internet stack to the server?Which 1 is better?

    internet stack is divided to application, transport
    and network layer and so on?Yes, but a mobile might not have a IP stack, instead a simple connection to a proxy server, which "talks" to the net.
    how do the server will nodify my opponent?My opponent
    don't know i'm sending a game to him.Perodic updates (polling).
    3) Is that tcp server has already successfully
    implemented now?I dont understand the question. Has anyone used TCP/IP on mobile phones (as client software), yes me: http://j2mevnc.sourceforge.net
    Has anyone used the serversocket. Other than demo-ware, not that I know of, not many phones support socket://, let alone serversocket://
    4) Is that using WAP or IP router to send the internet
    stack to the server?Which 1 is better?Depends on your need.

  • Need help for J2ME WTK, Error 41

    Hi, thanks for taking time to reply my queries concerning the J2ME Wireless Toolkit.
    1. While trying to install a MIDLet using the command line Java Application Manager, I encounter an error that read
    "** Error installing suite (41): A required attribute is missing".
    What does this error mean?? I already checked that all the required attributes for a MIDLet is in the .jad file. I have also configured my http server (which runs locally) to recognize .jad and .jar.
    Here is how I called the install feature:
    emulator -Xjam:install=http://127.0.0.1/MyFile.jad.
    Another note: When I tried to install the MIDLets that came with the J2MEWTK, the installation is successful.
    2. Is there any way to call the JAM to automate installation of a .JAD file while executing a MIDLet in the emulator? For example, I am running MIDLet A.jar and would like to let the user select a file to install within the MIDLet. Then MIDLet A.jar would automatically install this MIDLet using the JAM. Is this possible?
    Please help and thanks again!

    I have the same problem, did you find any solution?

  • Help for J2ME MIDP

    Hello,
    I'm working for a project on MIDP. And i wish to call another MIDlet from the main MIDlet. But while calling it gives a Security exception. Can anybody suggest me any way to do it.
    Also i wish to get the Text to Speech conversion. How can this be implemented?
    Please help me out with this....

    ANYONE?
    There will be Dukes Dollars avaliable!!!

  • Help in J2ME Ant Task

    Hi All
    I ve been trying to import an external .jar file to my application
    I ve did that successfully in Eclipse platform and made the application work with the Emulator
    But the problem is the build that is being created does not contain the expected files in the location src/com/
    As a result the application when installed in Phone devices shows error NoClassDefFound Error
    Please Help me out in adding the code bits in Build.xml file
    Thanks
    Please Help
    Regards,
    Vignesh.M

    Thanks for the link
    While it's not what I am looking for, but it does seems to work, to certain extent
    This helps parameterize the file argument, but does nothing to the output argument
    Does mxmlc allow me to specify an output directory only, and then placed the generated .swf into this location, with the corresponding sub folders for each compiled mxml?
    I read the doc, and tried, and argument for output is filename, and not directory...
    K.K.

  • Help with j2me

    Hello,
    I'm have to develop an application for win CE and I don't know how to start!
    Can somebody help me?
    I think I need the CDC
    a jvm for my desktop computer and another one for my device (here I have my main problems: in sun the only one that I found is some years old and the other ones
    are not free!)
    May be I need also an emulator if yes which type? If found palmos emulator, but I'm not
    sure if it's the one that I need).
    Thank you in advance for all your tips and advices...I'll really need them!

    Is taht i can choose whether use http or tcp connect to the game server?A tcp implementation would obviously perform better, but many phones don't support tcp. So if you want to support all these phones you have to fall back to an http implementation.
    Is that my opponent will always polling from the server although the game haven't start?Yes, both players poll the server all the time.
    The server, for every time a clients polls it, would run something like:
    if this client have a game open then send a game update
    else if someone invited this client then send invitation
    else send available player list.
    shmoove

  • Help; does j2me support IrDA?

    as the title!

    I haven't got this working myself, it was one of the first things I tried when messing with an old Palm III.
    The Palm OS catches those Irda events and J2ME never gets to see them.
    However, at the time I remember reading about an IBM product.
    It was called VAME, and basically I think they had wrapped all the Palm OS calls in Java, so they were directly callable. It was supposed to support J2ME too.
    This could be obselete information by now though...
    regards,
    Owen

  • Need help with J2ME

    i'm trying to make simple apllication for my handphone. is there anybody know where i can find some example?
    ASAP
    [email protected]

    {color:#ff0000}Cross posted{color}{color:#0000ff}
    http://forum.java.sun.com/thread.jspa?threadID=5223452
    http://forum.java.sun.com/thread.jspa?threadID=5223445
    {color}
    {color:#000080}Cross posting is rude.
    db{color}

  • Help with j2me concept

    I still not very clear about http and tcp? Is taht i can choose whether use http or tcp connect to the game server?
    If i use http server and i want to play a multiplayer game with my oppnent. I will send an invitation to the game server.How do the game server inform my opponent?Is that my opponent will always polling from the server although the game haven't start?Isn't that my ooponent will poll from the server jz only the multiplayer game between us start?
    Where can i find a http server and tcp server?IS tomcat a http server?Then, where can i find a tcp server?

    Is taht i can choose whether use http or tcp connect to the game server?A tcp implementation would obviously perform better, but many phones don't support tcp. So if you want to support all these phones you have to fall back to an http implementation.
    Is that my opponent will always polling from the server although the game haven't start?Yes, both players poll the server all the time.
    The server, for every time a clients polls it, would run something like:
    if this client have a game open then send a game update
    else if someone invited this client then send invitation
    else send available player list.
    shmoove

Maybe you are looking for

  • Itunes 10.6.1.7 windows-restoring all devices fails! help!!

    hi, i updated itunes to the latest(10.6.1.7), and wanted to restore my (unjailbroken, btw) iphone 4S on 5.1, to 5.1, but failed, giving me error 3194. i then tried restoring my (also not jailbroken) iphone 4 on 5.1 but it gave me the same error! im s

  • Data Source and ConnectionPool

    This is a query for information about javax.sq.ConnectionPool and javax.sql.DataSource Does datasource represent one connection to a database? - if you register it through JNDI does this just register the object and every time you call it does it ins

  • Camera and Photo app not working?

    I am having an issue with these two apps on my 16gb iphone 3g. Every other apps works normally but these two refuse to open even after a reset, anything known causing this or am i going to have to go through a restore. also going to Wallpaper from th

  • Executing subroutine after commit work, not on commit work

    Hi All, I want to execute my sub-routine after commit work, not on commit work. If any one have answer please mail me at  [email protected]

  • Deploying Forms 9i

    To deploy a forms 9i apllication , Do i have to use OAs9i release 2 (9.0.2.0.1) or can I use OAS 9i release 1