Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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. – ankurtr 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... :-) – ankurtr Dec 4 '11 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .