aspose file tools*
The moose likes Java in General and the fly likes compiling with non-standard classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "compiling with non-standard classes" Watch "compiling with non-standard classes" New topic

compiling with non-standard classes

Iven Breeze

Joined: Jan 11, 2004
Posts: 6
I am trying to compile a program using jar files that are not a part of Java 1.4 But for some reason, I'm getting errors when I try to specify the classpath. Can someone give me some help? What is the exact syntax? BTW, the classes I want to compile with are the JAXB classes. I am sure I did it right, but still can't compile.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24187

The exact syntax is platform and implementation specific, actually, so you'd have to give a bit more info. In general, for Sun's implementations, it looks like
javac -classpath c:\dir\jar1.jar;c:\otherdir\jar2.jar
on Windows; on UNIX-like systems, which use semicolons properly as statement terminators, it looks like
javac -classpath /home/me/dir/jar1.jar:/home/me/otherdir/jar2.jar
There are other subtleties; you might show us what you tried and what errors you got.

[Jess in Action][AskingGoodQuestions]
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
I am sure I did it right, but still can't compile.
Well I wouldn't be too sure of that under tha circumstances.
There's more than one way to do this. You can set the system CLASSPATH in the OS, or you can use the -cp (-classpath) option on both javac and java commands. (Or you can use an IDE which does this for you behind the scenes.)
The simplest syntax is something like:
javac -cp /foo/bar/myjar.jar
Perhaps it would help to know what happens for you now. What command are you using to compile? What error message do you get?

"I'm not back." - Bill Harding, Twister
Iven Breeze

Joined: Jan 11, 2004
Posts: 6
I'm following Sun's tutorial on running JAXB, and using their examples. The directions are listed at under the "Configuring and Running the Examples Manually" section.
JAVA_HOME is set to my java directory, c:\j2sdk1.4.2\
JWSDP_HOME is set to my web servcies directory, c:\jwsdp-1.3\
I successfully ran the xjc batch file to create classes from the sample xml schema.
Then I tried to compile the Main java file and got the errors.
Here is the command line:
%JAVA_HOME%\bin\javac primer\po\*.java primer\po\impl\*.java

Here is one of the 100 error messages I get:

It can't find the JAXB classes .
So I changed the command line to list all the jar files in the C:\jwsdp-1.3\jaxb\lib directory.
Here was my new command line:
%JAVA_HOME%\bin\javac -classpath C:\jwsdp-1.3\jaxb\lib\jaxb-api.jar;C:\jwsdp-1.3\jaxb\lib\jaxb-impl.jar;
C:\jwsdp-1.3\jaxb\lib\jaxb-libs.jar;C:\jwsdp-1.3\jaxb\lib\jaxb-xjc.jar primer\po\*.java primer\po\impl\*.java
But still I get all the error messages.
Here is one of the error messages:

What can I do?
[ January 12, 2004: Message edited by: Iven Breeze ]
subject: compiling with non-standard classes