• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling package in Unix

 
Dean Reedy
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dean Reedy
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic