This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
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;

 
Marshal
Posts: 60069
188
  • 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.
 
Campbell Ritchie
Marshal
Posts: 60069
188
  • 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.
 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!