2

Anyone here remember how to write a java program from command prompt.

Earlier (5-6 years back) before BlueJ came, we use to write java programs in a Blue Black screen that is similar to one in TurboC++.

My system has netbeans installed, all paths are proper, I can even compile the programs by writing them in a text file with .java extension.

But i would like to do that in previous environment(see the image below), where we use to create the files, save them as .java, then go back to command prompt and execute the statements.

enter image description here

I got the image from google, but didn't find a way to open this.

darijan
  • 9,725
  • 25
  • 38
Mayur Sharma
  • 372
  • 2
  • 9
  • 11
    Good God, why?! – Jeroen Vannevel Mar 27 '14 at 13:10
  • 7
    The most awesome question ever. Why settle for that editor? Write code on paper, run it in your head! – darijan Mar 27 '14 at 13:11
  • 2
    noble prize award winner question. – codingenious Mar 27 '14 at 13:12
  • I suppose you should google for a Win64 port of edlin... or maybe some punchcard reader with USB 3.0 interface? – Gyro Gearless Mar 27 '14 at 13:12
  • I just want to know, maybe be because it was first environment in which i stated to learn programs. Java was my 1st language – Mayur Sharma Mar 27 '14 at 13:13
  • `copy con` slightly better then your head ;). But that program is basically the predecessor for notepad, called edit. MS-Dos and earlier versions of Windows had an `edit.exe` (or was it `.com`), nowaways that isn't available anymore). – M. Deinum Mar 27 '14 at 13:13
  • @Minku: Wanting to know is one thing (although I don't believe `edit` is shipped with newer versions of Wndows). Wanting to *do* it is a different matter. Why would you want an environment *even more primitive than Notepad*? – Jon Skeet Mar 27 '14 at 13:15
  • See here: http://stackoverflow.com/questions/11045077/edit-a-text-file-on-the-console-in-64-bit-windows –  Mar 27 '14 at 13:15
  • Isn't this a little bit masochistic? *SCNR* – Bevor Mar 27 '14 at 13:17
  • that edit is not working, so its removed, to late for me to try that one last time, thanks @M.Deinum, and all :-) – Mayur Sharma Mar 27 '14 at 13:17
  • Go and install Windows 95 (or maybe DOS 5.0 with Windows 3.1). – Seelenvirtuose Mar 27 '14 at 13:20
  • @jonSkeet was curious, i just wanted to know, was searching on google for around half an hour, thaen i asked here, sorry if hurted anyone. – Mayur Sharma Mar 27 '14 at 13:20
  • 3
    @Minku - You didn't hurt anyone. But you amused a few :-) – Stephen C Mar 27 '14 at 13:20
  • @StephenC its good, thanks everyone for the fast reply, or else would have been kept on searching for that, with now continue in netbeans – Mayur Sharma Mar 27 '14 at 13:26
  • 15 minutes are gone, and still no [inevitable XKCD reference](http://xkcd.com/378/)?! Something's wrong with stackoverflow... – Jens Erat Mar 27 '14 at 13:26
  • Another way would be "copy con MyClass.java". Then type in your source code. End it with CTRL-Z. – Seelenvirtuose Mar 27 '14 at 13:29
  • @JensErat: "Real programmers use a magnetized needle and a steady hand". This thread gets the laugh-of-the-day award. No disrespect to @ Minku, as I do understand it's a real question for nostalgia sake. I also hope you see why we find it amusing, @ Minku: Coding is hard enough as is, why choose to make it even harder? – aliteralmind Mar 27 '14 at 13:31
  • You made my day! as said the noble prize award winner question, you really should be different and special in different ways hhh. why not installing nano editor, or vim for windows. here the link for nano : https://nano-editor.org/dist/win32-support/ and for vim: https://vim.sourceforge.io/download.php#pc. then you work only from command line. you compile using directly the javac compiler, and so on for the debugger. and whatever tool you need. Good adventure and learning, and exploring time. – Mohamed Allal Dec 13 '17 at 00:28

1 Answers1

2

A couple years ago, I spent a long time doing all my Java coding in Vim. It's easy enough; you learn the basic API enough not to depend on intelligent completion, and there are Vim features (like ctags) to give you a similar feature, though it's based on text rather than actual functionality. It also has Java syntax highlighting. It should work fine on Windows.

Build the project with Maven, and you're good to go.

You should probably install Cygwin. Spending time in the Windows command prompt is not good for your sanity.

Also, many Eclipse features can be accessed from the command line in a headless manner. I used to run the Eclipse formatter that way, so I could use my team's standardized format. I believe there are projects that let you access most Eclipse features directly from within Vim, if you want to go that way.

Sam Jones
  • 1,400
  • 1
  • 13
  • 25