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"
slhck
  • 223,558
  • 70
  • 607
  • 592
ATR
  • 143
  • 5

1 Answers1

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.

wnrph
  • 3,633
  • 1
  • 26
  • 39
  • @ankur `ls` should suffice – wnrph Dec 04 '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. – ATR Dec 04 '11 at 12:53
  • @ankur most straightforwardly: within the batch file supply java with an absolute classpath (eg. `java -cp c:\bin\lspackagesrc\ ls`) – wnrph Dec 04 '11 at 12:56