Help with a runtime error
hey guys im getting a runtime error that i can't figure out.
this is my code
import java.io.*;
public class InputOutput
public static void main(String[] args) throws IOException
int charCount=0,
wordCount=0,
nonCharCount=0,
lineCount=0;
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String fileName,outputFile, line;
do
System.out.println("Enter input file name.");
fileName = input.readLine();
System.out.println("Enter output file name.");
outputFile = input.readLine();
char [] charArray = new char [26];
charArray[0] = 'a';
for (int i=1; i<charArray.length; i++)
charArray[i] += 'a' + i;
int [] countArray = new int [26];
try
BufferedReader inputFile = new BufferedReader(new FileReader(fileName),1);
PrintWriter output = new PrintWriter(new FileWriter(outputFile));
line = inputFile.readLine();
while(line!=null)
String word = new String();
char ch;
for(int i=1; i<=line.length(); i++)
line = line.toLowerCase();
ch = line.charAt(i);
charCount++;
if(ch>='a' && ch<='z')
word +=ch;
int index = (int)ch - (int)'a';
countArray[index]++;
else
nonCharCount++;
if(word!= "")
output.println(word);
word = "";
wordCount++;
line = inputFile.readLine();
lineCount++;
output.println("Total number of words: "+wordCount);
output.println("Total number of lines: "+lineCount);
output.println("Total number of characters: "+charCount);
output.println("Total number of non-letter characters: "+nonCharCount);
for(int i=0; i<charArray.length; i++)
output.println(charArray[i] + " " + countArray);
output.close();
System.exit(0);
catch(IOException e)
System.out.println(e + ", try again");
while(true);
this is the error that i am getting
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 35
at java.lang.String.charAt(String.java:460)
at InputOutput.main(InputOutput.java:52)
Hi,
The error is at line 52. You are trying to index an array with an index that is greater than the size of the array.
/Kaj
Similar Messages
-
New Help with solving runtime errors
HI.
I am from a Microsoft world and I am so used to hitting F1 and using MSDN. I am also a bit of an Oracle developer too. hence my entery into java.
Now, I have started Java I was wondering where I should start to look with this error message:
ExampleApplet.java:41: �N���X actual.OpenlookButton �����������������B
OpenlookButton button3 = new OpenlookButton("Java is Cool!");
Line 41 in ExampleApplet.java is:
OpenlookButton button3 = new OpenlookButton("Java is Cool!");
The OpenlookButton.class is in the same folder as this class. How do I debug into this and find whats going wrong?
I tried the jdb utility yet it said it couldn't find the class file?
Help. You guys know what its like when you're starting out right?
Thanks
ps I'm using Windows 2000,
java version "1.2.2"
Classic VM (build JDK-1.2.2_005, native threads, symcjit)
DOS and notepad. YEEEHAAA!!!!Hi,
Firstly, why are you using such an old version of Java? Now there is a 1.4 version and you are still using a 1.2 version... I would suggest upgrading unless there is a concrete reason for staying with the old jdk (e.g. you are writing Java within some other system such as Lotus Notes).
I have never seen such a strange error message, it looks like there is something wrong with your character encoding with those strange outputs. Is your system using English or another language? Maybe it is just appearing snafu'd on this forum somehow...?
As far as the line of code you have supplied there is nothing wrong with it that I can see, assuming you have defined the class "OpenlookButton" which you say you have done.
(Upgrading to Java 2 would allow you to use Swing components, which allow a pluggable look-and-feel. Then you can use the JButton class - and any other JComponents - and the user or your application code can set the LookAndFeel to any that is available, including CDE/Open/Motif, thereby eliminating the need to define separate classes for components with different appearances...)
Is the current directory "." (thats a dot on its own) in the classpath? It needs to be otherwise the JVM won't look there to find the classes. Seems strange but when you think about it, it does make sense.
Also the error output lists the OpenlookButton class as being in the "actual" package but you say it is in the same path as the ExampleApplet. Try moving it into a subdirectory named "actual" and try again.
Good luck...
Ben
P.S. There is nothing wrong with a command prompt and notepad! Imho it is much better than using a crappy IDE which formats your code all wrong and leaves you clueless as to what is really going on....
P.P.S. For next time, the more details you post, including source code, the easier it is to help. -
How do I deal with a Runtime Error on Adobe Acrobat 9.5?
How do I deal with a Runtime Error on Adobe Acrobat 9.5? The instructions say to contact the support team but I have to pay in order to do so.
What operating system and what is the statement of the error. Typically you would first run a repair on Acrobat from the help menu (or in Windows you can do that from the Control Panel>Add/Remove Programs).
-
Job DIM_OBSERVER is getting canceled with with a runtime error UNCAUGHT_EXCEPTION
Dear Experts,
Job DIM_OBSERVER is getting canceled with with a runtime error UNCAUGHT_EXCEPTION. Below are the details of runtime error.
Category
ABAP Programming Error
Runtime Errors
UNCAUGHT_EXCEPTION
Except.
CX_UJA_ADMIN_ERROR
ABAP Program
CL_UJA_MD_QUERY_OPT===========CP
Application Component EPM-BPC-NW-ADM
Date and Time
02.08.2014 23:35:46
I am unable to find related note and solution for the same. any help would be much appreciated.
Thanks,
Akbar.Hi Akbar,
I believe this issue is coming up in BPC.
But could you please provide some more detailed information like when exactly(after performing which step) is this error occurring?
BR
Prabhith -
DTP run Time Error : Dump: Internal session terminated with a runtime error
Hi Experts,
I'm facing a problem during loading data from PSA to DSO from DTP. It gives Dump: "Internal session terminated with a runtime error".
When i went to PSA and see the no. of data packages, it is 1532.
Could anybody please help me how to load the data.
Thanks
AjayThanks Srini!!
the load is running for 15 min and then it is throwing dump without a single package extract.
Ok...the same I'm also thinking to selective upload but can you please explain me how do i do that as it has only request in PSA.
and it is a pricing data.
Thanks
Ajay -
System recovery fails with C++ runtime error
My Compaq CQ610-410US running Windows 7 is unusable. When using system recovery, either from CD's or Recovery drive, it fails with C++ runtime library program not found Contact HP Support. EIther way, Windows is loaded and system recovery screens appear. Once I respond to removing all accessories it then fails with the runtime error. Two questions, (1) is there a way around it? (2) will getting new recovery discs from HP even work?
This question was solved.
View Solution.All I can suggest is to order a set from HP and hope they work. This error is not a common one and the HP supplied recovery discs should work.
-
I need help with this code error "unreachable statement"
the error_
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errors
import java.util.*;
import javax.swing.*;
import java.awt.*;
public class Tools//tool class
private int numberOfToolItems;
private ToolItems[] toolArray = new ToolItems[10];
public Tools()//array of tool
numberOfToolItems = 0;
for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
toolArray[i] = new ToolItems();
}//end for loop
}//end of array of tools
public int search(int id)//search mehtod
int index = 0;
while (index < numberOfToolItems)//while and if loop search
if(toolArray[index].getID() == id)
return index;
else
index ++;
}//en while and if loop
return -1;
}//end search method
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0;
int index;
index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
}//end delete method
public void display()//display method
for(int i = 0; i < numberOfToolItems; i++)
//toolArray.display(g,y,x);
}//end display method
public String getRecord(int i)//get record method
// return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
}//end getrecod
}//end class
Edited by: ladsoftware on Oct 9, 2009 6:08 AM
Edited by: ladsoftware on Oct 9, 2009 6:09 AM
Edited by: ladsoftware on Oct 9, 2009 6:10 AM
Edited by: ladsoftware on Oct 9, 2009 6:11 AMladsoftware wrote:
Subject: Re: I need help with this code error "unreachable statement"
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errorsThe compiler is telling you exactly what the problems are:
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
int index;
index = search(id); //< -----------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
// <<== HERE where is the return statement?
}//end delete method
public String getRecord(int i)//get record method
// return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
}//end getrecod
}//end class -
Internal session terminated with a runtime error(ITAB_DUPLICATE_KEY)
Hi All,
Process Chain is failing While loading data from ODS to Cube iam getting error in DTP level internal session terminated with a runtime error(ITAB_DUPLICATE_KEY).Here my source is CRM.
Can you please suggest me for this issue.
Thanks,
Mahes.hi Maheesh,
Runtime Error ITAB_DUPLICATE _KEY is resulted because of Duplicate Transfer Structures from different Logical Systems.
You can find the corresponding entries in the table RSISOSMAP ..On executing,we have the option to give the InfoSource name(ISOURCE) for wich the data load got failed with Runtime Error ITAB_DUPLICATE_KEY..
You can coreect this error by running the Program RSAR_RSISOSMAP_REPAIR in repair mode , the program first checks the RSISOSMAP table and corrects any incorrect entries found. A log is then written for the mappings that were corrected.
This will solve your problem.
Please refer to link mention in above thread for more detail i have just summarize the things :
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a04c82eb-ec7c-2c10-7fae-ca6e764c483a?QuickLink=index&overridelayout=true
Thanks,
Deepak -
Please, could you help with The System Error?
Hi guys,
Please could someone help me with The system error: The Parameter is incorrect? which appears on the screen when I open Adobe Photoshop?
It is Starter edition3.0 and so far it worked ok and suddenly this message haunts my screen. If I clic OK, whole application disappears. I tried hundred times and checked it is 5.1.2600 and my notebook has got Windows XP Profesional.
Any advice hunging around?
ThaaankxJThank you mark, I'll try.
J
Date: Fri, 18 Mar 2011 17:17:20 -0600
From: [email protected]
To: [email protected]
Subject: Please, could you help with The System Error?
Hi orion,
Sorry that was the impression made by the support agent. If the version of the software that you have is 3.0 or 3.2, then the catalog can be upgraded when you run the trial version of Photoshop Elements. Version 8 had no time limitations, not sure if version 9 will timeout after 30 days or not.
Just install, and when you launch, Elements will automatically convert the catalog to a format that it can read.
-Mark
> -
Could someone help me with a Runtime Error while saving a PDF file?
While saving a 28 page PDF file in Illustrator today, I got a window saying, "This application has requested the "Runtime" to terminate it in a unusual way." It said to contact the applications support team for more information. I keep getting the same thing each time I try it. Does anyone know how to fix this issue or how I contact the applications support team ?
Thank you for any insight.
PamIt is a 13.5x11 inch calendar. There are 14 pages with images on them and
some text. The other pages have text, a grid and a colored background with a
gaussian blur. I saved each page as an "outline".
The printer I am using requested I save all pages in a pdf file. I was
successful in saving all but about six pages, now I can't even open the
file.
What happens is... I open Illustrator
I open the pdf file
A window appears that says... Runtime Error,
This application has requested the Runtime to terminate it in an unusual
way. Please contact the application's support team for more information.
I select ok
then a window appears that says... Adobe
Illustrator CS5 has stopped working. A problem caused the program to stop
working correctly. Windows will close the program and notify you if a
solution is available.
Then the program closes.
So far I have not been notified of anything.
Please let me know if you need more details.
Thank you so much for helping me with this.
Pam -
Help with "Testing Failed" Error message in iWeb09
I bought the iLife 09 upgrade purely so I could publish to my own domain server. I have a MobileMe account and iWeb09 publishes fine there--no problems.
My domain name is hosted on a Windows NT server. The admin is willing to help, but I was hoping someone could point me to documentation for this error:
"Testing Failed.
Unable to write to server. Verify your settings and try again."
If I ftp to the site in a terminal window and do a put, I can write to the site. Obviously, I could at some point, because it servers the "dummy" page I put up, but I tested again in case my permissions had changed.
I looked at the "Publishing to Windows-based FTP Server" but it does not seem to describe this error.
BTW, I pay AppleCare for support, but when I tried to get support documentation from them, the tech said they "can't help" with this part of iWeb and hung up on me--the call lasted exactly 90 seconds.
I am hoping someone out here will know where the errors are documented or will be able to help me figure it out.I waded through the posts for iWeb09 and came across a recommendation for Cyberduck (www.cyberduck.ch), so I tried a copy. Works like a champ. Unlike iWeb09, all I had to do was type in my server name, user name, and password to open the connection. Then I published my site to a folder in iWeb and uploaded the folder in Cyberduck. Cyberduck had no problem writing to the server.
I still would love to know why iWeb can't write to my web server. -
I Need help with the following error:
Hi, I am getting the following error:
<b>BPE_ADAPTER">SYSTEM_FAILURE_INTERNAL</b>
I have looked at some of the other threads that deal with this but since I am new to XI I am not sure where to look. I have tried to activate in SXI_CACHE and I get a code of 99 with the following error. I did not get this error in the QAS environment, only when it was moved to Prod. We have cleared and reset all of the caches and am still getting this error when I try to activate in SXI_CACHE:
<b>E 'STATUSCODE' is not a component of data object 'PAYLOAD'</b>
Can someone point me in the right direction to fix this? We just moved it to prod and need to get it fixed asap.
Thanks in advance for all of the help.
Mike CurtisHi Michael,
Before SP16:
the problem should be solved with the help of note 890760. You might find note
816430 interesting as well, but the first one should help you solve the problem.
After:
If those are already in your system, have a look at note 996631. This could be
the solution.
Regards and good luck with XI.
Jaime -
Can not get the MacBook Pro to back up to Time Capsule. Can any one help me with the following Error Please?
The backup disk image “/Volumes/Data/XXXXXXXXXX MacBook Pro.sparsebundle” is already in use.We don't see that error much but it is about the easiest to fix.
Pull the power on the TC.. count to 10. Plug the power back into the TC.
Viola.. working TC again. -
popup window after loading Firefox:
Runtime Error!
Program: C:\ProgramFiles\Mozilla Firefox\firefox.exe
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.The R6034 error can be caused by the VideoLAN plugin, but your plugins list doesn't show that plugin.
See:
* [[Troubleshooting plugins]]
* [[Troubleshooting extensions and themes]] -
CTM Run failing with TSV_TNEW_PAGE_ALLOC_FAILED runtime error
Hi,
While doing the CTM run,system is giving the memory dump with run time error TSV_TNEW_PAGE_ALLOC_FAILED.
I understand this is because memory constraint and possible recommendation to either increase the Memory or reduce the master data selections for planning but would like to know if some master data discrepancy can cause the infinite run of CTM and hence memory dump like product at location being set as Inhouse production but no PPM maintained for it.
Any suggestions on this willl reward points.
Thanks,
Manish
Edited by: Manish Thukral on Jun 24, 2008 9:34 PMMarcelo,
Thanks for you reponse.Can you please share some more information on what explanation profile is and where it is set so that can I check.
Manish
Maybe you are looking for
-
Why does my 3rd Gen iPod Touch still play through the speaker when I plug my headphones in?
When I plug my headphones into my iPod, it plays through them, but it also continues to play through the built in speaker. Does anyone know how this can be fixed? Thanks
-
Firefox does not fully load Barclaycard Authentication site. It loads as far as asking for certain letters in my pasword but does not load the "Submit" button so I cannot continue with my purchase and have to switch to IE8 browser to purchase anythin
-
How do I select & burn mailboxes in Apple's Mail to a disk?
How can I select & burn mailboxes in Apple's Mail program to a disk?
-
I was aware that BT was stopping supplying the service to new customers, but just read that the service is planning on being canned in 2014. As this was an integral part of the service when I joined and I do make use of the service, hence my renewals
-
Monitor my dogs with iSight and Mac
First, I'm a novice at all forms of electronic media but learning fast. I've moved to Scotland with my two dogs who must now live in the kitchen-laundry room during the day while I'm at work. I want to set up my mac powerbook G4 with Tiger OS and an