views:

191

answers:

5

When deploy java app on linux, we don't need to install anything, all third-party libs are jar files and we only update classpath in script file. But java needs jre which is quite large.

So is there any other language supported by linux can do that? By default our server only support perl/python/tcl, no gcc available, sigh.

+2  A: 

On Linux you should use the distribution's native package format (DEB, RPM, …) to deploy applications. The package managers included in the distributions can handle dependencies automatically.

Apart from that, I think Perl is the only language that is available in most Linux systems out of the box. Python is very popular, too, but probably not as ubiquitous.

Philipp
thx, Philipp! DEB/RPM is a good solution so dependency may be clear for our SA, but we need the app can upgrade itself without help from SA, including the third-party lib used. Actually our target is a non-intrusive system, no dependency on OS level.
Wind SC
@Wind Sadly, Perl might be universally available, but many of the most useful CPAN modules are not ( [List::MoreUtils](http://p3rl.org/List::MoreUtils) springs to mind), so either you'll be restricted to core features, or using PAR as Chas. says.
Philip Potter
@Wind SC - this depends a lot on what SAs set up - in may places executables cannot be updated by anyone except a SA - ie the directory permissions are set so few can write to the code - this is often an attempt to stop viruses etc and also to provide an audit of exactly what is being run so changes can be approved before roll out.
Mark
List::MoreUtils is only moderately useful (anything in that module can be built with core's foreach, map or grep or List::Util's reduce), the much more useful List::Util is in core.
MkV
+10  A: 

Perl 5 has PAR and PAR::Packer. PAR is conceptually similar to a JAR file (it is a zip file of one or more modules). PAR::Packer takes it one step further: it bundles every you need to run a program into one executable file. PAR::Packer executables don't even need Perl 5 installed on the target system.

Chas. Owens
thx, Chas! But perl... really my last choice if no others, coz it seems obscure a little to me.
Wind SC
@Wind SC How is it any more obscure than JAR? It is the same basic concept.
Chas. Owens
I think Wind SC means that Perl itself is a little obscure to him :o)
Christian
Ah, that makes a little more sense, but well written Perl code is no worse than any other language.
Chas. Owens
@Wind SC: If Perl is too obscure for you, you shouldn't include it in you question (or the tags), so Perl people would know not to bother
MkV
@MkV disagree, if there was no python or TCL solution he would have to take perl, as there is he is free to use his personal preference to choose betwen them
jk
+4  A: 

perl, python and tcl can run 3rd party libs without installing them pick which ever you are most comfortable with

tcl has starkits and starpacks

perl is covered in another answer

python appears to have eggs and freeze (and py2exe for windows)

jk
how can i do that in python? is there a way to package everything into single file? like jar.
Wind SC
@Wind SC more of a tcl man but eggs seem to be what you want
jk
+1 for mentioning starpacks; they seem to be exactly what the questioner is after.
Donal Fellows
A: 

Stumbled upon this yesterday: http://code.activestate.com/recipes/497000-build-a-compressed-self-extracting-executable-scri/

The page shows how to turn a zip file containing python scripts into an executable very easily.

ChrisAdams
+2  A: 

Tcl applications can be wrapped into a single-file executable with all dependencies included. I have used these for several applications. You can produce single-file executables for Linux, Windows and OSX.

From http://www.equi4.com/starkit/ :

A Starkit is a wrapping mechanism for delivering an application in a self-contained, installation-free, and highly portable way. The name comes from being based on a StandAlone Runtime, called Tclkit.

A Starkit creates the illusion of a "file system in a file" - on the outside, it's a single file, yet the application code continues to see a complete directory of scripts, extensions, packages, images, and whatever other files it needs. Starkits can be multi-platform. And they can be written to, due to the underlying Metakit database.

bsterne
It should be noted that you can load binary extension code out of a starkit, making it very easy to ship whole complex applications without any installation steps (or single libraries that are in effect “fat” with support for many different architectures). About the only time when it isn't transparent is when the API you want to pass the data to only takes a filename; that's a minority, but does include `execve()`…
Donal Fellows