environment variables

B

Bill Cunningham

Martin said:
Are they actually in c:\program files\java\jdk1.8.0_20\bin - have you
looked?

IOW, did you install the JDK or the JRE?

I have the JRE and JDK installed. javac.exe and jar.exe are indeed in
the bin directory. I did something and was for a small minute able to run
javac and jar. Then I lost it. I think I went to the jdk's bin folder.

Bill
 
L

Lew

Bill said:
@echo off
set path=c:\program files\java\jdk1.8.0_20\bin;%path%
c:\program files\java\jdk1.8.0_20\bin\javac.exe
c:\program files\java\jdk1.8.0_20\bin\jar.exe

I get error messages with this. I know how to set XP's enviorment
variables in the advanced tab so I could do that. I am just writing this
batch file. If I can get java, javac, and jar to work I would be happy and
then work on ant.

You say you "get error messages", but that's so vague. I don't suppose you
could unbend a little and actually quote (verbatim) those messages?
 
M

Martin Gregorie

I have the JRE and JDK installed. javac.exe and jar.exe are indeed
in
the bin directory. I did something and was for a small minute able to
run javac and jar. Then I lost it. I think I went to the jdk's bin
folder.
In that case there's something wrong with your %PATH% variable or you'd
be able to run all the programs in the JDK's bin directory from the
command line: "jxxx -version" should work if jxxx is java, javac or jar.

run "echo %PATH%" and post the results here.
 
B

Bill Cunningham

Arne said:
JAVA_HOME should point to the root.

But it is the bin dir that needs to be in PATH.

Ok whew. I set the path variable in windows's environment settings in
the advanced tab and not through a batch file and I can get javac and jar
now. So now that I know I am not supposed to use a classpath I will forget
all about it. Now is JAVA_HOME supposed to be set as path or as a new
environment variable under the advanced tab? Should I create a new variable
in the enviroment button in XP?

Bill
 
A

Arne Vajhøj

@echo off
set path=c:\program files\java\jdk1.8.0_20\bin;%path%
c:\program files\java\jdk1.8.0_20\bin\javac.exe
c:\program files\java\jdk1.8.0_20\bin\jar.exe

I get error messages with this. I know how to set XP's enviorment
variables in the advanced tab so I could do that. I am just writing this
batch file. If I can get java, javac, and jar to work I would be happy and
then work on ant.

The 1.8 vs 1.6 is most likely the problem.

Arne
 
A

Arne Vajhøj

Ok whew. I set the path variable in windows's environment settings in
the advanced tab and not through a batch file and I can get javac and jar
now. So now that I know I am not supposed to use a classpath I will forget
all about it. Now is JAVA_HOME supposed to be set as path or as a new
environment variable under the advanced tab? Should I create a new variable
in the enviroment button in XP?

Yes.

Arne
 
B

Bill Cunningham

Arne said:

Would that be something called java and then under the new variable I
would put

%JAVA_HOME%;c:\program files\java\jdk1.6.8_20

And leave it at that so that ant can find it?

Bill
 
B

Bill Cunningham

Arne said:

OK ant says it can't find tools.jar. That is what I used to use
classpath for. Ant's docs says classpath should be mentioned and unset. How
would I do that. I'll keep working it.

Bill
 
A

Arne Vajhøj

Would that be something called java and then under the new variable I
would put

%JAVA_HOME%;c:\program files\java\jdk1.6.8_20

And leave it at that so that ant can find it?

The variable JAVA_HOME should point to c:\program files\java\jdk1.6.8_20 !

(or more likely c:\program files\java\jdk1.6.0_20)

Arne
 
B

Bill Cunningham

Arne said:
If you get JAVA_HOME correct, then it may find it.

According to the docs JAVA_HOME isn't even needed. But I'm putting it
there anyway. It can't hurt.
 
B

Bill Cunningham

If you get JAVA_HOME correct, then it may find it.

Well here's what I did. I noticed that ant was searching for tools.jar
in the jre. There wasn't any tools.jar in the jre folder anywhere. So I
copied the jdk's tools.jar to the jre's lib. Ant seems to be satisfied now
that there's a copy in the jre. Why it would look there when the jre doesn't
come with it I don't know.

Bill
 
A

Arne Vajhøj

Well here's what I did. I noticed that ant was searching for tools.jar
in the jre. There wasn't any tools.jar in the jre folder anywhere. So I
copied the jdk's tools.jar to the jre's lib. Ant seems to be satisfied now
that there's a copy in the jre. Why it would look there when the jre doesn't
come with it I don't know.

Did you try having JAVA_HOME point to the root of the JDK ?

Arne
 
R

Roedy Green

For ant . I also tried old dos paths by writing my own batch file that says
this.

with ANT, you can set the parameters with SET in the BAT file you use
to kick off ANT, or you can set them in the control panel.
There is probably even a way to set them inside an ANT script, though
I have never done it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top