Solved

jre/jar/class and win2k/nt

Posted on 2001-08-14
12
313 Views
Last Modified: 2013-11-23
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
Comment
Question by:chrislee8
  • 7
  • 4
12 Comments
 
LVL 3

Expert Comment

by:black
ID: 6386498
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
 

Author Comment

by:chrislee8
ID: 6386729
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
 
LVL 3

Expert Comment

by:black
ID: 6386773
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
 

Author Comment

by:chrislee8
ID: 6386783
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
 
LVL 3

Expert Comment

by:black
ID: 6386866
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
 

Author Comment

by:chrislee8
ID: 6388258
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:chrislee8
ID: 6388287
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
 

Author Comment

by:chrislee8
ID: 6388380
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
 
LVL 1

Accepted Solution

by:
ny971181 earned 50 total points
ID: 6388580
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
 

Author Comment

by:chrislee8
ID: 6388607
it works, thanks

thank you for your time too, black.
0
 
LVL 3

Expert Comment

by:black
ID: 6390615
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
 

Author Comment

by:chrislee8
ID: 6391000
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now