News for hackers. Stuff that matters.
Re:Why I Like Java (2014) by kingkongjaffa on Monday February 21, 2022 @08:42AM (#30415750)
People say this but where do you find libs for Java?

Python has pip,

JS/Node has NPM

Re:Why I Like Java (2014) by throwaway2037 on Monday February 21, 2022 @09:39AM (#30416337)
To compliment most other posters, they would use Maven Central: https://search.maven.org/

Here is an example library from Google called "Guava": https://search.maven.org/artifact/com.google.guava/guava/31....

You can find the source code on GitHub: https://github.com/google/guava

On the right side of the page, you can find eleven (!) different wants to include this dependency (and) all of its transitive dependencies with just a few lines of configuration.

Here is a list of the Top 10 downloads of open source Java libraries: https://mvnrepository.com/popular?p=1

Re:Why I Like Java (2014) by coldtea on Monday February 21, 2022 @08:46AM (#30415784)
>People say this but where do you find libs for Java?

Everywhere, on the lib website, on GitHub, on Apache, etc. (including centralized places like Maven Central). You then put a ferences in your Maven or Gradle file like you would in your package.json.

In fact, because for 99% of the libraries you just need to have a jar (or more) in your classpath, you don't have to have all the ceremony that Python has, and all the installation mess, venvs, and other such shite.

Re:Why I Like Java (2014) by Macha on Monday February 21, 2022 @09:55AM (#30416515)
Until you end up with dependencies transitively pulling in conflicting versions of Jackson or similar and you need to mess around with dependencyManagement or exclusions.
Re:Why I Like Java (2014) by dionian on Monday February 21, 2022 @01:45PM (#30419209)
Transitive dependency trees are a feature, not a bug
Re:Why I Like Java (2014) by smoyer on Monday February 21, 2022 @08:57AM (#30415903)
> JS/Node has NPM

If this isn't a joke, I'd suggest learning the Maven or Gradle build systems. NPM has such horrible dependency management that these Java systems will seem like magic!

Re:Why I Like Java (2014) by da39a3ee on Monday February 21, 2022 @10:27AM (#30416874)
OK, so I'm trying out maven central as people in this thread are recommending. As an example, I'm searching for a command line argument parser.

The first thing I'm noticing is that there seems to be no way to judge the popularity of the libaries (an often-used proxy for quality, e.g. number of downloads, GitHub stars, etc).

I enter "argparse" and the first hit isn't even Java! It seems to be a npm package?? https://search.maven.org/artifact/org.webjars.npm/argparse

I enter "argument parser" and there are two hits. One with zero stars on Github and one with 1 star.

https://search.maven.org/artifact/com.github.easy-develop/ar...

https://search.maven.org/artifact/com.github.raphcal/argumen...

"command line" brings up another 0 star option: https://github.com/AlmondBranch/command-line-parser

I suppose the Java package ecosystem must be good if everyone says it is, but so far it looks to me like I'd find Maven Central very inefficient to discover high quality packages.

Re:Why I Like Java (2014) by Katharsas on Monday February 21, 2022 @12:01PM (#30417967)
Maven Central is the place where the libraries are hosted, but not the place where they are found by users. Use Google/Stackoverflow/Reddit and simply search for what you want.

Searching for "command line argument parser java" immediately leads you to libraries and infact lists of libraries (see https://stackoverflow.com/a/7829772), of which most are going to be available on Maven Central.

Then you do your research that the library you are looking at looks valid and is trustable (!) by checking out the info available on it, maybe make another search to find opinions on it.

Then when you have decided to try it, look at its docs to find out where it s located on Maven Central and use it from there.

Re:Why I Like Java (2014) by kklisura on Monday February 21, 2022 @01:10PM (#30418786)
I think you're searching in the wrong place. The first search result for "argument parser maven" in google search yields this [1] - an ordered list of maven dependencies for "Command Line Parsers".

[1] https://mvnrepository.com/open-source/command-line-parsers

Re:Why I Like Java (2014) by zmmmmm on Monday February 21, 2022 @04:07PM (#30420637)
mvnrepository.com is good for what you are describing [1]. For example, searching for "command line" brings up the clear top favorite and tells you the number of usages:

https://mvnrepository.com/search?q=command+line

[1] https://mvnrepository.com/

Re:Why I Like Java (2014) by chakkepolja on Monday February 21, 2022 @10:25AM (#30416860)
IMO maven is much better than gradle these days. Indeed maven or go dependency management is refreshing after you run create-react-app or shit like that.
Re:Why I Like Java (2014) by the_af on Monday February 21, 2022 @08:55AM (#30415878)
The Java ecosystem of libraries is huge, it used to be one of the largest ones. I don't know how it competes today with Python and JS, but Java certainly doesn't lack libraries for almost anything you can think of.

Also: Maven Central.

Re:Why I Like Java (2014) by tannhaeuser on Monday February 21, 2022 @10:29AM (#30416899)
Err ... the npm authors (the CommonJS modules/packages spec writers for package.json) mention maven and CPAN in their design docs and discussions as reference. Many of the early Server-side JavaScript adopters (in the 2000's before Node.js but well after Netscape's server-side JavaScript) were, in fact, Java/J2EE dropouts longing for something simpler.

[1]: http://wiki.commonjs.org/wiki/Packages/1.0

Re:Why I Like Java (2014) by thrower123 on Monday February 21, 2022 @11:03AM (#30417326)
One of the nice things about Java and C# is that they tend to have "chunkier" dependencies, that aren't split out into an interlocking tree of dependencies deep and wide.

For the most part, anyway... Things are kind of gross if you are trying to use newer nuget packages on the old 4.8 .net framework...

Re:Why I Like Java (2014) by mindcrime on Monday February 21, 2022 @09:09AM (#30416022)
In Java-land most people build and do dependency management with Maven or Gradle. In either case, these tools can pull from repositories based on the Maven format. The vast majority of popular libraries are in repo "Maven Central" and "just work" if added to your dependency list. A number of smaller, more specialized repos also exist, and it's trivial to add additional repos to your Maven/Gradle config as well.

You can search for libraries on mvnrepository.com, or your IDE can search the index. Also most libraries will include a section in the documentation that shows the details of the blob you have to put in your pom.xml / build.gradle file.

Re:Why I Like Java (2014) by tlarkworthy on Monday February 21, 2022 @08:43AM (#30415757)
Maven central