user1269592
user1269592

Reputation: 701

How to run Java my project with eclipse

I have started learning Java and I have 1 issue:

I write a simple class and it runs and everything's fine. I took all the project from my Laptop to my other computer and from Eclipse I choose "File --> Open File" and choose my .java file.

When I try to run my program this windows pop up:

enter image description here

and after trying both option nothing happen.

How can I run my program and what is the problem ?

Upvotes: 0

Views: 17036

Answers (4)

user1288336
user1288336

Reputation:

you need to create your public class and then just click on the green button with the white triangle on it ;) See here: https://i.sstatic.net/5TEtI.png

Upvotes: 0

aretai
aretai

Reputation: 1641

There is no problem with learning Java with Eclipse or any other IDE. If you move file from one computer to the other you need as it was said start a new project or you can use existing project and import files. In order to import files right click on a project and click then Import and select files. Then you should be able to run your class. Also be sure to have the Java perspective selected when you work on your class.

Upvotes: 0

GingerHead
GingerHead

Reputation: 8230

Perform the following steps:

  1. Create a new project in eclipse
  2. Link your classes from the project properties' buildpath
  3. Go to Run->Run Configurations
  4. Create a new configration
  5. Point your main class
  6. And Run

Upvotes: 1

hndr
hndr

Reputation: 767

if you are just starting learning Java and dont understand whats going on with all that stuff with eclipse, I would recommend you to start from the basics, write your code in an ordinary text editor (notepad will do, or notepad++ if you want something more), after you have written and saved your source file, open up your command prompt, navigate to the location of the file, and run:

javac YourFileName.java
java YourFileName

here is more detailed guide:http://introcs.cs.princeton.edu/java/15inout/windows-cmd.html

Upvotes: 0

Related Questions