This might be a very simple question. I have developed a JAVA program and I want to run it on other computer with different Operating system (UNIX). This means that I dont have to compile the program again.
What should I do? What do the other computer must have in order to be able to run my program?
If it's a standalong application, it just has to have Java installed, and it has to have your *.class files. That's about it! If it's a servlet or something like that, then it needs an appropriate container to run in, as well, of course.
Originally posted by Ernest Friedman-Hill: If it's a standalong application, it just has to have Java installed, and it has to have your *.class files. That's about it! If it's a servlet or something like that, then it needs an appropriate container to run in, as well, of course.
More speicifically, the other machine needs the Java Runtime Environment (JRE), but not the complete Java Development Kit (JDK).
Originally posted by Ernest Friedman-Hill: Yes.. it is a standalone program.. what should i do with that *.class files. How do I run it..
I'm not sure what environment you are using to develop the program in. If you are using a text editor and the command line, running the program on a Unix machine is the same as running it under Windows: type "java ClassName". Of course, this means that you need to set the PATH variable to the JRE installation and change to the directory that contains your *.class files.
If this doesn't completely answer your question, please describe how you run it on your development machine. I'll be glad to describe the differences you will encounter on a Unix machine.
I usually create a jar file, since it's not too nice to ship around a bunch of class files. And, if you don't have a bunch of class files, then you are not using the OO aspect of Java, and shame on you!
Don't forget (like I did ;-) that the SDK you build with better be less than or equal in version to the one on Unix. I built with 1.4 and the one on Unix was 1.3. I knew right away when I saw that methods didn't exist (I think it was String replace or something). Anyway, if you jar up your code, you should be able to run it by doing a "java -jar MyProggy.jar" on both systems. The jar file saves you from messing around with longer command lines too, due to packages (you ARE using a package, I hope).