3

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"

1 Answer 1

2

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

3
  • @ankur ls should suffice
    – wnrph
    Commented Dec 4, 2011 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. Commented Dec 4, 2011 at 12:53
  • @ankur most straightforwardly: within the batch file supply java with an absolute classpath (eg. java -cp c:\bin\lspackagesrc\ ls)
    – wnrph
    Commented Dec 4, 2011 at 12:56

You must log in to answer this question.

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