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

Status
Not open for further replies.
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?
 

TechLord

Right off the assembly line
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... :)
 

Plasma_Snake

Indidiot
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. ;)
 

TechLord

Right off the assembly line
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...
 

Plasma_Snake

Indidiot
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.
 
Status
Not open for further replies.
Top Bottom