Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a Java project on Linux system

I developed a project using Java and now I've to deliver it to client who is using Linux. Which executable file format will be delivered and how to make that?

like image 254
Mohammad Faisal Avatar asked Oct 17 '11 13:10

Mohammad Faisal


People also ask

Can Java applications run on Linux?

Java is the world's popular software development platform that James Gosling develops. It is designed to support multiple platforms like Linux, macOS and Windows. Mobile and Desktop applications can also be developed using Java language.

Can Java code compiled on Windows can run on Linux?

Java code compiled on Windows can run on Linux.


2 Answers

Executable file format?

If you're delivering a Java app, give them a jar file (and associated libs).

Provide a shell script to set up its environment and execute it.

For example, assuming I define ROOT_DIR as my app's install directory, and so on:

CLASSPATH="${ADD_JARS}:${CLASSPATH}:${ROOT_DIR}/lib/myApp.jar:\
${ROOT_DIR}/lib/jibx/jibx-run.jar:\
${ROOT_DIR}/lib/jibx/xpp3.jar:\
${ROOT_DIR}/lib/bindings.jar:\
${ROOT_DIR}/lib/commons-lang-2.0.jar:\
${ROOT_DIR}/lib/forms-1.0.5.jar"
"${JAVACMD}" -Xmx256M -DanyDefsNeeded=foobar -Dbase.dir="${ROOT_DIR}" -cp "${CLASSPATH}" myApp.main.Launcher "$@"

What goes into the shell script depends totally on what your app actually needs to start up.

like image 58
Dave Newton Avatar answered Sep 25 '22 01:09

Dave Newton


A jar. If it is not executable, then a script (.sh) to launch the jar.

like image 43
Mister Smith Avatar answered Sep 25 '22 01:09

Mister Smith