Forums Register Login

Running a program in other computer

+Pie Number of slices to send: Send
Hi,

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?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Yes.. it is a standalone program.. what should i do with that *.class files. How do I run it..
+Pie Number of slices to send: Send
first check the CLASSPATH and PATH variable.

let you want to run program test, u have test.class...

go to the directory where test.class is there
give the command

>java test
+Pie Number of slices to send: Send
 

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.

Layne
+Pie Number of slices to send: Send
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).

--Dale--
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 785 times.
Similar Threads
Bios question
Why Just run in my PC ?
cannot get program to run (streams)
how System.gc()'s work depends on the machine?
simple socket programming
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:11:59.