Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

jre/jar/class and win2k/nt

hi, I developed a small java program with jdk1.3.1 in my development machine. which runs my program nicely using c:>java myclass command.

now I have a win2k server. I want to move/deploy/run(whatever the term is) my program in that server.

the win2k server doesn't have any java development stuff installed. maybe the one with win2k, but that is it.

how do I run myclass in this server?

I have downloaded jre, but didn't install yet.

not to offend people, but I do prefer outline, step by step explanaition/instruction. easy to read and yes, understand.

thanks
0
chrislee8
Asked:
chrislee8
  • 7
  • 4
1 Solution
 
blackCommented:
1. well first you need to install the JRE
2. let's say you installed it into
C:\jre
then your PATH environment variable should have an entry into the bin directory:
PATH=%PATH%;C:\jre\bin
this let's you type in java command line.
3. Set the CLASSPATH variable to point to either the JAR file if you have your classes in a jar:
CLASSPATH=%CLASSPATH%;C:\myapp.jar
or if you have it in the directory structure
CLASSPATH=%CLASSPATH%;C:\myclasses
4. Go to command line and run it
C:>java myClass args
0
 
chrislee8Author Commented:
do I really need the jar file in the server or just the myclass.class file?

my program is just one class file, not multiple class files.

thanks
0
 
blackCommented:
you can have either, the jar file is just an archive containing the classes you just need one of them
if you have a single class file just copy that across.
point your classpath at you classes directory. For example if you have a class called MyClass in the my.app package. You would have
C:\classes\my\app\MyClass.class
and you CLASSPATH would point to the classes directory:
CLASSPATH=%CLASSPATH%;C:\classes
and you would run your class by:
C:>java my.app.MyClass args
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chrislee8Author Commented:
i forgot to tell:

i do c:>java myclass.class, it says not such internal command found.

does the java.exe(i guess) come with the jre?
or what is wrong?

thanks
0
 
blackCommented:
yes it does, type in
C:>set
and it will print out your environment variables, make sure the directory you have the java.exe file is an entry in the PATH variable.
0
 
chrislee8Author Commented:
I did a search on java.exe file, nothing came up, I downloaded the jre1.1.x for win32 version.
no it doesn't have the java.exe file anywhere.

0
 
chrislee8Author Commented:
i tried installing jre1.1.x for win32 on two servers, I did a search on java.exe file. nothing came up.

what is wrong???

aarrrhhhhhhhhhhhhhhh, frigging javasoft doesn't provide any help and ****!!!!!

sorry i need to vent a little bit.
0
 
chrislee8Author Commented:
i just found out that java.exe only comes with the jdk!!!
hey, what is going on?
again, my server doesn't have jdk installed, and i don't plan to neither because I won't do development work on my server. the development work is done on a workstation.

I need the server to run my java application though, so I think I need jre.

but i don't know the rest.
how do I run my java app(only one class) on my server? it is win2kAS.

I relied on your guys' advise, please don't give out incorrect information.
0
 
ny971181Commented:
well, do this:

you have jre installed right, then you should have jre.exe command file.

c:>jre -cp (your class' path) (your class name)

the java.exe doesn't come with the jre, it comes with the jdk only.
jre comes with the jre(of course right?).

actually, javasoft does have the jre usage example. but I agree that they don't organize well(easy) enough for beginners.

good luck.
0
 
chrislee8Author Commented:
it works, thanks

thank you for your time too, black.
0
 
blackCommented:
I assumed you have a recent or at least Java 2, JRE and not a a 1.1.x version and my instructions were based on that that. And considering you said:
"I developed a small java program with jdk1.3.1"
I assumed you had jre 1.3 at least (the same one that I have) and I can assure you that it doesn't have a jre.exe.
If you developed in 1.3.1 I'm not sure why you would run in 1.1.x
here are some links to the jre 1.3 docs and downloads:
http://java.sun.com/j2se/1.3/runtime.html
http://java.sun.com/j2se/1.3/jre/download-windows.html
This is for 1.3.1, if you developed on it you should run on it too.
0
 
chrislee8Author Commented:
black,

i just downloaded the jre1.3.1, it does have java.exe.

it is my fault that I didn't mention the version of jre first, but if I knew it, I would have done it too.

hehe. sorry. Thanks for your time and effort, have a nice night.

sorry didn't award you the points. my bad.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now