Java under UNIX v/s Windows-NT
Hi
Is there any special consideration for a Java Program
to work under UNIX.
My problem is as follows,
I have a Java program say "JavaProg.java".
I create its class file under Windows-NT i.e.
"JavaProg.class" after compiling the java code using
the command "javac JavaProg.java".
Everythings perfect till here. The class file generates
output as expected under Windows-NT
Problem starts when I transfer that class file to UNIX.
With the initial promise of Java as "Write Once,
Run Everywhere" I just take the class file and put
it in my directory under UNIX.
i.e. home/myfiles/javacodes/programs
I set the PATH as "/home/java/bin" & CLASSPATH variable
as "/home/java/lib" since these are the directories where
the java.exe executable and the library files are existing.
Then when I execute
"java JavaProg" from my homedirectory of home/myfiles/javacodes
/programs it gives the following error,
Can't find the class file JavaProg
So I try out various other options like
"java JavaProg.class" (Specifying the .class extension)
on which it says
Invalid class name JavaProg.class
So I try,
"java /home/myfiles/javacodes/programs/JavaProg.class"
on which it says
Error finding class JavaProg.class : Wrong Name
=======================================================
Under Windows-NT I just have to do the following 4 steps,
1. set PATH=.;c:\jdk1.1.8\bin
2. set CLASSPATH=.;c:\jdk1.1.8\lib
3. Run the following command,
"javac JavaProg.java"
4. Run the following command,
"java JavaProg"
=======================================================
My Questions,
1. Are there any special considerations when class files
are placed under UNIX.
2. Does the above for Windows-NT apply exactly the same manner
in UNIX too. Or is there some additional thing to be done.
3. Are there any environment variables to be set under UNIX
which I might be missing.
4. How do you set PATH & CLASSPATH in UNIX.
5. Does the Java code have to be recompiled under UNIX.
I personally feel "NO" since Java promises "Write Once,
Run Everywhere" theme. So the same class file should even
work under UNIX even though it was intially compiled using
Windows-NT.
Can someone please respond as early as possible as I am
close to the project deadline. Any help appreciated. Thanks
in advance to any help, insights, views, ideas anyone can
throw on this subject.
Thanks,
Jatin

