×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    24

    Unhappy NoClassDefFoundError - Defining a class?

    hi all,

    i'm having problems with simple methods like for file handling or sockets. for instance when i try to open a socket i get the following exception:

    Uncaught exception java/lang/NoClassDefFoundError: java/net/Socket.

    Code:
    try
    {
    	s = new Socket("127.0.0.1", 12345);
    	data_in = new DataInputStream(s.getInputStream());
    	data_out = new PrintStream(s.getOutputStream());
    	System.out.println("connected.");
    }
    catch (Exception e)
    {
    	System.out.println("error connecting.");
    }
    according to the documentation it says that the class is not defined. where can i do this? what does that mean? i use eclipse and the appropriate libraries are already included in the build path.

    thanks a bunch

    oliver

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    You are trying to use J2SE classes in J2ME. That won't work. You'll have to limit yourself to the classes available in MIDP. For sockets look into the Connector and StreamConnection classes in javax.microedition.io.

    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×