for now I need to deploy my app on many different servers, so the app update becomes a nightmare for me. It's just a simple command line app running as monitor on these servers(linux), is there a way to make them upgrade automatically when startup? I can build a file server or download center for it.
That's not what laoying Yin meant. The objective is to update the Java class files and/or JAR files.
laoying Yin, you can't do that from your program itself. When you start the JVM it usually locks the files and folders on its class path. Usually people recommend Java Web Start but since this is a console application that won't work.
Your best approach seems to be to write a script file (.bat or .cmd in Windows, .sh or without extension in Linux) to launch your program. This script first downloads the latest version before starting the JVM.
Python and Perl are indeed good alternatives. Both have good support for network programming. They do add an extra runtime requirement though - you'll need to install Python and/or Perl...
Of course you can write a second little Java program that does just the updating. As long as the class path used for running that doesn't include any JAR file you need to update that shouldn't be a problem.