File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Java On DOS Platform : Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java On DOS Platform : Urgent" Watch "Java On DOS Platform : Urgent" New topic

Java On DOS Platform : Urgent

Neeraj Thakkar
Ranch Hand

Joined: Dec 06, 2000
Posts: 80
Hi everybody,

I want to know that when we create a java file it has extension .java and the class file generated is .class
But DOS only supports 3 characters as extension. What if wanna write and runa an application on DOS alone.
It's very urgent. Plz help

Neeraj Thakkar<br />"Try to get what you like,Else you will be forced to like what you get."
amer seif el dine

Joined: Jul 26, 2001
Posts: 16
i am not sure but try it!
there is a dos editor.
i repeat try it coz i don't know if it works
but this is a simple idea to try !
good luck
plz inform me if it works.
Neeraj Thakkar
Ranch Hand

Joined: Dec 06, 2000
Posts: 80
Hi Amer,
Got ur reply but friend when u save a file in DOS Editor it will truncate the last chars after 3 chars
so the file saved will be file.jav and not and forget about the .class file.
I hope it is like this only. just check it out.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
are you running a DOS only PC or are you running DOS under some version of windows? You may find that your DOS version will support long filenames but the DOS Editor will not. In that case, you can save your file and then copy or rename it back to the .java extention that you need for compliation.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
What version of DOS are you using? I currently compile and run Java on Win95, Win98 and WinNT at various times. I don't use an IDE - just raw DOS and notepad to save and execute from. There is no problem with the .java or .class extensions.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Neeraj Thakkar
Ranch Hand

Joined: Dec 06, 2000
Posts: 80
Thanks for the reply.
When u compile ur program from DOS PROMPT in Win 95/98/NT then there is no problem.
The reason the MSDOS PROPMPT is an application that simulates DOS and as Win 95/98/NT support long file names so does the DOS PRMPT so don't confuse the DOS PROMPT Application with DOS which is an OS.
Let me put it more clearly I have a system with only DOS installed on it there is no Win95/98/NT. How do I execute Java Programs there.
Forget about the DOS Editor that renaming can be done but what if ur OS doesn't allow more than 3 chars as Extension.
I hope I have made it clear.
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Hey Neeraj,
After you compile to .class file. Just rename it to .cls

David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
Just out of curiosity -- why are you writing java programs in dos?
Lucas Richardson
Ranch Hand

Joined: Jul 08, 2001
Posts: 32
He can't compile it if he's using dos 6.x or earlier though. Javac only takes a file with an extension of .java, correct? Even .jav doesn't work..
I agree. Here's the link:
subject: Java On DOS Platform : Urgent
It's not a secret anymore!