Java compilers....quick question

Status
Not open for further replies.
Hello All,

This is officially an emergency... :eek:
I want to compile a JAVA program which has modules from other places in jar format... the location of all files is in e:\mydir\ and java jdk1.3 is on e:\jdk1.3 (win98se box)

=======================
DIR e:\mydir

my1.java
my2.java
.
.
myn.java

Acme.jar
Another.jar
========================

This is what I do...
javac -classpath:e\mydir\Acme.jar;e\mydir\Another.jar;. *.java

It says invalid flag.... -classpath

When I do...
javac -classpath e\mydir\Acme.jar;e\mydir\Another.jar;. *.java
(no colon after -classpath) it compiles but gives errors...IT IS A FACT that the code is bug free and compilable...

How do u use claspath and .jar together ?

Regards,
hellfire
 

temp

Seniorius Lurkius
44
The statement
code:<HR>
Code:
javac -classpath e:\mydir\Acme.jar;e:\mydir\Another.jar;. *.java
should definitely work on java 1.3.0. I just tested something equivalent on my own W2K box.

Are you absolutely sure that you are calling the right java compiler? You might have several binaries called javac.exe in your path. This has cought me out a couple of times...

Try specifying the fulle path to the java compiler like this:
code:<HR>
Code:
e:\jdk1.3\bin\javac -classpath e:\mydir\Acme.jar;e:\mydir\Another.jar;. *.java
 

wb

Ars Legatus Legionis
25,208
Subscriptor
Just add the jar files to your CLASSPATH environment variable defined in autoexec.bat (if you don't have it defined there, do so). Also make sure to include "." (the current directory) in the classpath as that tends to cause problems sometimes too.

So, change your autoexec.bat, make *sure* the paths are completely correct (i.e. don't forget those colons on the drive letters), restart your machine, and try to compile it.
 
My autoexec file
....
SET PATH="E:\MATLAB\BIN";E:\68KSIM~1;E:\JDK1.3\BIN;E:\TERATERMPRO\
SET CP = E:\csc444\Acme.jar;E:\csc444\xerces.jar

PATH=%PATH%;%CP%;F:\SSHSEC~1
<THE END>

I have zero experience with writing these scripts...so any help is appreciated.

Thx,
hellfire

[Edit] COOL New Error
Using gubmo's suggestion i used bootclasspath like so:
javac -bootclasspath e:\mydir\Acme.jar;e:\mydir\Another.jar;. *.java

and got the following:
Fatal error: Unable to locate package java.lang in classpath or bootclasspath
 
make sure that you include the default classpath when you change it. Setting the CLASSPATH environment variable does not append to the classpath - it replaces it.

so, you'd do something like this

SET CLASSPATH = %CLASSPATH%;e:/JARS/somejarfile.jar;c:/dev/pot/code/dirwithclassfiles/;

*shrug*

You do realize that most of this stuff can be found in the documentation right? Especially with respect to setting classpath, adding jars. I'm sure the installation notes have some information too.
 

carodin

Ars Scholae Palatinae
768
Originally posted by hikikomori:
You do realize that most of this stuff can be found in the documentation right? Especially with respect to setting classpath, adding jars. I'm sure the installation notes have some information too.

Well, with the best will in the world, even if one does trawl through the so called "Help" info, sometimes all it needs is a little more clarification, or someone to explain in a different way. I've had problems with a Borland compiler, and if it wasn't for the extra help I had here, plus one of the guys mentioning that you need to include "" when saving a file -which was notmentioned in the Help/Readme bits and pieces, doubtless I would still be trying to fix it.

I do understand how frustrating it might be for people with more knowledge to think: gah! why don't you just reread the Help stuff!" especially when it might be apparent that people don't read that stuff, but, not everyone is lazy and just wants the easiest option. ;)
 
...for all your help. I have sorted out the problem...rather it sorted itself out. :p As somewhere through the middle of the posts it was mentioned, the syntax was right, but, ...please dont kill me... , I didnt include one of the files required to compile. :eek:

But sifting through the juggernauts of the manuals, I did learn a few new things, like COME HERE FIRST :D (just kidding!!) So now, after loss of 50% of my hair, I installed Forte,lol, and now the Filesystems Tab on my Explorer is missing...

Got to figure how to get that back...sigh

Again, thx very much

Regards,
hellfire

Coding is like a pandora's box, you never know what you are standing in until you take a good whiff.

[This message was edited by hellfire on November 12, 2001 at 00:46.]
 
Status
Not open for further replies.