This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes do j2me support finalize() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "do j2me support finalize()" Watch "do j2me support finalize()" New topic
Author

do j2me support finalize()

vicky sandhu
Greenhorn

Joined: Jun 21, 2005
Posts: 3
i m working on midp 1.0 and
cldc 1.0
it gives a problem when ever i try to build with finalize() in my program :-

"ERROR: finalize methods should not appear
Error preverifying class BarBall.MainMenu
com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
Build failed"



plz help


BarBall is a package
and MainMenu is a class
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

I think you got your answer in the Error.

You actually should avoid creating finalize methods in all of Java. You just never know when it will run, or in some cases it might have already run and will not run when it is actually garbaged.

There are many better solutions for any need to code in the finalize method.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
No.

CLDC configurations like you will find on most J2ME devices do not support finalizers. Check the CLDC JSRs. MIDP works on top of CLDC in most devices.

Also, it might not be a good idea to use it as general Java practice, like Mark Spritzler just said. Only if you want something very specific.

[ August 26, 2005: Message edited by: Eduardo Marques ]
[ August 26, 2005: Message edited by: Eduardo Marques ]

Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
Marwan Zeineddine
Greenhorn

Joined: Nov 04, 2009
Posts: 1
CLDC Spec JSR 30 section 4.2

CLDC libraries do not include the method Object.finalize(), and therefore a JVM supporting CLDC shall not support finalization of class instances (JLS sec 12.6). No application built on top of a JVM supporting CLDC shall require tha tifnalization is available.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: do j2me support finalize()