i am not agree with the theory of classpath with this problem.
venus_night_2000:-
for this we need to understand the structure of java's JRE & JVM. There r
main following components in JRE's JVM
1.class loader
2.verifier
3.compiler
4.interpreter
5.executer
6.security manager
Actually what happen is that, when u say
c:\javac prog1.java
compliler in the JVM compiles your program & detects for error. If no error
found then nothing appeares in command line, that means u'r file is
error-less
Now, when u says
c:\java prog1
sun's jre is written such a way that is interprets only class name. so
here interpreter in jvm takes only file name. now, this sun's jre interprets
'prog1' as command line argument with 'java' in command line. Then class
loader searches for the respective class, namely 'prog1.class'. & JRE, which
accepts only file name, executes class file.
U can write your own jre which takes command line argument as u like.
c:\java prog1.class
I mean, if your requirement is to run file with .class extension, then u
have to modify JRE's JVM & create user-specific JVM's. (BUT THATS TOO
CLUMPZY.)
for ex. some vendor's have created JRE's which executes Garbage Collection
every time to save memory & time of execution. etc.....
Every GUI editor u see, must modifies JRS according to his need, to run prog
faster & with less errors.
I hope this clerify your question.