Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How copy to Java code onto Eclipse and make it work?

 
Bala Vavavuvu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am confused as to how copy code for a game, Connect 4, onto Eclipse and make it work.
The problem is I am not sure whether to create a new 'Package' and paste the code there or make a 'Class' and paste it there or whether it's a combination of both.

Or maybe I need an interface....

Here is the code:

package Default;

 
Campbell Ritchie
Sheriff
Pie
Posts: 50258
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I would suggest on Eclipse, you create a Project, then a package, then a class inside that package. You can copy and paste lots in to Eclipse; you can even copy an entire .java file into the right part of the workspace folder and Eclipse will recognise it as a class. It will show up errors like wrong package name, and allow you to correct them.
I would suggest you create a more object‑oriented version of that code, however.

Also package names should start with small letters. In which case Default will turn into a keyword, and the code won't compile. Try a different package name.
 
Norm Radder
Bartender
Posts: 1361
14
 
Campbell Ritchie
Sheriff
Pie
Posts: 50258
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for noticing. I think if you follow the corssposting links you will find that question everywhere on the net
PO: please read this.
 
Vivek SharmaJi
Ranch Hand
Posts: 38
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your class is java class you can directly paste after creating project and package using eclipse. Eclipse has very good features of automatically correct the errors however it may ask the classes your file requires in class path.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic