Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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"
share|improve this question

1 Answer 1

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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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