Exception in thread "main" java.lang.NumberFormatException:For input String
this is a code about arrylist. but when I debug it.it metion:Exception in thread "main" java.lang.NumberFormatException:For input String at java.lang.NumberFormatException.forInputString(numberFomatExceptionio java:48)
at java.lang.Integer.parseInt(integer.java:468)
at java.lang.Integer.parseInt(integer.java:497)
at Get.getInt(manerger.java:208)
at LinkList.insertFirst(manager.java:94)
at manager.main(manager.java;20)
this is my code:
import java.io.*;
import java.lang.*;
public class manager
public static void main(String args[]) throws IOException
LinkList list=new LinkList();
System.out.println("input S can scan the grade\ninput D can delete one entry\ninput U can update the entry\ninput A can add one entry\ninput E can end");
int cr=System.in.read();
switch(cr)
case 'A':
list.insertFirst();break;//this is 20 row
case 'S':
System.out.println("input the s");break;
case 'D':
System.out.println("input the d");break;
case 'U':
System.out.println("input the u");break;
class Link
public int number;
public String name=new String();
public int chs;
public int eng;
public int math;
public Link next;
public Link(int number,String name, int chs,int eng,int math)
this.number=number;
this.name=name;
this.chs=chs;
this.eng=eng;
this.math=math;
public Link()
this(0,"",0,0,0);
public void displayLink()
System.out.println(number + " "+name+ " "+chs+ " "+eng+ " "+math+ " ");
class LinkList
public Link first;
public LinkList()
first = null;
public boolean isEmpty()
return first==null;
public void displayList()
System.out.println("");
Link current=first;
while(current!=null)
current.displayLink();
current=current.next;
System.out.println("");
public Link insertFirst() throws IOException
Get getdata=new Get();
int number=getdata.getInt();//this is 94 row
String name=getdata.getString();
int chs=getdata.getInt();
int eng=getdata.getInt();
int math=getdata.getInt();
Link newLink = new Link(number,name,chs,eng,math);
first=newLink;
return first;
public Link find(int key)
Link current=first;
while(current.number!=key)
if(current.next==null)
return null;
else
current=current.next;
return current;
public Link update(int key) throws IOException
Link current=first;
while(current.number!=key)
if(current.next==null)
return null;
else
System.out.println("Input the first letter of the subject:");
int c=System.in.read();
Get get=new Get();
switch(c)
case 'c':
current.chs=get.getInt();break;
case 'e':
current.eng=get.getInt();break;
case 'm':
current.math=get.getInt();break;
return current;
public float average(char key)
Link current=first;
float total=0;
float average=0;
float counter=0;
if(current==null)
return 0;
while(current!=null)
switch(key)
case 'c':
total=current.chs+current.next.chs;break;
case 'e':
total=current.eng+current.next.eng;break;
case 'm':
total=current.math+current.next.math;break;
current=current.next.next;
counter++;
average=total/counter;
return average;
public Link delete(int key)
Link current=first;
Link previous=first;
while(current.number!=key)
if(current.next==null)
return null;
else
previous=current;
current=current.next;
if(current==first)
first=first.next;
else
previous.next=current.next;
return current;
class Get
public static String getString() throws IOException
System.out.println("Input your name:");
InputStreamReader str = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(str);
String s = br.readLine();
return s;
public static int getInt() throws IOException
System.out.println("Input your data:");
String st = getString();
return Integer.parseInt(st);//this is 208 row
}
It may be that the code in getString() returns a
String that ends with a newline. If that is the
problem, you can use
return (Integer.parseInt(st)).trim();1. getString will never return a String ending in newline. BufferedReader.readLine strips off the newline.
2. Even if you had a newline, String.trim doesn't trim newlines.
3. You would need to trim the String, not the int:
return (Integer.parseInt(st.trim()));As JimDinosaur said, you are passing bad data (the value of "st").
In getInt, add this before trying to parse "st":
System.out.println("###"+st+"###");What does it print?
Similar Messages
-
Hi,
I'm trying to run a program I've written but keeping getting this error:
Exception in thread "main" java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
at java.lang.Double.parseDouble(Double.java:482)
at data.newLineToRead(data.java:21)
at data.data(data.java:34)
at train.main(train.java:86)
I'm not quite sure where I'm going wrong.I've included the data class and train class.Could someone pls help me.
Thanks a lot.
Data Class:
import java.io.*;
import java.util.*;
public class data{
private static parameter par;
private static double[][] x=new double[par.n()][par.D()];
public static double[] t=new double[par.n()];
public static void newLineToRead(String LineToRead,int n){
int d=0;
String stringToRead=new String();
for(int i=0;i<=LineToRead.length();i++){
StringTokenizer str = new StringTokenizer (stringToRead,"/t");
String[] strtemp = new String[str.countTokens()];
while (str.hasMoreTokens()){
x[n][d++] = Double.parseDouble(str.nextToken());
d++;
System.out.println(x[n][d++]);
stringToRead=new String();
t[n]=Double.parseDouble(stringToRead);
x[n][par.d()]=1.0;
public static void data() throws IOException{
DataInputStream in=null;
try{
in=new DataInputStream(new FileInputStream(par.f()));
for(int n=0;n<par.n();n++){
String LineToRead=in.readLine();
if(LineToRead.length()==0){
System.out.println("Remove empty lines");
else{
newLineToRead(LineToRead,n);
}finally{if(in!=null){in.close();}}
public static double x(int n,int d){return x[n][d];}
public static double t(int n){return t[n];}
}Train Class
import java.io.*;
import java.util.*;
public class train{
private static parameter par;
private static data dat;
private static model mod;
private static response resp;
private static void error(String msg){
System.out.println(msg);
System.exit(1);
private static void check(){
if(par.f().length()==0)
error("No filename of input vectors!");
if(par.n()==0)
error("No number of input vectors!");
if(par.d()==0)
error("No number of input variables!");
if(par.d()>par.D())
error("Dimension is larger than 100!");
private static void usage(){
System.out.println("Non-default parameters==========================");
System.out.println("-f filename of input vectors");
System.out.println("-n number of input vectors");
System.out.println("-d number of input variables");
System.out.println("Default parameters==========================");
System.out.println("-R regularisation constant (must be positive and the default value is 0.0)");
System.out.println("-S epsilon criterion for stopping a learning process (default value is 0.001)");
System.out.println("-C maximum learning cycle (default value is 10000)");
public static void main(String[] argv){
if(argv.length==0){
System.out.println("Command line is <Java [-cp path] train parameters>");
usage();
System.exit(1);
if(argv.length==1 && argv[0].equals("help")==true){
usage();
System.exit(1);
par.nin(0); par.din(0); par.Rin(0.0); par.Cin(10000); par.Sin(0.001);
for(int i=0;i<argv.length;i++){
if(argv.equals("-f")==true){
if((i+1)==argv.length)
error("miss the para");
par.fin(argv[i+1]);
i++;
else if(argv[i].equals("-d")==true){
if((i+1)==argv.length)
error("miss the para");
par.din(Integer.parseInt(argv[i+1]));
i++;
else if(argv[i].equals("-n")==true){
if((i+1)==argv.length)
error("miss the para");
par.nin(Integer.parseInt(argv[i+1]));
i++;
else if(argv[i].equals("-S")==true){
if((i+1)==argv.length)
error("miss the para");
par.Sin(Integer.parseInt(argv[i+1]));
i++;
else if(argv[i].equals("-C")==true){
if((i+1)==argv.length)
error("miss the para");
par.Cin(Integer.parseInt(argv[i+1]));
i++;
else if(argv[i].equals("-R")==true){
if((i+1)==argv.length)
error("miss the para");
par.Rin(Double.parseDouble(argv[i+1]));
i++;
else error("Unkown token");
check();
try {
dat.data();
}catch(IOException e) { System.err.println(e.toString()); }
try {
mod.model();
}catch(IOException e) { System.err.println(e.toString()); }
try {
resp.record();
}catch(IOException e){ System.err.println(e.toString()); }String stringToRead=new String();
for(int i=0;i<=LineToRead.length();i++){
StringTokenizer str = new StringTokenizer (stringToRead,"/t");
String[] strtemp = new String[str.countTokens()];
while (str.hasMoreTokens()){
x[n][d++] = Double.parseDouble(str.nextToken());
d++;
System.out.println(x[n][d++]);
stringToRead=new String();
t[n]=Double.parseDouble(stringToRead);
x[n][par.d()]=1.0;
}Not sure exactly what you are trying to do above but...
You are setting your String to an empty String with "new String()" and then parsing that empty String. Eventually, you are trying to parse a double from that empty String:
t[n]=Double.parseDouble(stringToRead);Also, I cannot think of a reason to ever use "new String()" when you could just use:
String myString = ""; -
Error in JSF - java.lang.NumberFormatException: For input string:
Nice day friends,
I am sure that this is one stupid question by newbie like me, but I already lost hope since there no many post on this error especially in JSF at Google.
Here the full error I've got :
executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@12bb287) threw exception
java.lang.NumberFormatException: For input string: "id"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at javax.el.ListELResolver.toInteger(ListELResolver.java:373)
at javax.el.ListELResolver.getValue(ListELResolver.java:167)
Here my snippet of code :
NationalityDO.java (managed bean)
public class NationalityDO implements Serializable {
@Id
@Column(name = "ID", nullable = false)
private String id;
private List nationalityList;
public NationalityDO() {
public NationalityDO(String id) {
this.id = id;
public String getId() {
return this.id;
public void setId(String id) {
this.id = id;
public List getNationalityList(){
NationalityDA da=new NationalityDA();
if(nationalityList==null){
System.out.println("if(nationalityList==null)");
try {
nationalityList=da.retrieveNationalityList();
} catch (Exception ex) {
ex.printStackTrace();
return nationalityList;
public void setNationalityList(){
this.nationalityList=nationalityList;
This is my NationalityDA (used to retrieve data)
public class NationalityDA {
public NationalityDA() {
public List retrieveNationalityList() throws Exception{
ArrayList ls=new ArrayList();
Connection con = null;
PreparedStatement ps = null;
ResultSet rsReturn = null;
try {
con = DBManager.getDBConnection();
String sql="select id,descr,setup_date,change_date from nationality order by id asc" ;
ps = con.prepareStatement(sql);
rsReturn = ps.executeQuery();
while(rsReturn.next()){
List lsNationality =new ArrayList();
lsNationality.add(rsReturn.getString(1));//id
lsNationality.add(rsReturn.getString(2));//descr
ls.add(lsNationality);
} catch(SQLException sqlex) {
sqlex.printStackTrace();
} finally {
con.close();
ps.close();
return ls;
Here my nationality.jsp
<h:dataTable value='#{nationality.nationalityList}' var='item' border="1" cellpadding="2" cellspacing="0">
<h:column>
<f:facet name="header">
<h:outputText value="Id"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Descr"/>
</f:facet>
<h:outputText value="#{item.descr}"/>
</h:column>
</h:dataTable>
Here my face-config.xml
<managed-bean>
<managed-bean-name>nationality</managed-bean-name>
<managed-bean-class>com.dataobject.nationality.NationalityDO</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/nationality/testNationality.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/nationality/testNationality.jsp</to-view-id>
</navigation-case>
</navigation-rule>
For your information, the retrieve of data work successfully, this is the table description in oracle database which is varchar for id,
SQL> desc nationality
Name Null? Type
ID NOT NULL VARCHAR2(4)
DESCR VARCHAR2(20)
SETUP_DATE TIMESTAMP(6)
CHANGE_DATE TIMESTAMP(6)
*If you feel that I should improve my writing in forum, I am really happy to know
Thanks,
unidthanks....
Actually I already view the site many times before but after you told me then I get the idea,that's y working together is better, because i sometimes won't realize my mistake even it was the easiest one...
So i just change my code in NationalityDA.java as
while(rsReturn.next()){
NationalityDO n=new NationalityDO();
n.setId(rsReturn.getString(1));
System.out.println("rsReturn.getString(1)"+ rsReturn.getString(1));
n.setDescr(rsReturn.getString(2));
System.out.println("rsReturn.getString(2)"+ rsReturn.getString(2));
n.setSetupDate(rsReturn.getDate(3));
System.out.println("rsReturn.getString(3)"+ rsReturn.getString(3));
n.setChangeDate(rsReturn.getDate(4));
System.out.println("rsReturn.getString(4)"+ rsReturn.getString(4));
ls.add(n);
Once again, thanks..and my 3 dukes are yours..
-unid -
Java.lang.NumberFormatException: For input string: "DESCRIPTION="
Colleagues,
eBis 11.5.10.2.
I'm getting a Warning in the concurrent manager when I submit a programme that has an attached xml template. The warning is stating: -
------------- 1) PUBLISH -------------
Beginning post-processing of request 2667735 on node BAMBI at 02-SEP-2011 17:32:56.
Post-processing of request 2667735 failed at 02-SEP-2011 17:32:57 with the error message:
One or more post-processing actions failed. Consult the OPP service log for details.
------------- 2) PRINT -------------
Not printing the output of this request because post-processing failed.
When I consult the OPP log in Sysadmin, I can see a not very helpful message: -
[9/2/11 5:32:57 PM] [UNEXPECTED] [36822:RT2667735] java.lang.NumberFormatException: For input string: "DESCRIPTION="
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at oracle.apps.xdo.generator.pdf.PDFGenerator.setFont(PDFGenerator.java:629)
at oracle.apps.xdo.generator.pdf.PDFGenerator.setProperties(PDFGenerator.java:468)
at oracle.apps.xdo.generator.ProxyGenerator.setProperties(ProxyGenerator.java:1373)
at oracle.apps.xdo.template.fo.FOHandler.startElement(FOHandler.java:262)
at oracle.apps.xdo.template.fo.FOHandler.startElement(FOHandler.java:204)
at oracle.apps.xdo.common.xml.XSLTMerger.startElement(XSLTMerger.java:55)
at oracle.xml.parser.v2.XMLContentHandler.startElement(XMLContentHandler.java:167)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1182)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:320)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1051)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5926)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3458)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3547)
at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:290)
at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:157)
[9/2/11 5:32:57 PM] [36822:RT2667735] Completed post-processing actions for request 2667735.
Now, this isn't programme specific as it's affecting all our BI Publisher reports. Also the specific report I am working on has the option to email. I'm finding that the emails still work and when I open the attachment, they are displaying in PDF format correctly - even though the concurrent manager completes with the above warning. The above warning doesn't let me view the output in PDF from Oracle Financials.
Any help would be greatly appreciated.
ThanksMaybe check if Metalink note 764180.1 applies? This appears to be a bug fixed with patch 7669965.
-
Hi ,
I am getting below error when I try to create a bpel project in oracle soa suite 12C, can any one help on this issue why it is happing, earlier am able to create bpel service.
java.lang.NumberFormatException: For input string: "63420;https=127.0.0.1"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at oracle.jdeveloper.webservices.wsdl.CachedWSDLReader.getNewReaderInstance(CachedWSDLReader.java:379)
at oracle.jdeveloper.webservices.wsdl.CachedWSDLReader$1.initialValue(CachedWSDLReader.java:299)
at oracle.jdeveloper.webservices.wsdl.CachedWSDLReader$1.initialValue(CachedWSDLReader.java:295)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:160)
at java.lang.ThreadLocal.get(ThreadLocal.java:150)
at oracle.jdeveloper.webservices.wsdl.CachedWSDLReader.getReaderImpl(CachedWSDLReader.java:309)
at oracle.jdeveloper.webservices.wsdl.CachedWSDLReader.getExtensionRegistry(CachedWSDLReader.java:425)
at oracle.jdeveloper.webservices.wsdl.CachedWSDLReader.readWSDLWithExtensionRegistry(CachedWSDLReader.java:468)
at oracle.tip.tools.ide.utils.xml.wsdl.WSDLUtil.parseWSDL(WSDLUtil.java:1398)
at oracle.tip.tools.ide.bpel.v2.datamodels.util.TemplateUtil.createProcessWSDL(TemplateUtil.java:1208)
at oracle.tip.tools.ide.bpel.v2.designer.builder.model.ProcessBuilderUtil.createWSDLFiles(ProcessBuilderUtil.java:198)
at oracle.tip.tools.ide.bpel.v2.designer.builder.model.ProcessBuilder.createIDEProject(ProcessBuilder.java:73)
at oracle.tip.tools.ide.bpel.v2.designer.builder.ui.CreationDialogPanel.doCreate(CreationDialogPanel.java:57)
at oracle.tip.tools.ide.bpel.shared.designer.processbuilder.ui.BPELCreationDialog.handleOK(BPELCreationDialog.java:199)
at oracle.tip.tools.ide.bpel.shared.designer.processbuilder.ui.BPELCreationDialog.actionPerformed(BPELCreationDialog.java:239)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6516)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
at java.awt.Component.processEvent(Component.java:6281)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4872)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at oracle.javatools.internal.ui.EventQueueWrapper._dispatchEvent(EventQueueWrapper.java:169)
at oracle.javatools.internal.ui.EventQueueWrapper.dispatchEvent(EventQueueWrapper.java:151)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:154)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
at java.awt.Dialog.show(Dialog.java:1082)
at java.awt.Component.show(Component.java:1655)
at java.awt.Component.setVisible(Component.java:1607)
at java.awt.Window.setVisible(Window.java:1014)
at java.awt.Dialog.setVisible(Dialog.java:1005)
at oracle.tip.tools.ide.bpel.shared.designer.processbuilder.ui.BPELCreationDialog.display(BPELCreationDialog.java:83)
at oracle.tip.tools.ide.bpel.shared.designer.manager.BPELDesignerManager.launchCreationDialog(BPELDesignerManager.java:53)
at oracle.tip.tools.ide.bpel.shared.designer.manager.BPELDesignerManager.launchCreationDialog(BPELDesignerManager.java:48)
at oracle.tip.tools.ide.bpel.shared.plugins.soa.sca.BPELComponent.createImplementation(BPELComponent.java:46)
at oracle.tip.tools.ide.fabric.gui.controller.ActionComponentEdit.add(ActionComponentEdit.java:118)
at oracle.tip.tools.ide.fabric.gui.controller.ActionComponentEdit.process(ActionComponentEdit.java:95)
at oracle.tip.tools.ide.fabric.gui.controller.DiagramController.processActionRequest(DiagramController.java:358)
at oracle.tip.tools.ide.fabric.gui.controls.DiagramSOAPopupHandler.actionPerformed(DiagramSOAPopupHandler.java:117)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6516)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
at java.awt.Component.processEvent(Component.java:6281)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4872)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4698)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at oracle.javatools.internal.ui.EventQueueWrapper._dispatchEvent(EventQueueWrapper.java:169)
at oracle.javatools.internal.ui.EventQueueWrapper.dispatchEvent(EventQueueWrapper.java:151)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Thanks in advance.
Cheers,
balaPlease paste composite.xml and bpel source file here. Looks like one of the endpoints is getting goofed up.
-
While running a BI Publisher 11g report i am getting this error
oracle.xdo.XDOException: java.lang.NumberFormatException: For input string: "500.01 Not to Exceed"
Any idea what could it be?
To me it looks like that its related to some datatype mismatch.
For some parameters report runs fine and for some it throws the above error.
Thanks
Ashishplz post sample for
For some parameters report runs fine and for some it throws the above error.what are you using for
datatype mismatch.?
do you use some format-number or .... ? -
Hi,
system i am using for Oracle SOA is :
Windows 64 Bit
i5 Processor
6 GB RAM
29 GB on C Drive is already free after installation of all SOA related products.
I have installed wlserver_10.3 for SOA 11g Development purpose and followed exact installation sequence and procedure as mention in oracle documentation
i created domain also and every thing look correct but after installation procedure there are "Additional actions required just after every thing installed" :
setting memory limit
starting weblogic server (Admin Server)
starting weblogic managed server
and so on
now Problem is when i execute C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin startWebLogic.cmd
as mention in oracle documentation i am getting following error message : (i have only included last error lines instead of complete console log)
oConsole= -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\
sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_oepe180\profiles\default\syse
xt_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sysext_ma
nifest_classpath;C:\Oracle\MIDDLE~1\patch_adfr1111\profiles\default\sysext_manif
est_classpath weblogic.Server
Listening for transport dt_socket at address: 8453
Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m
Caused by: java.lang.ClassNotFoundException: vXmx512m
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: ++Xmx512m. Program will exit.
Now to resolve this what i already tried are :
I change JAVA_HOME and PATH to jdk6 which came with web logic installer
Location is at :
JAVA_HOME : C:\Oracle\Middleware\jdk160_29
PATH : C:\Oracle\Middleware\jdk160_29\bin
The above dose not include any space between path
I ran the startWebLogic.cmd and got same error
After that I also added
CLASSPATH : C:\Oracle\Middleware\jdk160_29\lib\tool.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\jdk160_29\bin
WL_HOME: C:\Oracle\Middleware\wlserver_10.3
I ran the startWebLogic.cmd and got same error
I also used earlier path which I used with eclipse when I was working on other java development.
JAVA_HOME : C:\Program Files\Java\jdk1.7.0_21
PATH : C:\Program Files\Java\jdk1.7.0_21\bin
I ran the startWebLogic.cmd and got same error
Then I also gave PATH: C:\Oracle\Middleware\wlserver_10.3\server\lib (including the existing one using ; )
I ran the startWebLogic.cmd and got same error
Now may be there is a file called setSOADomainEnv.cmd in
< C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\ setSOADomainEnv.cmd>
That include some values for memory set :
set JAVA_OPTIONS=%JAVA_OPTIONS%
set DEFAULT_MEM_ARGS=-Xms512m –Xmx512m
set PORT_MEM_ARGS=-Xms512m –Xmx768m
if "%JAVA_VENDOR%" == "Oracle" goto OracleJVM
set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=768m
set PORT_MEM_ARGS=%PORT_MEM_ARGS% -XX:PermSize=256m -XX:MaxPermSize=768m
now as I change the red highlighted value to 512 value because I have less memory resource and I checked in installation documentation to change the above red highlighted value to 512 original is 1024 which is too high and it was crating problem and showing memory space problem so I change it to 512 and now I am not getting that memory space problem error but may be the above error is related with change value in setSOADomainEnv.cmd file or not
Following are my domain, weblogic and soa home directory path and all these path are exactly what it suppose to be according to Oracle Installation Documentation:
WebLogic :
C:\Oracle\Middleware\wlserver_10.3
C:\Oracle\Middleware\coherence_3.7
C:\Oracle\Middleware\oepe_11.1.1.8.0
SOA Oracle Home Directory :
C:\Oracle\Middleware\Oracle_SOA1
OSB Home Location :
C:\Oracle\Middleware\Oracle_OSB1
Domain name : soa_div_domain
Domain Location : C:\Oracle\Middleware\user_projects\domains
Application Location : C:\Oracle\Middleware\user_projects\applications
Domain Location: C:\Oracle\Middleware\user_projects\domains\soa_div_domain
form here i am trying to start weblogic : C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\startWebLogic.cmd
Please tell me any body want more details.
Thanks.I think you are missing a character '-'
USER_MEM_ARGS="Xms512m -Xmx512m -XX:MaxPermSize=128m"Add this character like follows
"-Xms512m -Xmx512m -XX:MaxPermSize=128m" -
Stuck for 2 days: Exception in thread "main" java.lang.NoClassDefFoundError
I wrote the code in netbeans 5.5 under windows XP and compiled perfectly. I tried to run the generated Jar file code in the command prompt and it did work perfectly.
C:\Datahub\dist> java -jar Datahub.jar
BUT when I took the jar file and tried to run it under linux here is what I got:
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: main.hw
at java.lang.VMClassLoader.transformException(java.lang.Class, java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:Datahub.jar,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
...4 more
The project i am working on is funded by IBM and they will be really mad if it didn't work :(
Please help.It is not clear what You want to run under Linux. Jar under JVM or native code? If You are going to use JVM make it clear for Yourself which one You are going to use and then make sure it is installed properly.
-
Error of compilation for an IOS project:
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
at adobe.abc.Algorithms$SetMap.get(Algorithms.java:226)
at adobe.abc.Algorithms$ExprWorkQueue.add(Algorithms.java:491)
at adobe.abc.Algorithms$ExprWorkQueue.addAll(Algorithms.java:524)
at adobe.abc.GlobalOptimizer.sccp_analyze(GlobalOptimizer.java:6007)
at adobe.abc.GlobalOptimizer.sccp(GlobalOptimizer.java:4733)
at adobe.abc.GlobalOptimizer.optimize(GlobalOptimizer.java:3615)
at adobe.abc.GlobalOptimizer.optimize(GlobalOptimizer.java:2309)
at adobe.abc.LLVMEmitter.optimizeABCs(LLVMEmitter.java:534)
at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:343)
at com.adobe.air.ipa.GOAOTCompiler.convertAbcToLlvmBitcodeImpl(GOAOTCompiler.java:243)
at com.adobe.air.ipa.BitcodeGenerator.main(BitcodeGenerator.java:85)
Compilation failed while executing : ADT
We allocate 4GB of memory for the compilator and the results is the same. The build is very long (~5 min)See if this helps
OutOfMemoryError: GC overhead limit exceeded when heap is just fine
regards
Pravin -
When compiling one of my projects, I am getting this error suddenly:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 14
at adobe.abc.GlobalOptimizer$InputAbc.readCode(GlobalOptimizer.java:1510)
at adobe.abc.GlobalOptimizer$InputAbc.readBody(GlobalOptimizer.java:682)
at adobe.abc.GlobalOptimizer$InputAbc.readBodies(GlobalOptimizer.java:403)
at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:326)
at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcodeImpl(AOTCompiler.java:472)
at com.adobe.air.ipa.BitcodeGenerator.main(BitcodeGenerator.java:82)
Compilation failed while executing : ADT
but only when targeting iOS. fo Android only, it works fine. Anyone have any ideas? I also logged it as a bug.I get the I/O exception while reading: D:\Java\HelloApplet (The system cannot find the file specified). I have previously compiled HelloApplet.java into HelloApplet.class using javac.exe
the two include statements in the sample HelloApplet I'm using are
import java.applet.*;
import java.awt.*;
I also have a ComponentEventTest.java file which I've made into a class with these two
include statements:
import java.awt.*;
import java.awt.event.*;
I can however compile .java files which have no include statements.
I take it that my classpath is not set correctly. Like I said earlier, I'm using winxp
and trying to set the classpath variable under system. I have tried under user too. The path names I've tried setting are C:\Program Files\Java\jdk1.5.0_02\, C:\Program Files\Java\jdk1.5.0_02\lib, C:\Program Files\Java\jdk1.5.0_02\include, and C:\Program Files\Java\jdk1.5.0_02\;C:\Program Files\Java\jdk1.5.0_02\lib;C:\Program Files\Java\jdk1.5.0_02\include.
How can I correct this? If it's possible, I would like to set a variable in windows
versus having to type extra commands at the command prompt everytime I try
to run a java class with java.exe. Any help would be much appreciated -
Exception in thread "main" java.lang.NoClassDefFoundError
Am using java 1.3.1 on Red Hat Linux 7.1
i get this error
Exception in thread "main" java.lang.NoClassDefFoundError
while running a simple program HelloWorld.java
helpWhen you use the "java" command, the only required argument is the name of the class that you want to execute. This argument must be a class name, not a file name, and class names are case sensitive. For example, "java HelloWorld.java" won't work because the class name isn't HelloWorld.java, it's HelloWorld. Similarly, "java helloworld" won't work because a class defined as "public class HelloWorld {" is not named helloworld due to case sensitivity. Finally, the .class file must be in a directory that is in the Classpath - that's where java.exe searches to find the file that contains the class.
-
HELP Needed with this error: Exception in thread "main" java.lang.NoClass
Folks,
I am having a problem connecting to my MSDE SQL 2000 DB on a WindowsXP pro. environment. I am learning Java and writing a small test prgm to connect the the database. The code compiles ok, but when I try to execute it i keep getting this error:
"Exception in thread "main" java.lang.NoClassDefFoundError: Test1"
I am using the Microsoft jdbc driver and my CLASSPATH is setup correctly, I've also noticed that several people have complained about this error, but have not seen any solutions....can someone help ?
Here is the one of the test programs that I am using:
import java.sql.*;
* Microsoft SQL Server JDBC test program
public class Test1 {
public Test1() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://LAPTOP01:1433","sa","sqladmin");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
} // Test
public static void main (String args[]) throws Exception {
Test1 test = new Test1();I want to say that there was nothing wrong
with my classpath config., I am still not sure why
that didn't work, there is what I did to resolved
this issue.You can say that all you like but if you are getting NoClassDefFound errors, that's because the class associated with the error is not in your classpath.
(For future reference: you will find it easier to solve problems if you assume that the problem is your fault, instead of trying to blame something else. It almost always is your fault -- at least that's been my experience.)
1. I had to set my DB connection protocol to TCP/IP
(this was not the default), this was done by running
the
file "svrnetcn.exe" and then in the SQL Server Network
Utility window, enable TCP/IP and set the port to
1433.Irrelevant to the classpath problem.
2. I then copied all three of the Microsoft JDBC
driver files to the ..\jre\lib\ext dir of my jdk
installed dir.The classpath always includes all jar files in this directory. That's why doing that fixed your problem. My bet is that you didn't have the jar file containing the driver in your classpath before, you just had the directory containing that jar file.
3. Updated my OS path to located these files
and....BINGO! (that simple)Unnecessary for solving classpath problems.
4. Took a crash course on JDBC & basic Java and now I
have created my database, all tables, scripts,
stored procedures and can read/write and do all kinds
of neat stuff.All's well that ends well. After a few months you'll wonder what all the fuss was about. -
Hi
I am trying to use type 4 driver to connect to my Oracle 9i Rel2 database. I downloaded the odbc14.jar from oracle and added in the C:\Oracle9i\jdbc\lib path. As on the website, I setup my environment:
Setting Up Your Environment
On Win95/Win98/NT:
- Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
[ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
- Make sure [ORACLE_HOME]\bin is in your PATH.
Still I am getting the following error during runtime:
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jdbc.InsertQueryEx.main(InsertQueryEx.java:11)
Below is the source code:
import java.sql.*;
import java.io.*;
public class InsertQueryEx {
public static void main(String[] args)throws Exception{
Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@Prashy:1521:orcl", "scott", "tiger");
DataInputStream din = new DataInputStream(System.in);
Statement stmt = con.createStatement();
while(true){
try{
System.out.println("enter emp name");
String name = din.readLine();
System.out.println("enter emp no");
int no = Integer.parseInt(din.readLine());
System.out.println("enter emp salary");
float sal = Float.parseFloat(din.readLine());
System.out.println("enter emp address");
String addr = din.readLine();
int count = stmt.executeUpdate("insert into myemp values("+no+",'"+name+"',"+sal+",'"+addr+"')");
if(count>0)
System.out.println("Record added");
else
System.out.println("Failed");
catch (Exception e){
System.err.println("Exception: "+e.getMessage());
Any help is appreciated
Thanks
PrashantI am sorry but I did add those in the classpath but still getting this error:
This is what I have for user variable in classpath:
.;C:\Oracle9i\jdbc\lib\ojdbc14.jar;C:\Oracle9i\jdbc\lib\nls_charset12.jar
error is:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jdbc.InsertQueryEx.main(InsertQueryEx.java:14)
Thanks -
DB:11.1.0.7
Oracle Apps:12.1.1
OS:RHEL Linux 4 86x64
Hi All,
On executing the following command on node 2 of TEST instance, we received the following error but did not find any such error messages in node 1
Notes: (1) Node 1 has java version:
java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
(2) Node 2 has java version:
java -version
java version "1.4.2"
gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Error message in node2:
On executing the following command on node 2 of TEST instance, we received the following error:
java oracle.jrad.tools.xml.importer.XMLImporter /tmp/custdocs/oracle/apps/pos/home/webui/customizations/site/0/PosHpgOrders.xml ....
/usr/bin/java: line 36: [: `)' expected, found -
Exception in thread "main" java.lang.VerifyError: verification failed at PC 152 in oracle.jdbc.driver.OracleDriver:registerMBeans(()V): String, int, or float constant expected
at JvBytecodeVerifier.verify_fail(byte, int) (/usr/lib64/libgcj.so.5.0.0)
at JvBytecodeVerifier.verify_instructions_0() (/usr/lib64/libgcj.so.5.0.0)
at JvVerifyMethod(_Jv_InterpMethod) (/usr/lib64/libgcj.so.5.0.0)
at JvPrepareClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at JvWaitForState(java.lang.Class, int) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib64/libgcj.so.5.0.0)
at oracle.adf.mds.tools.util.ConnectUtils.getDBConnection(java.lang.String) (Unknown Source)
at oracle.jrad.tools.xml.importer.XMLImporter.importDocuments(java.lang.String[], java.sql.Connection) (Unknown Source)
at oracle.jrad.tools.xml.importer.XMLImporter.main(java.lang.String[]) (Unknown Source)
Could anyone please share such an issue faced before and provide resolution as to what's wrong in here in node 2?
Thanks for your time!
Regards,Hi,
(2) Node 2 has java version:
java -version
java version "1.4.2"Do you run this command as applmgr user? If yes, did you source the application env file?
Could anyone please share such an issue faced before and provide resolution as to what's wrong in here in node 2?Why the java version is different on the both nodes?
Thanks,
Hussein -
Exception in thread "main" java.lang.NullPointerException
hi
I am new to Java, and taking an introductory course in java. I wrote the code given bellow and get following error "C:\java\assingment2>java test123
Exception in thread "main" java.lang.NullPointerException
at PartCatalog.Add(test123.java:56)
at test123.main(test123.java:102)"
Can any body help me please
import java.util.*;
class PartRecord
public String PartName;
public String PartNumber;
public float Cost;
public int Quantity;
public static int counter ;
public PartRecord()
{ PartName ="";
PartNumber="";
Cost = 0;
Quantity = 0;
counter = 0;
public void Set(String name, final String num,
float cost, int quantity)
PartName = name;
PartNumber= num;
Cost = cost;
Quantity = quantity;
counter++;
public float Get()
return Cost*Quantity;
public static int Counter() {return counter;}
class PartCatalog
public PartCatalog()
npart=0;
public void Add(String name, String num,
float cost, int quantity)
if(npart>=1000) return;
Parts[npart++].Set(name,num,cost,quantity);
public float ShowInventory()
int inventory = 0;
for(int i=0; i<npart; i++)
inventory+= Parts.Get();
return inventory;
public PartRecord[] Parts = new PartRecord[1000];
public int npart;
class ExtPartCatalog extends PartCatalog
public void Sort()
Arrays.sort(Parts);
public void Print()
for(int i=0; i<npart; i++)
System.out.println ( Parts[i].PartName + "\t "
+ Parts[i].PartNumber + "\t "
+ Parts[i].Cost + "\t "
+ Parts[i].Quantity + "\n");
class test123{
public static void main(String args[])
ExtPartCatalog catalog = new ExtPartCatalog();
catalog.Add("tire ", "1", 45, 200);
catalog.Add("microwave", "2", 95, 10);
catalog.Add("CD Player", "3", 215, 11);
catalog.Add("Chair ", "4", 65, 10);
catalog.Sort();
catalog.Print();
System.out.println("Inventory is " + catalog.ShowInventory());
ExtPartCatalog catalog2 = new ExtPartCatalog();
catalog2.Add("ttt ", "1", 45, 200);
System.out.print("\n\nTotally there are " + PartRecord.Counter() );
System.out.println(" Parts being set" );Thank you for your reply. I think i used
public PartRecord[] Parts = new PartRecord[1000];
so i have created the reference. I tries what you told me but it still did not work. I am putting the code again, but now in the formatted form so that you can read it more easily. I will appreciate your help. Thanks
<code>
import java.util.*;
class PartRecord
{ public String PartName;
public String PartNumber;
public float Cost;
public int Quantity;
public static int counter ;
public PartRecord()
PartName ="";
PartNumber="";
Cost = 0;
Quantity = 0;
//counter = 0;
public void Set(String name, final String num,
float cost, int quantity)
PartName = name;
PartNumber= num;
Cost = cost;
Quantity = quantity;
counter++;
public float Get()
return Cost*Quantity;
public static int Counter() {return counter;}
class PartCatalog
{ public PartRecord[] Parts = new PartRecord[1000];
public int npart;
public PartCatalog()
npart=0;
public void Add(String name, String num,
float cost, int quantity)
if(npart>=1000) return;
Parts[npart++].Set(name,num,cost,quantity);
public float ShowInventory()
float inventory = 0;
for(int i=0; i<npart; i++)
inventory= Parts[npart].Get();
return inventory;
/*class ExtPartCatalog extends PartCatalog
public void Sort()
Arrays.sort(Parts);
public void Print()
for(int i=0; i<npart; i++)
System.out.println ( Parts.PartName + "\t "
+ Parts[i].PartNumber + "\t "
+ Parts[i].Cost + "\t "
+ Parts[i].Quantity + "\n");
class azimi_a{
public static void main(String args[])
PartCatalog c = new PartCatalog() ;//= new PartCatalog[4];
c.Add("tire ", "1", 45, 200);
c.Add("microwave", "2", 95, 10);
c.Add("CD Player", "3", 215, 11);
c.Add("Chair ", "4", 65, 10);
<code>
Maybe you are looking for
-
File location dialog has started defaulting to specific server folder
A problem has recently arisen on one of our G5's with Tiger. It occurs during the actions of saving files, or navigating within apps to place, import or export files. When the primary work folder on our server is selected as the destination, or path
-
Firefox was doing one of its automatic updates and it never finished but a circle with a slash through it appeared on the icon and now Firefox won't launch. It gives the following error message: "The application "Firefox" cannot be launched. -10661"
-
How to reset (target) Windows Backup
If I setup a brand new 2012 R2 server and setup a Backup Schedule it all works fine. As long as I NEVER touch it. On one machine I changed the target to a better location. The whole backup seems to be at the new target, I can mount the virtual drives
-
AUR package not present in packer, why? [SOLVED]
Dear all, first: I'm not really sure this topic should be here or in "pacman" section, please be patient. I have a quick and simple question: I have been using packer for years, and never happened to me that I couldn't install a AUR package with it.
-
I have a prospective client that has 30 SAP instances it wants to connect to SPM. SPM will be implemented stand-alone at first(no other AC modules), with ERM to be implemented after SPM. Can SPM have an RTA connection to each of 30 SAP instances? I