Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCarl Johnson
1,232 PointsI got a bunch of errors, wich i am not able to fix
So i watched the video on serialization. I wrote the same code as the instructor/tutor, but i got a bunch of error-messages and wasnt able to compile. Here is my Treets.java:
package com.teamtreehouse;
import java.io.*;
public class Treets {
public static void save(Treet[] treets){
try (
FileOutputStream fos = new FileOutputStream("treets.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
) {
oos.writeObject(treets);
} catch(IOException ioe) {
System.out.println("Problem saving Treets");
ioe.printStackTrace();
}
}
}
My Errors:
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
./com/teamtreehouse/Treets.java:8: error: <identifier> expected
public void static save(Treet[] treets){
^
./com/teamtreehouse/Treets.java:8: error: '(' expected
public void static save(Treet[] treets){
^
./com/teamtreehouse/Treets.java:8: error: invalid method declaration; return type required
public void static save(Treet[] treets){
^
./com/teamtreehouse/Treets.java:23: error: class, interface, or enum expected
}
I don't even get the first error-message. I am sitting here really frustrated...
4 Answers
Carl Johnson
1,232 PointsFor sure:
Link to the video: https://teamtreehouse.com/library/serialization
Link to the Workspace (hope it works): https://w.trhou.se/cw43w9tssi
thanks a lot for your efford :)
Steve Hunter
57,712 PointsWorkspace didn't work. Click the icon top-right that looks like a briefcase with a dot on it. (It's a camera!) That'll open a new window - share that link.
Carl Johnson
1,232 PointsHey,
sorry, i am new on teamtreehouse. I hope this link will work: https://w.trhou.se/cw43w9tssi
kind regards,
carl
Carl Johnson
1,232 PointsYeah, now after reloading the whole workspace i did not get any errors. Maybe the workspace was buggy. Thanks for the efford. I try to do the whole video again.
Steve Hunter
57,712 PointsAll works fine here too.
Good luck with the rest of the course.
Steve.
Steve Hunter
57,712 PointsOK - I've got your code. What did you run to generate the errors? I did javac Example.java && java Example
and this worked fine.
What did you try?
Steve.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsCan you post a link to the course and also share your workspace link?
Steve.