Beste mensen, weet iemand wat dit betekend en wat je er aan kan doen?
Debug:
C:\Documents and Settings\Out10\Desktop\Tentamen4Java\ITassesment\Client.java:45: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
codee = (String) isFromServer.readObject();
^
1 error
Tool completed with exit code 1
bij voorbaat dank.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
| // Client.java: The client sends the input to the server and receives
// result back from the server
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.*;
import java.lang.String.*;
public class Client {
String codee = "";
// Main method
public void main(String[] args)
{
try
{
// Create a socket to connect to the server
Socket connectToServer = new Socket("localhost", 8000);
// Create an input stream to receive data from the server
ObjectInputStream isFromServer = new ObjectInputStream(
connectToServer.getInputStream());
// Create an output stream to send data to the server
ObjectOutputStream osToServer =
new ObjectOutputStream(connectToServer.getOutputStream());
// Continuously send radius and receive area from the server
while (true)
{
// Read the radius from the keyboard
System.out.print("Please enter a code: ");
String code = MyInput.readString();
// Send the radius to the server
osToServer.writeObject(code);
osToServer.flush();
// Get area from the server
codee = (String) isFromServer.readObject();
// Print area on the console
System.out.println("code received from the server is "
+ codee);
}
}
catch (IOException ex)
{
System.err.println(ex);
}
}
} |
Debug:
C:\Documents and Settings\Out10\Desktop\Tentamen4Java\ITassesment\Client.java:45: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
codee = (String) isFromServer.readObject();
^
1 error
Tool completed with exit code 1
bij voorbaat dank.
No Signature