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 trial

General Discussion Guess How Many Are In The Jar Game in Android

Tyler Combs
Tyler Combs
15,525 Points

Lost 50% of my project because I didn't know my main method needed to reside in a file called "Game.java".

So, I had just finished my project. Checked all the requirements and was sure I had done everything correctly, even all of the "exceeds" ratings. As I ran the ./gradlew test it didn't compile because my main method was in a file called Jar.java and my game logic resided in Game.java. I finished my facepalm and got myself ready to rename the files and then sift through my code and update it to reflect the new changes. I was going to rename my Jar.java to Game.java, and then my Game.java to Jar.java. I renamed Jar to Game, expecting it to automatically give it a "(1)" like any other file that holds the same name as another. Instead, this replaced my Game.java file. This was ~200 lines of code... I don't suppose there's a way to revert this? It's taken me 2 weeks to do this project.

2 Answers

Daniel Vigil
Daniel Vigil
26,473 Points

Tyler -

The easiest answer is Git. If you are using VCS, you can revert back to and older version by running Git log from your terminal and choosing a commit prior to the over write. You can also do a git reset. You can read documentation on it here. There are some really good videos here, that will help walk you through versioning with Git.

Aside from that, I would look at any documentation on the IDE you are using to see if there is a way to do it.

Best of luck.

Tyler Combs
Tyler Combs
15,525 Points

Thanks for the reply. I have been doing this project in workspace. I don't suppose it has version restoration? I've looked and haven't seen anything but thought maybe there's a "secret" way to do it.

I think I was just feeling a little overwhelmed when this happened because I started over and its been going a lot quicker and smoother so obviously ive been learning.

Daniel Vigil
Daniel Vigil
26,473 Points

Well on the plus side you can tell you are learning and that is always good. I am not to sure about workspaces though. Have you tried the slack channels related to the TechDegree? There is a link to them on your Degree home page on the right hand side. You should see the link as you scroll down. It is a good resource to use as well for when you have questions on certain projects.