aspose file tools*
The moose likes Beginning Java and the fly likes How copy to Java code onto Eclipse and make it work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How copy to Java code onto Eclipse and make it work?" Watch "How copy to Java code onto Eclipse and make it work?" New topic
Forums: Beginning Java IDEs, Version Control and other tools
Author

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

Bala Vavavuvu
Greenhorn

Joined: Oct 13, 2013
Posts: 1
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

Joined: Oct 13, 2005
Posts: 38888
    
  23
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
Ranch Hand

Joined: Aug 10, 2005
Posts: 686
Also posted at: http://www.javaprogrammingforums.com/java-ides/32867-how-java-code-onto-eclipse-make-work.html#post126050
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38888
    
  23
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

Joined: Dec 09, 2012
Posts: 38

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How copy to Java code onto Eclipse and make it work?