CodyBugstein
CodyBugstein

Reputation: 23342

"Serializable cannot be resolved to a type"

I'm using Eclipse to create a simple project. I'm trying to implement Serializable in my Java class, but Eclipse is not recognizing it saying "Serializable cannot be resolved to a type" and offering me to create an inteface called Serializable.

public class Location implements Serializable {

Isn't Serializable supposed to be a built in interface? How do I get it to work?

Upvotes: 1

Views: 12732

Answers (4)

Sorinzo
Sorinzo

Reputation: 17

you have just to right click on your project => buildpath => jre => and you specify the right jre and it will gives you the possibility of importing java.io.Serialisable;

Upvotes: 0

gd1
gd1

Reputation: 11403

You have to import java.io.Serializable.

If you click the "error icon" in Eclipse, at the left of the offending line, Eclipse can do it for you. Or just press Ctrl+Shift+O.

Upvotes: 3

Reimeus
Reimeus

Reputation: 159844

You need to import it from the java.io package:

import java.io.Serializable;

Upvotes: 7

user1329572
user1329572

Reputation: 6406

Yes, Serializable is an interface. Perhaps you've failed to configure your build path correctly?

Upvotes: 1

Related Questions