What's a good way to set up Closure Compiler on Linux? Or, where should Java .jar's live on a Linux?
what is called
how to pronounce what
I'd like to set up a process where I can generate minified and optimized JS for my webapps as part of the process of pushing updated code to the webserver with git.
It's quite straightforward to run it:
java -jar ./compiler.jar script.js
Of course if I have ten projects I don't want ten
If I stick it here:
/usr/local/lib/compiler.jar my call just looks stupid:
java -jar /usr/local/lib/compiler.jar script.js
It would make more sense to dump it in
~ like I do with everything else that doesn't have a place to go. It just feels sloppy.
Is there some directory that I can stick my jars into so that I can run them more easily, rather than my having to set up (symlinks to) shell scripts (or possibly better, shell command aliases) for each jar I want to use?
For example, shouldn't there be a system where I put my jar in a global designated java lib directory, after which point I may call
java closure script.js?
Edit: I tried putting it in
jre/lib/ext which I found here, but it did not work:
$ find /usr/lib | grep jre/lib/ext /usr/lib/jvm/java-1.7.0-openjdk-184.108.40.206.x86_64/jre/lib/ext .... bunch of other jar files here $ cp ~/compiler.jar /usr/lib/jvm/java-1.7.0-openjdk-220.127.116.11.x86_64/jre/lib/ext $ java -jar compiler.jar script.js Error: Unable to access jarfile compiler.jar
My answer is more a suggestion that you do not reinvent the wheel, and that hopefully will save you from problems, you did not run in - yet, since you were already suggesting in your own comment that it might be good to include the jar in every project. :-)
I would suggest putting the jar in every project and make it self contained or better: run a setup script in every project, which fetches the jar from a remote location.
You could script the setup script by hand or go one step further and use a task runner, to create your own build-toolchain, which you can reuse on multiple projects.
We transitioned our project structure to
Grunt tasks (http://gruntjs.com) Grunt contains a closure-compiler plugin (and many more plugins, e.g.
sass). Each project contains a Grunt config file, which specifies all tasks, e.g. test, build, which you can invoke on the given project. So you have to install Grunt once on your machine and Grunt will pick up all your tasks for a given project and will take care of downloading the closure-compiler.jar and invoking the closure-compiler.
So even, if you might think right now: "I only need the closure-compiler" eventually you might need another tool
B and start bash-scripting for tool
B. I suggest you invest more time in learning, for example Grunt, and use the work of the community.
A side note: Before we used
Grunt I set up the build-toolchain with another taskrunner,
Gradle (http://www.gradle.org), which is popular for
What, President Donald Trump said the United States' staggering death toll from coronavirus "is what it is" in a new interview, again giving his� WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.
I would also put it in each and every project. This is to make them self-contained. Here is my code to do so:
cd /path/to/your/project sudo apt-get install -y default-jre wget "https://dl.google.com/closure-compiler/compiler-latest.tar.gz" tar -xf compiler-latest.tar.gz rm compiler-latest.tar.gz README.md COPYING mv closure-compiler* closure-compiler.jar # rename for easier use
what, what definition: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more. WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.
What's a good way to set up Closure Compiler on Linux?
It depends on you Linux distribution. Typically, it is already available in package repositories.
E.g. for CentOS 7, you would run:
yum install https://extras.getpagespeed.com/release-el7-latest.rpm yum install closure-compiler
Then simply invoke it via
If you don't use a distro that packaged it, see next answer.
Or, where should Java .jar's live on a Linux?
The system packages for
.jar files typically go into
/usr/share/java/ (at least so in RedHat based systems). Additionally, manually installed or downloaded software should go into
/usr/local according to FHS standards.
From the above, you can decipher that
/usr/local/share/java/ should be a proper place to put your manually downloaded
.jar files if you want to have them accessible to multiple users / projects.
Trump on Covid death toll: 'It is what it is' - CNNPolitics, Quickly send and receive WhatsApp messages right from your computer. Ask.com is the #1 question answering service that delivers the best answers from the web and real people - all in one place.
If you using the java command directly, then you'll have to provide a path to the jar in question. It's probably easier to place the jar in one place and create a shell script that handles the invocation and jar path.
WHAT, WhatsApp Business is a free to download app that was built with the small business owner in mind. Create a catalog to showcase your products and services. Instead of funding a police department, a sizable chunk of a city's budget is invested in communities, especially marginalized ones where much of the policing occurs.
I use an alias which I think is much more efficient than having a shell script sitting somewhere achieving roughly the same thing.
alias closure='java -jar /opt/closure-compiler/compiler.jar'
closure --js i.js --js_output_file i.min.js
WhatsApp Web, It is plural if a plural noun or noun phrase completes the sentence, as in He sometimes makes what seem to be gestures of reconciliation. � Clauses with what as� Seen a font in use and want to know what it is? Upload an image to WhatTheFont to find the closest matches in our database.
WhatsApp, This is what SMART means in the working family context: S=Specific. Instead of setting a goal with your 10-year-old to be “nicer” to your neighbor,� More than just great coffee. Explore the menu, sign up for Starbucks® Rewards, manage your gift card and more.
What, This will clear your Bing search history on this device. You can't undo it.
What's Your Family's Mission Statement?, Is this for real, or is the Israeli government broadcasting it is preparing to try a "false flag" against Hezbollah?!? False flags are a very common form of Israeli statecraft; I am hoping (and praying) for calm, but I don't know that this will happen, looking at the level of distraction Netanyahu needs to misdirect Israeli citizens away from looking at the government's response to the Covid
- I'm starting to think that maybe I'm supposed to keep the jar with every project. ಠ_ಠ
- Thanks, this looks like a good way to get around inventing a few wheels
- I was originally starting to set up a shell script or makefile system for doing "compilation style" tasks, so that when I commit code it will also include generated code. Grunt appears to exactly fill this type of role.
- Here appear to be the specific directions for obtaining a good clean installation of closure-compiler, for use with e.g. grunt-closure-compiler: github.com/gmarty/… However it's probably smartest to just grab the jar download. At least this does not require having a copy of the jar for each project.
- Holy Batman! Grunt is next to impossible to debug (as I do not have a node debugging environment configured yet). A lot of these node tools are sadly quite lacking in quality (but node itself is pretty good about that). All of this wild goose chasing on why my gruntfile dies with a mysterious unhelpful warning isn't helping to sell this workflow. I could give you like 5 reasons why shell scripts are superior right about now. You see, with grunt plugins there is this mysterious trend of conflicting and arbitrary ways of indirecting function calls with nested JS object structures. This is EVIL!
- @Jan Weitz can you add a reference to the closure compiler plugin from grunt that downloads the compiler jar? I came across several plugins, but all of them had one issue or another. Thanks!