Anytime I have to work with Eclipse I feel like I've been removed a leg and half of my fingers : handicapped. And yet at some point I'll have to be comfortable with the IDE (ie: by this summer - I'll have to work in Java mainly).
So aside from putting you in context, I have a precise question.
I have a homework to do, in Java. It must be done on Linux because the provided code includes bash scripts and the like, but Eclipse looks the same to me on Linux and Windows. So anyway. There are four .java files that come in a zip file, they are classes and one is the program with a main method. I want to use that as my "project" in eclipse (like projects in Visual Studio) : be able to edit the files, add new ones, debug the thing, run the thing, etc.
Now I've messed around and got it somehow running but I know I wasn't doing everything as I should. I created a new project in the workspace, click-and-dragged the files into the package, and started editing them. At some point though I realised the changes I made weren't taken into account, and I was somehow editing copies of the files that were not part of the project. A few copy-pastes fixed the problem but heck, that's not too professional.
So please give me a basic tutorial on how to accomplish this.
There I'll give you some Java code :
// MainProgram.java
public class MainProgram
{
public static void main(String[] args)
{
HelloWorld.printMessage();
}
}
// HelloWorld.java
public class HelloWorld
{
public static void printMessage()
{
System.out.println("Hello World!");
}
}
These are existing files, their name is indicated in comments. Please tell me step by step (I'm stupid, ok ?) how to compile and debug that code properly in Eclipse.
Question
Andre S. Veteran
Anytime I have to work with Eclipse I feel like I've been removed a leg and half of my fingers : handicapped. And yet at some point I'll have to be comfortable with the IDE (ie: by this summer - I'll have to work in Java mainly).
So aside from putting you in context, I have a precise question.
I have a homework to do, in Java. It must be done on Linux because the provided code includes bash scripts and the like, but Eclipse looks the same to me on Linux and Windows. So anyway. There are four .java files that come in a zip file, they are classes and one is the program with a main method. I want to use that as my "project" in eclipse (like projects in Visual Studio) : be able to edit the files, add new ones, debug the thing, run the thing, etc.
Now I've messed around and got it somehow running but I know I wasn't doing everything as I should. I created a new project in the workspace, click-and-dragged the files into the package, and started editing them. At some point though I realised the changes I made weren't taken into account, and I was somehow editing copies of the files that were not part of the project. A few copy-pastes fixed the problem but heck, that's not too professional.
So please give me a basic tutorial on how to accomplish this.
There I'll give you some Java code :
// MainProgram.java public class MainProgram { public static void main(String[] args) { HelloWorld.printMessage(); } }// HelloWorld.java public class HelloWorld { public static void printMessage() { System.out.println("Hello World!"); } }These are existing files, their name is indicated in comments. Please tell me step by step (I'm stupid, ok ?) how to compile and debug that code properly in Eclipse.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts