aspose file tools*
The moose likes Beginning Java and the fly likes compiling package in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling package in Unix" Watch "compiling package in Unix" New topic
Author

compiling package in Unix

Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
ok, here is some information
Facts:
Unix - using java version 1.18
java installed on Unix at /opt/java
package name - Fleet
Fleet source files - stored at /test/java/Fleet
jar files used - oracle.jar, mail.jar
jar files at : /test/java/Fleet
Now my problem, I need to compile the Fleet package. I do not have permissions to any directories other than/test and below. I need to include into my package the jar files.
This does compile and work in a Windows envirnoment, but I want to run it in Unix. Any help to get started would be great.
I have tried:
from directory: /test/java
the following: /opt/bin/javac *.java
it acts like it can't find the jar files
Thanks
Dean
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Where are the jar files located?
It is not a permission issue, since a Java installation on UNIX will most likely allow the users to use it. Try to add the -classpath switch to the command line like this:
/test/java > /opt/bin/java -classpath PATH_TO_JAR_FILES *.java


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
I tried adding the path of the jar files to no avail.
path of the jar files is /test/java/Fleet
What I meant by not having permissions is that I can't add the jar files to any other directories other my own.
Here is what I tried from directory /test/java:
/opt/java/bin/javac -classpath /test/java/Fleet ./Fleet/*.java
What I get is :
./Fleet/ApacTransports.java:9: Package java.sql not found in import.
import java.sql.*;
^
./Fleet/ApacTransports.java:10: Package java.text not found in import.
import java.text.*;
^
./Fleet/ApacTransports.java:11: Package java.util not found in import.
import java.util.*;
^
./Fleet/ApacTransports.java:12: Package java.io not found in import.
import java.io.*;
^
./Fleet/ApacTransports.java:13: Package javax.mail not found in import.
import javax.mail.*;
^
./Fleet/ApacTransports.java:14: Package javax.mail.internet not found in import.
import javax.mail.internet.*;
^
./Fleet/ApacTransports.java:15: Package javax.activation not found in import.
import javax.activation.*;
^
./Fleet/ApacTransports.java:16: Class java.net.InetAddress not found in import.
import java.net.InetAddress;
^
./Fleet/ApacTransports.java:22: Superclass java.lang.Object of class Fleet.Apac.
public class ApacTransports {
^
./Fleet/ImportReport.java:3: Package java.sql not found in import.
import java.sql.*;
^
./Fleet/ImportReport.java:4: Package java.text not found in import.
import java.text.*;
^
./Fleet/ImportReport.java:5: Package java.util not found in import.
import java.util.*;
^
./Fleet/ImportReport.java:6: Package java.io not found in import.
import java.io.*;
^
./Fleet/ImportReport.java:12: Superclass java.lang.Object of class Fleet.Import.
public class ImportReport extends Object {
^
14 errors
Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
Well, I got it to work:
If anyone has an different example, I still would like to still it.
Here is what I did:
I had to set the classpath like this:
export CLASSPATH=/test/java/Fleet/oracle.jar:/test/java/Fleet/mail.jar:/test/java/Fleet/activation.jar:/opt/java:
To compile
/opt/java/bin/javac ./Fleet/*.java
To run
/opt/java/bin/java Fleet.ImportReport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compiling package in Unix