Poisonshirimp
Poisonshirimp

Reputation: 1

Why can't the Java compiler find symbols?

I have been working to resolve the following 4 errors for days.

Here is a short reproducible example:

import java.util.logging.Level1;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.logging.Logger;

public class RcvThread2 implements Runnable{
    private static final int sizeBuf = 50;
    private Socket clientSock;
    private Logger logger;
    private socketAddress clientAddress;

    public RcvThread2(Socket clntSock, socketAddress clientAddress, Logger logger) {
        this.clientSock = clntSock;
        this.logger = logger;
        this.clientAddress = clientAddress;
    }

    public void run(
        try {
            InputStream ins = clientSocket.getInputStream();
            OutputStream outs = clientSocket.getOutputStream();
            // ...    

Why do I get these four compiler errors? How can I fix them?

error : cannot find symbol
import java.util.logging.Level1;

symbol: class Level1
location: package java.util.logging

error : cannot find symbol
InputStream ins = clientSocket.getInputStream();

symbol: variable clientSocket
location: class RcvThread2

error: cannot find symbol
OutputStream outs = clientSocket.getOutputStream();

symbol : variable clientSocket
location: class RcvThread2

Upvotes: 0

Views: 113

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201487

Remove the line import java.util.logging.Level1; (that doesn't exist, I think you wanted import java.util.logging.Level). And socketAddress clientAddress should be SocketAddress clientAddress (that's why you get the messages about undefined methods with clientAddress).

Upvotes: 3

Related Questions