由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - java dumb question
相关主题
JDBC & Firewall问个java on linux的奇怪问题
Re: 新生上路ant javac error in eclipse 3.0?
菜鸟问题一问请问一个最初级问题
CruiseControl: out of memory problemcom.sun.tools.javac.Main 问题
[转载] Urgent Help needed about Java Servlet?问个eclipse的问题
JBuilder questionJava fun
如何从java中调用Matlabbuild.xml
how to add my own class into a jar file?htmlunit中的classpath问题,总是找不到package
相关话题的讨论汇总
话题: classpath话题: am话题: java话题: directory话题: 2002
进入Java版参与讨论
1 (共1页)
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.
:

1 (共1页)
进入Java版参与讨论
相关主题
htmlunit中的classpath问题,总是找不到package[转载] Urgent Help needed about Java Servlet?
Re: Help!: tomcat classloading problemJBuilder question
Unix: where to execute java program?如何从java中调用Matlab
[转载] Re: package usage in javahow to add my own class into a jar file?
JDBC & Firewall问个java on linux的奇怪问题
Re: 新生上路ant javac error in eclipse 3.0?
菜鸟问题一问请问一个最初级问题
CruiseControl: out of memory problemcom.sun.tools.javac.Main 问题
相关话题的讨论汇总
话题: classpath话题: am话题: java话题: directory话题: 2002