I've developed a Java program which does the same task as the ls command in Linux.

After developing it, I was thinking about using it as a command in the DOS prompt.

Does Windows allow this? If it is possible, then which settings do I have to change for it in order to get it working?

c:>ls 
the output of the program "java ls"
link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

Yes, just make a batch file and adjust the PATH environment variable so as to include the directory, where your batch file is stored.

link|improve this answer
@ankur ls should suffice – artistoex Dec 4 '11 at 12:52
C:\Users\SiyaRam>ls C:\Users\SiyaRam>java ls "Error: Could not find or load main class ls" i am getting this error. – ankur.trapasiya Dec 4 '11 at 12:53
@ankur most straightforwardly: within the batch file supply java with an absolute classpath (eg. java -cp c:\bin\lspackagesrc\ ls) – artistoex Dec 4 '11 at 12:56
It worked. Thank you... :-) – ankur.trapasiya Dec 4 '11 at 12:59
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.