Skip to content

hello java problems #3

@Xymmer

Description

@Xymmer

I write this to help out fellow readers of Learning Java. If you know of a more appropriate forum, please let me know.

If you are new, have downloaded eclipse_examples, and are following very first hello world "hello java" in the book literally (like I am, I have a bit of fooling with java under my belt but am starting from the beginning), you will try to run hellojava from "ch02" and it won't work.

  1. The hellojava.java file (not 1, 2, etc.) simple example as described in the book is actually commented out. Because of this you are shown the final complicated one is at the bottom. Eclipse automatically collapses all comments but it's there, at the top. Click the [+] to expand the comment. Then move the last / to to end, then uncomment the first class by moving / from before the first "public class HelloJava" to after it.
  2. You need the following above "public class HelloJava":

package ch02;

The reason being, hellojava.java is in ch02, which is a folder within the project and Java thinks you are making packages. I only know this from fooling around and searching the Internet for answers.

Another solution is to start a new project on your own and copy and paste the example in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions