• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

cant find constructor in packaged jar

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is my compile error:
C:\javaproj\refunds\PatientFrameClient9.java:842: cannot find symbol
symbol : constructor FormFields(java.lang.String,java.lang.String,java.lang.String,double,java.lang.String,
java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,
java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,
java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,
java.lang.String)
location: class FormFields
FormFields ff = new FormFields(patnum, regid,
^
1 error

Tool completed with exit code 1

BTW i'm using textpad but command javac gives same result

i've packaged FormFields in a jar called DBStruct.jar with a package name of DBStruct (there are DB access classes in a subdirectory of DBStruct/DB with a package name of DBStruct.DB i moved the JAR to the ext directory and as an extra precatution ( after the above error occured) i added a classpath.

my full structure is C:\javaproj\refunds\DBStruct\DB the main class i'm compiling "PatientFrameClient9.java" is in refunds my procedure is to cd c:\javaproj\refunds
then c:\javac PatientFrameClient.java BTW the main class has imports for DBStruct.*; and DBStruct.DB.*;

i'm getting constructor (symbol) not found errors NOT class not found when i compile without using packages in another directory not problems at all.

I'm stumped

[ June 08, 2005: Message edited by: Carl Trusiak ]
[ June 08, 2005: Message edited by: Carl Trusiak ]
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps the constructor you're trying to call is not marked "public". For the constructor to be accessible outside of the package, both the class and constructor have to be public.
 
Bob Rubin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is the first part of the class

package DBStruct;
import DBStruct.*;
import java.io.*;

public class FormFields implements Serializable{
private String patnum;
private String regid;
private String reference;
private double refundAmt;
private String payto;
private String addr;
private String city;
private String state;
private String zip;
private String zipext;
private String backtoPFS;
private String finclass;
private String refby;
private String refbyext;
private String comments;
private String authYN;
private String authID;
private String telno;
private String io;
private boolean oa;
private String site;
private String operatorID;

public FormFields() {
this("", "", "", 0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", true, "", "");
}

public FormFields(String formPatnum, String formRegid, String formReference,
double formRefundAmt,
String formPayto,
String formAddr,
String formCity,
String formState,
String formZip,
String formZipext,
String formBacktoPFS,
String formFinclass,
String formRefby,
String formRefbyext,
String formComments,
String formAuthYN,
String formAuthID,
String formTelno,
String formIO,
boolean formOA,
String formSite,
String formOperatorID) {

patnum = formPatnum;
regid = formRegid;
reference = formReference;
refundAmt = formRefundAmt;
payto = formPayto;
addr = formAddr;
city = formCity;
state = formState;
zip = formZip;
zipext = formZipext;
backtoPFS = formBacktoPFS;
finclass = formFinclass;
refby = formRefby;
refbyext = formRefbyext;
comments = formComments;
authYN = formAuthYN;
authID = formAuthID;
telno = formTelno;
io = formIO;
oa = formOA;
site = formSite;
operatorID = formOperatorID;
}
both constructors are public and number of parameters match
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The construtor takes 22 arguments and your call is only passing 21. you need another String after the int value but before the boolean value
 
Bob Rubin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i count 22 in the error message 3 before the double 15 after the double but before the boolean and 2 after the boolean 3 + 1 + 15 + 1 + 2 -- works without the package -- on antoher main class I tried to compile when a packaged class RefundDB2 tried to use FormFields i get:

C:\javaproj\refunds\PatientServer9.java:114: createRefund(DBStruct.FormFields) in DBStruct.DB.RefundDB2 cannot be applied to (FormFields)
String status = RefundDB2.createRefund(o2);
^
1 error

Tool completed with exit code 1

BTW "o2" is a FormField Object

RefundDB2 is in package DBStruct.DB;
FormField is in package DBstruct;
 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Carl,


The construtor takes 22 arguments and your call is only passing 21. you need another String after the int value but before the boolean value


I counted the number of parameters many times but found that the the number of parameters are the same in the correct order.
 
Bob Rubin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i did a little experiment -- when i move RefundDB2 (which invokes FormField) to c:/ and compile it fails on getOperatorID() -- the 22nd field which (i recently added to FormField) when compiled in c:\javaproj\refunds\DBStruct\DB -- no problem

somehow i think i'm pulling an old bad class file instead of the one i want but i don't see how -- i'm going to delete all FormField.class files on my system - recompile - rejar and try again.
 
Bob Rubin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got it to work ;; added package refunds.DBStruct.DB to main classes -- no problem

WHY???
 
Bob Rubin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
changed package on my classes to just refunds
 
Bob Rubin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I HAVE a NEW question; how do i jar my main-class? package is refunds;

dir structure c/javaproj/refunds
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic