aspose file tools*
The moose likes Java Micro Edition and the fly likes C++ vs J2ME Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "C++ vs J2ME" Watch "C++ vs J2ME" New topic
Author

C++ vs J2ME

Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi !
C++ can be used for developing applications for Series 60/80/90 devices offered by Nokia and I suppose other device manufacturers as well.
Java is platform independent, so an application can run on any device by compiling once. What about C++ ? Will an application developed using C++ run on every device without compiling again and again ?
If we have to compile for specific devices then I suppose C++ is not best suited for such applications. Although it does provide more flexibility...
I just want some comments on this issue.
Danish
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
Originally posted by Danish Shaukat:
Java is platform independent, so an application can run on any device by compiling once. What about C++ ? Will an application developed using C++ run on every device without compiling again and again ?

Not only will you have to recompile it for every target - which actually wouldn't be that big a burden - but for many targets, you'll actually have to port the source code as well, because there are many subtly incompatible dialects of C++ out there. For example, the scope of variables declared in a loop control clause is different in Microsoft C++ than it is in ANSI Standard C++.
On the other hand, C++ of one dialect or another are available for a much wider variety of processors than J2ME is, at least at present.
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
If the devices used by customers is not known in advance, then this can cause problems. And I think it is going to be difficult to predict what devices will be used. It would be better to use Java, so that application is device independent.
Danish
Punit Raizada
Ranch Hand

Joined: Mar 20, 2004
Posts: 156
Hi,
C ++ requires some work to be done while porting it to different platforms and this can be a big burden sometimes.
Personally , the choice of the language depends on 2 things
1)The application ( things iam required to access, things iam required to do)
2)THe target devices
In case your client or customer would use say only devices of the same platform (eg. symbian-series 60) .. i would prefer using C++ to develop my app then java.
Java is just too good when it comes to the porting issues but as of now there are quiet a few limitations in the micro edition that make life tough.
One question comes to my mind... i havent tried this... if my jad file says the profile is MIDP 1.0 ..can i install the app on a MIDP 2.0 phone?? i know for a fact that opposite isnt true..
[ April 08, 2004: Message edited by: Punit Raizada ]

SCJP 1.4
Everything that can go wrong will go wrong -Murphy
a sanjuan
Ranch Hand

Joined: Jun 12, 2002
Posts: 164
Originally posted by Punit Raizada:
Hi,
One question comes to my mind... i havent tried this... if my jad file says the profile is MIDP 1.0 ..can i install the app on a MIDP 2.0 phone?? i know for a fact that opposite isnt true..
[ April 08, 2004: Message edited by: Punit Raizada ]

midp 2 phones should be back compatible, so it should work. i don't have an midp 2 phone myself (although i'll be getting the i730 in nextel), so that's conjecture, but it makes sense in order for new midp 2 phones to be able to make use of the great number of midp 1 apps out there.
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
1. Yes, all MIDP 1 apps should run on MIDP 2 devices. I can run MIDP 1 apps on my Nokia 6600.
2. Java may not be as "portable" as you might think. If you have a variety of devices, you need to worry about how different "optional packages" are supported and the screen size etc. Moto devices support a large number of non-standard extension APIs that are not available in any Nokia devices.
3. I think the strengths of Java are developer productivity and the easy provisioning/application life cycle models. There are many excellent IDEs and other tools available in Java that are simply not available in C++. C++ is also very complex in terms of exception handling and memory handling. Just try to write a hello world in Symbian C++ and you will see what I mean.


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Fred Grott
Ranch Hand

Joined: Oct 05, 2002
Posts: 346
Originally posted by Michael Yuan:
1. Yes, all MIDP 1 apps should run on MIDP 2 devices. I can run MIDP 1 apps on my Nokia 6600.
2. Java may not be as "portable" as you might think. If you have a variety of devices, you need to worry about how different "optional packages" are supported and the screen size etc. Moto devices support a large number of non-standard extension APIs that are not available in any Nokia devices.
3. I think the strengths of Java are developer productivity and the easy provisioning/application life cycle models. There are many excellent IDEs and other tools available in Java that are simply not available in C++. C++ is also very complex in terms of exception handling and memory handling. Just try to write a hello world in Symbian C++ and you will see what I mean.

Michael would not point 2 only apply to MIDP1.0 apps? Not trying to quibble here, but we need to understand that J2ME MIDP is moving more towards full portability with each MIDP version..


MobileBytes blog - Sharing Technology - My Programming Knols
Orika Akawana
Ranch Hand

Joined: Mar 22, 2004
Posts: 36
Java is platform independent

Well... theoretically yes, but not practically. We use a real time "make" server application every time user wants to download application. So, this means we REmake application jar every time. And this is often the only way to reduce problems with "independency".
What about C++ ? Will an application developed using C++ run on every device without compiling again and again ?

Some code will run on series 60 nokia without recompilation. But in most cases You will need not only recompile but change your code.
And here is the question... if I shoud remake my java app every time why not to use C++ and remake it in the same way The only PLUS in java usage is that You will need small changes.


I am not really coming from the outer space. I am mentally diverged. <br />Are you mentally diverged too, my friend?<br />(c)"12 Monkeys"
a sanjuan
Ranch Hand

Joined: Jun 12, 2002
Posts: 164
"Michael would not point 2 only apply to MIDP1.0 apps? Not trying to quibble here, but we need to understand that J2ME MIDP is moving more towards full portability with each MIDP version.."
there will always be optional packages and device-specific package, which means platform independence is always relative to HOW a developer chooses to code the app and how platform independent (versus versatile) ne wants it to be.
vito o'reilly
Greenhorn

Joined: Feb 17, 2004
Posts: 1
BREW Application is developed with C++.
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
Originally posted by vito o'reilly:
BREW Application is developed with C++.

Although BREW is popular with carriers, it is one of the worse platforms for individual developers. You would need to pay $400+ up front in order to start developing for BREW.
On the other hand, CDMA phones are starting to support J2ME as well. The newest Nokia CDMA phone models support both MIDP 2 and BREW. I do not think BREW is a viable platform beyond low cost consumer games in the long run.
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Originally posted by Orika Akawana:

And here is the question... if I shoud remake my java app every time why not to use C++ and remake it in the same way The only PLUS in java usage is that You will need small changes.


We are also dynamically building our applications at download time. You do make an important point here.
Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
Is there any way to program the 3310(asian) nokia mobile ? I know its not java enabled but then it HAS to be c++. But how do we know if it's Symbian OS c++ or embedded vc++ or some other ?
Anjanesh


Anjanesh Lekshminarayanan
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Anjanesh Lekshminarayanan:
Is there any way to program the 3310(asian) nokia mobile ? I know its not java enabled but then it HAS to be c++. But how do we know if it's Symbian OS c++ or embedded vc++ or some other ?
Anjanesh
You should be able to find this kind of phone specifications from the forum.nokia.com site.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Punit Raizada
Ranch Hand

Joined: Mar 20, 2004
Posts: 156

Iam diverting a bit from the topic at hand, some of the posts on this thread state that midlets have to be built(make) on the fly during the download. Iam new to this field and as yet havent seen any midlet downloaded to the phone.. we are still in the development stage and use bluetooth to transfer our midlets to the device to test it out.
I know that the carriers will eventually place the midlet jar in some sort of a vending machine from where the user can download the jar on their phone...
can anyone point me to some GOOD literature on this process or provide a brief intro into what has to be done to actually deploy the midlet..

Also, isnt BREW more similar to C than C ++ .. just my observation ..
[ April 12, 2004: Message edited by: Punit Raizada ]
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Originally posted by Punit Raizada:

can anyone point me to some GOOD literature on this process or provide a brief intro into what has to be done to actually deploy the midlet..
[ April 12, 2004: Message edited by: Punit Raizada ]

For OTA (Over The Air) deployment of a Midlet, you have to create a WML page. Give a link to the JAD file. Once the JAD file is downloaded to the device, the applicaion management software will automatically download your JAR file. You have to provide the URL of the JAR file in your JAD file.
Danish
Punit Raizada
Ranch Hand

Joined: Mar 20, 2004
Posts: 156
hi,
yeah i thought it would be something like that. But what iam a bit confused about is why do we need to build the midlets at download time. Is it because of the device that is asking for the midlet ???
a sanjuan
Ranch Hand

Joined: Jun 12, 2002
Posts: 164
don't be confused by orika's post. you do NOT need to automatically rebuild a midlet for every download.
itndc
Greenhorn

Joined: Apr 16, 2004
Posts: 1
Hi very interesting discussion
Java midlets don't run in any device except in the case you design something like a simple popcorn game. If you want to take advantage of graphics for specific devices then you have to rebuild your code sometimes. In other words your program still depends on the phone and you have to check in the HTTP header for the model or brand before you let the user download the file if you do not want to dissapoint him/her.
I think BREW is an excelent implementation and you still can run java over Brew. Brew is faster and uses less memory which for devices is extremely important. In that way you can suply better applications to those people who buy BREW devices.
best regards
a sanjuan
Ranch Hand

Joined: Jun 12, 2002
Posts: 164
except brew is limited in terms of the number of devices running it compared to MIDP. however, it is a good sign that the new brew phones seem to come with midp2, just like the new linux and windows phones.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: C++ vs J2ME