I'm seeing issues when trying to do a "Run" or "Run As". I went through the HelloWorld tutorial to make sure I'm not missing anything, and at the end of the tutorial when it says:
To run your application, right-click on your class in the Package Explorer and select Run As > Java Application. The Console view should appear at the bottom and display the "Hello, world!" output.
There is only "Open Run Dialog..." when I right click on the class and hover on "Run As". If I go through and add a configuration under "Java Application" (and add HelloWorld as the class) or just click the run button on the toolbar and choose "Java Application", I get the following error:
Exception in thread "main" java.lang.NoSuchMethodError: main Error: A JNI error has occurred, please check your installation and try again
What am I missing?
--Tim _________________________________________________________________________________ / NEW YORK-- Kraft Foods, Inc. announced today that its board of \ | directors unanimously rejected the $11 billion takeover bid by Philip | | Morris and Co. A Kraft spokesman stated in a press conference that the | | offer was rejected because the $90-per-share bid did not reflect the | | true value of the company. | | Wall Street insiders, however, tell quite a different story. | | Apparently, the Kraft board of directors had all but signed the takeover | | agreement when they learned of Philip Morris' marketing plans for one of | | their major Middle East subsidiaries. To a person, the board voted to | | reject the bid when they discovered that the tobacco giant intended to | \ reorganize Israeli Cheddar, Ltd., and name the new company Cheeses of Nazareth. / --------------------------------------------------------------------------------- \ \ \ \ /\ ( ) .( o ).
Timothy Selivanow wrote:
I'm seeing issues when trying to do a "Run" or "Run As". I went through the HelloWorld tutorial to make sure I'm not missing anything, and at the end of the tutorial when it says:
To run your application, right-click on your class in the Package Explorer and select Run As > Java Application. The Console view should appear at the bottom and display the "Hello, world!" output.
There is only "Open Run Dialog..." when I right click on the class and hover on "Run As". If I go through and add a configuration under "Java Application" (and add HelloWorld as the class) or just click the run button on the toolbar and choose "Java Application", I get the following error:
Exception in thread "main" java.lang.NoSuchMethodError: main Error: A JNI error has occurred, please check your installation and try again
What am I missing?
Timothy,
It appears you do not have a proper main method. You should have the following method in your HelloWorld.java file:
public static void main(String[] args) { System.out.println("Hello World!"); }
You would have gotten this when you created your New Class if you asked it to create your main method (there is a click box).
If you right-click on the java file, you will be offered the option to run it as a Java Application. If you rename it to main2, for example, you will instead see "Open Run Dialog" offered. If you try and force this to be run via the dialog, you will get the error message you are seeing which is entirely expected.
-- Jeff J.
--Tim _________________________________________________________________________________ / NEW YORK-- Kraft Foods, Inc. announced today that its board of \ | directors unanimously rejected the $11 billion takeover bid by Philip | | Morris and Co. A Kraft spokesman stated in a press conference that the | | offer was rejected because the $90-per-share bid did not reflect the | | true value of the company. | | Wall Street insiders, however, tell quite a different story. | | Apparently, the Kraft board of directors had all but signed the takeover | | agreement when they learned of Philip Morris' marketing plans for one of | | their major Middle East subsidiaries. To a person, the board voted to | | reject the bid when they discovered that the tobacco giant intended to | \ reorganize Israeli Cheddar, Ltd., and name the new company Cheeses of Nazareth. /
\ \ \ \ /\ ( ) .( o ).
-- fedora-devel-java-list mailing list fedora-devel-java-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-devel-java-list
On Tue, 2007-12-04 at 16:51 -0500, Jeff Johnston wrote:
Timothy,
It appears you do not have a proper main method. You should have the following method in your HelloWorld.java file:
public static void main(String[] args) { System.out.println("Hello World!"); }
You would have gotten this when you created your New Class if you asked it to create your main method (there is a click box).
If you right-click on the java file, you will be offered the option to run it as a Java Application. If you rename it to main2, for example, you will instead see "Open Run Dialog" offered. If you try and force this to be run via the dialog, you will get the error message you are seeing which is entirely expected.
-- Jeff J.
I had the method defined, but I had removed "String[] args" thinking that I didn't need to pass anything to it so I should take it out. Does this mean that main() needs at least that argument declaration to work properly?
--Tim ________________________________________________________________________ / If you float on instinct alone, how can you calculate the buoyancy for \ | the computed load? | \ -- Christopher Hodder-Williams / ------------------------------------------------------------------------ \ \ \ \ /\ ( ) .( o ).
Timothy Selivanow wrote:
On Tue, 2007-12-04 at 16:51 -0500, Jeff Johnston wrote:
Timothy,
It appears you do not have a proper main method. You should have the following method in your HelloWorld.java file:
public static void main(String[] args) { System.out.println("Hello World!"); }
You would have gotten this when you created your New Class if you asked it to create your main method (there is a click box).
If you right-click on the java file, you will be offered the option to run it as a Java Application. If you rename it to main2, for example, you will instead see "Open Run Dialog" offered. If you try and force this to be run via the dialog, you will get the error message you are seeing which is entirely expected.
-- Jeff J.
I had the method defined, but I had removed "String[] args" thinking that I didn't need to pass anything to it so I should take it out. Does this mean that main() needs at least that argument declaration to work properly?
Yes. It is looking for that particular main signature. If you rename it don't make it public or static, all of these will cause the same problem.
-- Jeff J.
--Tim ________________________________________________________________________ / If you float on instinct alone, how can you calculate the buoyancy for \ | the computed load? | \ -- Christopher Hodder-Williams /
\ \ \ \ /\ ( ) .( o ).
-- fedora-devel-java-list mailing list fedora-devel-java-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-devel-java-list
java-devel@lists.fedoraproject.org