|
All I can say is..AAAGGGHHH!!! I tried to move the source to the com/ShipleyPgpEdi directory, I tried to compile from the root folder, from my home folder, and from the /com/ShipleyPgpEdi folder. All had the same results. I even tried to import the com.ShipleyPgpEdi.SystemProp; class. I received the same error that it can not resolve the symbol. I compiled the classes successfully on a PC using the same package and folder structure. Any other ideas? Mike ----- Original Message ----- From: "Blair Wyman" <blairw@us.ibm.com> To: <java400-l@midrange.com> Sent: Wednesday, October 31, 2001 12:55 PM Subject: Re: Problems compiling a javaprogram > > A couple of ideas... > > First, it doesn't appear that your directory structure > (/com/ShipleyPgpEdi/src) matches the package definition > (com.ShipleyPgpEdi). I believe you do need to have the directory structure > match the package definition, so you probably want to move the 'src' > directory below the /com in your hierarchy (or remove it). > > Next, you do want to specify the package/directory qualified name on the > compile command. > > I was able to sort of reproduce the errors you're seeing if I tried to > compile while in the same directory as my Java source, instead of being at > the root of the package. For instance, I made a directory > /home/blair/my/pkg and put two files in it -- c1.java and c2.java. c1.java > just tries to instantiate a new c2. Both are declared to be in 'package > my.pkg;' > > Here they are: > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - > // File c1.java > package my.pkg; > public class c1 > { > public static void main(String[] args) { > c2 = new c2(); > } > } > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - > // File c2.java > package my.pkg; > public class c2 { > } > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - > > If I compile like so, with the directory-qualified names, it works: > > cd /home/blair > $ > > javac my/pkg/c1.java > $ > > ls -l my/pkg > total: 64 kilobytes > -rw-rw-rw- 1 BLAIR 0 288 Oct 31 10:49 c1.class > -rwxrwxrwx 1 BLAIR 0 176 Oct 31 10:37 c1.java > -rw-rw-rw- 1 BLAIR 0 256 Oct 31 10:49 c2.class > -rwxrwxrwx 1 BLAIR 0 152 Oct 31 10:37 c2.java > $ > > However, if I change to the directory containing the source, I see these > failures (that look like yours): > > > cd my/pkg > $ > > rm *.class > $ > > javac c1.java > c1.java:5: cannot resolve symbol > symbol : class c2 > location: class my.pkg.c1 > c2 z = new c2(); > ^ > c1.java:5: cannot resolve symbol > symbol : class c2 > location: class my.pkg.c1 > c2 z = new c2(); > ^ > 2 errors > $ > > So, first I'd recommend realigning your directory structure to reflect the > package declaration (I really think that is required), and next to compile > from the directory *below* the first one in the package declaration, using > directory/package-qualified names. > > HTH. > > -blair > > Blair Wyman -- iSeries JVM -- (507) 253-2891 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "I was born not knowing, and have had only a > little time to change that here and there." -- Richard P. Feynman > > > > > "Mike Silvers" > <msilvers@hbs-inc. To: "Java400L List" <java400-l@midrange.com> > com> cc: > Sent by: Subject: Problems compiling a javaprogram > java400-l-admin@mi > drange.com > > > 10/31/2001 09:51 > AM > Please respond to > java400-l > > > > > > Hi all. > > I have a problem using the javac command in the QSH environment. I set the > classpath to include my package directory. When I try to compile a class, > I > receive the following error: > > /com/ShipleyPgpEdi/src/newAS400Connection.java:71: cannot resolve symbol > symbol : class SystemProp > location: class com.ShipleyPgpEdi.newAS400Connection > SystemProp sp = new SystemProp(); > ^ > /com/ShipleyPgpEdi/src/newAS400Connection.java:71: cannot resolve symbol > symbol : class SystemProp > location: class com.ShipleyPgpEdi.newAS400Connection > SystemProp sp = new SystemProp(); > ^ > > Now, I looked at the class file SystemProp and it does exist in the package > folder. I then looked at the authorities of the SystemProp class file. I > changed the authorities to include PUBLIC *RWX and *ALL. I rechecked the > classpath to make sure it included the package folder (where the SystemProp > class resides). I even tried to use the javac command with the -classpath > parameter and specified the classpath where this class file is located. > All > of the other imports are able to be resolved. I did not specifically > import > this class because the SystemProp class is in the same package as the class > I am trying to compile. This is really frustrating. > > I made sure of the following: > > 1. The class file SystemProp exists. > 2. PUBLIC had *RWX and *ALL authority to this class file. > 3. There are no other authority issues with this class file (ie: > excludes, etc). > 4. The path for SystemProp exists in the classpath. > 5. Both .java files specify the same package statement. > > What am I missing? > > Mike > > ================================ > > Mike Silvers > AS/400 Senior Programmer/Analyst > AS/400 IBM Certified RPG IV Developer > AS/400 IBM Certified Solutions Expert > Hainey Business Systems > 8 E. Canal St > Dover, PA 17315 > Branch Office: (410) 397-8739 > Phone: (800) 932-3380 > Fax: (717) 292-9474 > Web: http://www.hbs-inc.com > ________________________________ > Providing E-Commerce, EDI, AS/400 > Development and related services > nationwide. > ================================ > > > _______________________________________________ > This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) > mailing list > To post a message email: JAVA400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l > or email: JAVA400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l. > > > > > > _______________________________________________ > This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list > To post a message email: JAVA400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l > or email: JAVA400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/java400-l. > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.