Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

that's why?  RSS feed

 
Bin Qian
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,everyone,thank you for replying me..
My problem is below :
i put a file named NewSay.java in the E:\javatest\ranch,and i set the classpath like .;C:\jdk1.5.0_07\lib;E:\javatest ,and in the programme " package ranch;

class NewSay{
....
}"
i can compile it,but it's can't run ,it's said that 'wrong name:ranch/NewSay',but if i remove the 'package ranch',it's ok,so why??
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Do following:

1) go to ranch directory ... from there
2) javac -d . *.java

then

java -cp . ranch.NewSay;

or

set CLASSPATH=%CLASSPATH%;.
java ranch.NewSay

will work.

Any error post the program here. ( use code tag for code posting).
[ September 18, 2006: Message edited by: Srinivas Kalvala ]
 
Bin Qian
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much,Srinivas Kalvala!
i do it following your advise,and it' ok ! but i still don't know why if i not use the "-d",it's can't generate the package,but it's can generate the .class file beside the .java file and can't run!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!