T***B 发帖数: 137 | 1 I couldn't my java program run. The following is what happened. Thanks.
C:\j2sdk1.4.1_01\bin>dir java*
Volume in drive C has no label.
Volume Serial Number is 7831-5828
Directory of C:\j2sdk1.4.1_01\bin
09/30/2002 02:08 AM 24,672 java.exe
09/30/2002 02:08 AM 28,789 javac.exe
09/30/2002 02:08 AM 28,795 javadoc.exe
09/30/2002 02:08 AM 28,789 javah.exe
09/30/2002 02:08 AM 28,785 javap.exe
09/30/2002 02:08 AM 24,674 javaw.exe
|
c**g 发帖数: 274 | 2 try:
java -classpath . Example
【在 T***B 的大作中提到】 : I couldn't my java program run. The following is what happened. Thanks. : C:\j2sdk1.4.1_01\bin>dir java* : Volume in drive C has no label. : Volume Serial Number is 7831-5828 : Directory of C:\j2sdk1.4.1_01\bin : 09/30/2002 02:08 AM 24,672 java.exe : 09/30/2002 02:08 AM 28,789 javac.exe : 09/30/2002 02:08 AM 28,795 javadoc.exe : 09/30/2002 02:08 AM 28,789 javah.exe : 09/30/2002 02:08 AM 28,785 javap.exe
|
T***B 发帖数: 137 | 3 Thank you.
And I tried to add C:\j2sdk1.4.1_01\bin to the classpath variable. It solves
the problem.
【在 c**g 的大作中提到】 : try: : java -classpath . Example
|
xt 发帖数: 17532 | 4 Should be
package java.dumb;
public class Example{...}
javac Example.java
java java.dumb.Example |
c******l 发帖数: 3972 | 5 Actually, you did not solve the problem well.
Next time, you run a java program in another directory, you will have
the same issue.
What you need to do is add your currently directory . to the classpath.
cang did it in commandline, you can make change permanently in Enviroment
variable.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ERROR!!!
【在 T***B 的大作中提到】 : Thank you. : And I tried to add C:\j2sdk1.4.1_01\bin to the classpath variable. It solves : the problem.
|
T***B 发帖数: 137 | 6 still have questions:
1. why java doesn't look for classes in current directory automatically?
2. how to add current directory . to the classpath? just put a '.' there?
I am not home now. couldn't make a try by myself.
Thank you.
solves
Thanks.
program.\n");
【在 c******l 的大作中提到】 : Actually, you did not solve the problem well. : Next time, you run a java program in another directory, you will have : the same issue. : What you need to do is add your currently directory . to the classpath. : cang did it in commandline, you can make change permanently in Enviroment : variable. : : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ERROR!!!
|
C*****o 发帖数: 144 | 7 1.maybe java was following unix standard from beginning.
2. Yes.
【在 T***B 的大作中提到】 : still have questions: : 1. why java doesn't look for classes in current directory automatically? : 2. how to add current directory . to the classpath? just put a '.' there? : I am not home now. couldn't make a try by myself. : Thank you. : : solves : Thanks. : program.\n");
|
T***B 发帖数: 137 | 8 I just tested it again in Windows XP. It seems that
1. If I don't put anything in environment variable classpath, I can run
java classname
as long as file classname.class is in the current directory.
2. If I put some path(es) in classpath already, I should also put '.'
there so that I can run
java classname
in current directory.
Please correct me if I am wrong or not complete. Thanks.
Enviroment
【在 C*****o 的大作中提到】 : 1.maybe java was following unix standard from beginning. : 2. Yes.
|
|
c******l 发帖数: 3972 | 9 You are difinitely right. By default your j2sdk installation will
put current directory in classpath. But if you introduce your own CLASSPATH,
you overwrite the default one. You have to put , in classpath explicitly.
there?
classpath.
【在 T***B 的大作中提到】 : I just tested it again in Windows XP. It seems that : 1. If I don't put anything in environment variable classpath, I can run : java classname : as long as file classname.class is in the current directory. : 2. If I put some path(es) in classpath already, I should also put '.' : there so that I can run : java classname : in current directory. : Please correct me if I am wrong or not complete. Thanks. :
|