TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: CLI – Java or Python or Go?

7 pointsby itpragmatikabout 6 years ago
We want to write a command line interface tool that will be distributed to our customers. It is intended to be used on Linux. This CLI tool primarily will do few remote REST API calls, copy large number of big files from local file system to remote server (like AWS S3) and is expected to take few hours to complete. We have lot of in-house Java expertise. Should we pick Go, Python, Java or some other language? I am biased towards Java but would like to hear additional opinions.

13 comments

kevinherronabout 6 years ago
A lot of people here are suggesting Go for its single binary with no dependencies, but if you&#x27;re starting a small green field project in Java you should have no issue making sure it&#x27;s jlinkable and even compiling it to a single statically linked binary with Graal.<p>This way you can re-use your Java expertise and still get a statically linked single binary with quick startup.
haglinabout 6 years ago
JDK 11 comes with a new HttpClient. Might be useful and fun to learn.<p><a href="https:&#x2F;&#x2F;docs.oracle.com&#x2F;en&#x2F;java&#x2F;javase&#x2F;11&#x2F;docs&#x2F;api&#x2F;java.net.http&#x2F;java&#x2F;net&#x2F;http&#x2F;HttpClient.html" rel="nofollow">https:&#x2F;&#x2F;docs.oracle.com&#x2F;en&#x2F;java&#x2F;javase&#x2F;11&#x2F;docs&#x2F;api&#x2F;java.net....</a>
priomabout 6 years ago
Go, use cobra. It&#x27;s awesome and really easy to get started and complete the project.
评论 #19463842 未加载
Karhanabout 6 years ago
I think you&#x27;ll have the fewest distribution issues with a go binary. But if you have lots of experience building and distributing java programs to your customers then go with what you know!
评论 #19460558 未加载
CyberFonicabout 6 years ago
I have written several similar programs using Python&#x27;s cmd.Cmd class. Command completion, help messages, etc are all taken care of. All I need to do is to write the nitty gritty for each command and copious log the actions taken their return status to catch any networking, REST, etc issues. It is even possible to nest command interpreters within command interpreters to create sub-commands if applicable.<p>I should mention that I am more productive in Python than either Java or Go - so this may taint my view of alternatives.
tmalyabout 6 years ago
I really like using Go for this. The single binary with zero dependencies makes it really easy to deploy. You do not need the jvm or python environment setup. If you change something like upgrading your jvm or python or a library, aside from the path, the binary keeps working.<p>Maintaining things is just much simpler with a single binary.
sethammonsabout 6 years ago
It depends on your customers. Will they have the right version of python? Will they install the Java runtime environment and the correct one (I assume that is a thing, but I&#x27;m not Java person)?<p>Or you can skip all of that and just use Go that runs as a single, stand alone binary and very likely uses less memory than Java.
评论 #19463859 未加载
vkakuabout 6 years ago
If you want to integrate with AWS&#x2F;Azure, Python is the language of choice for CLI.<p>It&#x27;s because the actual AWS CLI&#x2F;Azure CLI is written in Python and they have the most supported interface so far known.<p>I personally like Go because it&#x27;s easier to ship a static binary but in this case I would recommend otherwise.
Adamantcheeseabout 6 years ago
Java because you have devs and you can just make a shell&#x2F;batch script to launch a JAR.
m0ckabout 6 years ago
You ask if you should use Java, Python or Go and the first three replies recommend you Java, Python and Go in that order, I love it.
k0t0n0about 6 years ago
&gt; We have a lot of in-house Java expertise. Should we pick Go<p>Give go an honest try. I am sure it will not disappoint you.
评论 #19462491 未加载
kasey_junkabout 6 years ago
Go is excellent at building CLI commands of this type. It maybe the thing that it&#x27;s best at.
pkphilipabout 6 years ago
Why not rust? Rust has excellent CLI support, is fast, can do REST calls