|
Re: Launch Error in Java [message #1696201 is a reply to message #1695985] |
Fri, 22 May 2015 19:39  |
Eclipse User |
|
|
|
Hey Adam, no, both things you tried are wrong. Sorry. 
When you created your "ch02" project, you should have had folder called "src" and the "JRE System Library" (it's kind of a fake folder, don't worry about it). Your source code goes in the src folder. But, and this is crucial, you first need to create packages inside the src folder that match the structure of the "package" statement in each .java file, then put each .java file in the right package. So, for CalculationApp, your structure should look like this:
ch02
-> src
---> org
-----> opensourcephysics
-------> sip
---------> ch02
-----------> CalculationApp.java
-----------> SomeOtherJavaFile.java
-----------> YetAnotherJavaFile.java
BTW, your code is automatically compiling already. Those "error flags" in the first page of your pdf? Those are compile errors. I think maybe the other two screens have no errors because Eclipse couldn't recognize that you intended those files to be compiled (because they aren't inside a source folder like "src" (although maybe your classpath stuff overcame that somehow)), and consequently couldn't find the "main" method in CalculationApp when you tried to run ("launch") it.
|
|
|
Powered by
FUDForum. Page generated in 0.29306 seconds