Reputation: 23342
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
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
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
Reputation: 159844
You need to import it from the java.io
package:
import java.io.Serializable;
Upvotes: 7
Reputation: 6406
Yes, Serializable
is an interface. Perhaps you've failed to configure your build path correctly?
Upvotes: 1