• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

do j2me support finalize()

 
vicky sandhu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Eduardo Marques
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marwan Zeineddine
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic