Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / July 2003

Tip: Looking for answers? Try searching our database.

kvm giving alert.. why?

Thread view: 
shameless - 16 Jul 2003 03:44 GMT
Hi there,

I am using the WIN32 sun implementation from CLDC Version 1.1. I
compiled the simple helloworld.java but when i tried to open a serial
port i get the alert error. The exact code works fine on under a J2SE
VM running CDLC. I examined the Connection classes and it has a static
initialiser block. I then added the static initialiser block to the
helloworld and guess what?... it caused and alert!

import java.io.*;
import java.lang.*;
import javax.microedition.io.*;

public class hello
{

   static {
           Object obj =
System.getProperty("microedition.configuration");
         if( obj == null ){
         System.out.println( "static hello" + obj.toString());
        }
    }

public static void main(String[] args) {
    System.out.println( "hello");

}
}

What is going on here?

any help appreciated.

-lucio
Gordon Beaton - 16 Jul 2003 04:03 GMT
> I am using the WIN32 sun implementation from CLDC Version 1.1. I
> compiled the simple helloworld.java but when i tried to open a
[quoted text clipped - 18 lines]
>         }
>     }

Don't call obj.toString() when obj is null! Probably you meant to do
this instead:

 if (obj != null) {
   System.out.println( "static hello" + obj.toString());
 }

Of course your code will work fine when the property is found and obj
isn't null.

/gordon

Signature

[ do not send me private copies of your followups ]
g o r d o n . b e a t o n @ e r i c s s o n . c o m



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.