Tim
Tim

Reputation: 1074

Java - Eclipse packages

I have the following package on Eclipse:

com.mortgageapp.projects.app

I'm not interested about the package format at the moment, it's just testing. But I'm wondering how to run the app from the terminal (Windows and Mac)?

It contains a Main.java file where it will begin so I have tried locating and entering the src folder. Then doing something like: javac com/mortgageapp/projects/app/Main.java (or: javac com/mortgageapp/projects/app/*.java).

Just wondering if this is current as when I then do: java com/mortgageapp/projects/app/Main I get a few errors.

Upvotes: 0

Views: 151

Answers (2)

Krumelur
Krumelur

Reputation: 32597

I assume you are writing an RCP application.

Export the project as a RCP application (click the "export" link in your product configuration). You should get a runnable application file.

If you really want to run the application from the terminal, you need to use the main function in the EclipseStarter. But you don't want to go there unless you are doing something very special.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1503839

Your compilation is probably okay, but to run it you need to specify the class name, not a filename:

java com.mortgageapp.projects.app.Main

That's assuming the current directory is in the classpath. If it's not, you may need:

java -cp . com.mortgageapp.projects.app.Main

Upvotes: 2

Related Questions