Discover full java className for import;

getJavaFullClassName SpringComponent
If you want to code without a IDE, using java may be painful to discover correct full class names to import. This script google it with javadoc word, then with some luck we got the javadoc as first item. next it curl the target javadoc and extract full name from it. Can by customized to extract other javadoc infos. Pre-reqs: bash, google-chrome, html2text and core-utils
Sample Output
getJavaFullClassName(){ kw=''; className="$@"; curl -s $(google-chrome --headless --dump-dom "$className" | xmllint --html --format - 2>/dev/null| grep "$kw" | tr " " "\n" | grep "$kw" | cut -d':' -f4- | cut -d';' -f1 | cut -d+ -f1 | head -1) | grep '\?.*\.html' | head -1 | sed 's/.*[?]\(.*\).html.*/\1/g; s|/|.|g'; }
$ getJavaFullClassName SpringComponent
$ getJavaFullClassName String
$ getJavaFullClassName SpringValue
$ getJavaFullClassName SpringAutowired
$ getJavaFullClassName WebLogicBean
$ getJavaFullClassName MessageDrivenEJB
$ getJavaFullClassName MessageDrivenEJBRuntimeMBean

2018-09-06 18:22:02

What Others Think

Update, the previous version stopped working based in google updated
glaudiston · 143 weeks ago
I've searched for a while now for an efficient way to import full Java className, and this code sample is a huge relief for me and team of developers at which do my Java assignment at the present moment.
EnzoUbert · 37 weeks ago
It's good that I've discovered this full java classname for import here. I can use this info in my apk decompiler online, and improve my software even more. It's one of the best things for me.
KayGasaway · 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: