This discussion is archived
1 Reply Latest reply: Jan 26, 2013 11:32 PM by EJP RSS

I have a simple question

987362 Newbie
Currently Being Moderated
I am a beginner of java, I wrote a simple HelloWorld.java first, just like this:

package cn.com.sino;
public class HelloWorld
{
     public static void main(String[] args)
{   
System.out.println("HelloWorld!");
}
}

this program is saved in D:\workspace
in this directory , it passed javac, and i use java like this :

d:\workspace>java cn/com/sino/HelloWorld (after i copy HelloWorld.class into d:\workspace\cn\com\sino\)

it run correctly: HelloWorld!

But how i use java at directory "d:\>" or "d:\workspace\cn\com\sino>" ?
at d:\> I use "d:\>java d:\workspace\cn\com\sino\HelloWorld", But its not run right.
Thanks very much!

Edited by: 984359 on 2013-1-27 上午12:02
  • 1. Re: I have a simple question
    EJP Guru
    Currently Being Moderated
    d:\workspace>java cn/com/sino/HelloWorld

    it run correctly: HelloWorld!
    It shouldn't. The correct argument is cn.com.simo.HelloWorld.
    But how i use java at directory "d:\>" or "d:\workspace\cn\com\sino>" ?
    at d:\> I use "d:\>java d:\workspace\cn\com\sino\HelloWorld", But its not run right.
    Correct. It shouldn't.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points