How to run a simple java program on a Java ready phone?

Discussion in 'Programming' started by thewisecrab, Aug 25, 2009.

Thread Status:
Not open for further replies.
  1. thewisecrab

    thewisecrab AFK

    Joined:
    Oct 13, 2006
    Messages:
    1,597
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Bombay
    Hi all.

    Since my earlier posts here, I can say that I'm a bit more comfortable with Java now. ie, I can atleast write a few programs without help from friends/teachers.

    I'm studying Java as it's in my syllabus, not to be a programmer, but even so, that's going well.

    Anyway (back to the point), suppose this is a pretty rudimentary program
    Code:
    import java.io.*;
    public class TwinPrime
    {
        public static void main(String args[])throws IOException
        {
            int a=1,b,i,j,n,flag;
            InputStreamReader isr=new InputStreamReader(System.in);
            BufferedReader br=new BufferedReader(isr);
            System.out.println("Enter a value:");
            n=Integer.parseInt(br.readLine());
            for(i=2;i<=n;i++)
                {   
                    flag=0;
                    for(j=2;j<=i/2;j++)
                        {
                            if(i%j==0)
                                {
                                    flag=1;
                                    break;
                                }
                        }
                        if(flag==0)
                        {
                            b=i;
                            if(b-a==2)
                            System.out.println("The twin numbers are:"+a+" "+b+" ");
                            a=b;
                        }
                }
                
            }
    }
    Is there anyway I run it as an app on a Java ready phone? like on s40 series of Nokia or Moto?

    I dont want to view the .java file (ReadManiac can do that) but I want to actually run the program (ie. accept values from user in runtime and display output)

    So, is there any way?
     
  2. OP
    OP
    thewisecrab

    thewisecrab AFK

    Joined:
    Oct 13, 2006
    Messages:
    1,597
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Bombay
    BUmP!!!!

    :|
     
  3. TechLord

    TechLord New Member

    Joined:
    Feb 6, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    India
    As far as i know you have to compile it and make it into a .sis file, which can be installed on mobiles.But most of the present Symbian phones require Digital Signing of the program in the form of Digital Certificates, without which the programs don't install on the phones!This is supposedly for security purposes!
    So good luck researching... :)
     
  4. Plasma_Snake

    Plasma_Snake Indidiot

    Joined:
    Dec 22, 2007
    Messages:
    1,401
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rock Island
    Techlord, he wants to do it on a JAVA phone, a Series 40 phone and these devices don't support .sis packages. For running a program in S40 device, u'll probably need to make an executable .jar file which is supported and run by these devices. There r third-party installers available too but u can do so from Netbeans itself. How exactly, well I too have to find this out as today was my only 2nd class of J2ME programming. ;)
     
  5. OP
    OP
    thewisecrab

    thewisecrab AFK

    Joined:
    Oct 13, 2006
    Messages:
    1,597
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Bombay
    Any luck plasma_snake?
     
  6. phuchungbhutia

    phuchungbhutia Om Ma Ni Pä Me Hum

    Joined:
    Jun 7, 2007
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    sikkim
    Y dont you do it first in Eclipse ide it can simulate phone . . Then try in phones . .
     
  7. TechLord

    TechLord New Member

    Joined:
    Feb 6, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    India
    sorry Plasma_Snake...I meant .jar file only... :) Slip of tongue...
    And you are right...i worked on the S60 phones. Don't have much experience on the S40 phones...
     
  8. Plasma_Snake

    Plasma_Snake Indidiot

    Joined:
    Dec 22, 2007
    Messages:
    1,401
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rock Island
    To make an app run on the phone, it can't be a conventional app as the architecture of the programming and OS is totally different on a phone, whether its a Java phone running a KVM or a S60 phone where apps r mostly Objective-C and C++ based.
    I'll create a Midlet for what u want and display its code here,soon.
     
Thread Status:
Not open for further replies.

Share This Page