4 ms·
Hey, that is pretty awesome. I had zero Java experience, but I felt inspired by your post, so I searched "java without ide" and got an XML parser up and runnin
by palish 15y ago
Hey, that is pretty awesome. I had zero Java experience, but I felt inspired by your post, so I searched "java without ide" and got an XML parser up and running in approximately 20 minutes.
For the curious reader, here's how to do Java entirely from the command line:
1) install the JDK and add its "bin" directory to your PATH. For me this was "jdk1.7.0_02/bin"
2) copy and paste http://pastebin.com/R47bwDZx http://pastebin.com/R47bwDZx and save it into a new file called "test.xml"
3) copy and paste http://pastebin.com/Ut5dKBkn http://pastebin.com/Ut5dKBkn and save it into a new file called "ReadXMLFile.java"
- note, this is not my code. It's just a snippet I found from the 'net. Feel free to clean it up. =) My goal was "to get up and running as quickly as possible". Production code would be cleaner than this.
4) run these commands:
javac ReadXMLFile.java
java ReadXMLFile test.xml
And the XML file is parsed!
So why go through all this trouble, when you could just write it in Python?
Deployment comes to mind as one reason to go with this approach; fewer systems have Python installed than Java runtime.
So therefore when you deploy your app, you'd have to either 1) make customers install Python, or 2) (more likely) ship the contents of the "Python27" folder along with your Python app, and invoke your app via a shell script, or something. I'm not sure.
- amcintyre 15y agoYou can bundle a Python program up into an executable with things like py2exe and cx_Freeze, and it will do most of the grunt work of bundling up any necessary dependencies (scripts, stdlib stuff, DLL's, etc.) into the .exe. (It's been a while since I used either of those tools, so there may very well be other alternatives around now.)
- Kliment 15y agopyInstaller is a pretty good multiplatform alternative, but I still use py2exe on Windows because it's incredibly robust.
- Xurinos 15y agoYet I have had trouble with having the "right version of Java runtime" installed in order to run programs, especially on Mac OS X where you sometimes cannot upgrade Java without upgrading the OS. I think there is still an installation/compatibility issue to consider. No free lunch.
- hmottestad 15y agoAt uni we first learned to program java using just the command line and emacs. Though working on a big project or just simply wanting to get up and running fast a good text editor or an IDE is so nice to have. I hate having write my own getters and setters, or just simple the psvm method.
- j_baker 15y agoDeployment comes to mind as one reason to go with this approach; fewer systems have Python installed than Java runtime. I would like to see proof of this. Perhaps Windows has fewer Python installs, but I would find it hard to believe that there are more Linux systems out there with Java (which most distros don't install by default) than python (which more systems do install by default).