Why can't I run my java Hello World program if it is inside a package?

前端 未结 3 1358
你的背包
你的背包 2020-12-17 19:09

I created a file called \"Hello.java\" that looks like this:

public class Hello {
        public static void main(String[] args) {
                System.out         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 19:32

    Try java testpackage.Hello.

    Because this is in your classpath, you should be able to run that from any working directory, but refer to it by its full name.

提交回复
热议问题