Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.StringIndexOutOfBoundsException: String index out of range: -2

807605Aug 3 2007 — edited Aug 3 2007
Hello,

I have a question about this error:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -2

I am doing my java development in IBM Rationale eclipse. I am compiling and running everything just fine. When I try to run my application on a command line I get this error. I don't know why this is happening since it is working perfectly in eclipse. I am running a .bat file and here is the .bat file:

@echo on
rem ---------------------------------------------------------------------------
rem Script for launching Translation Application
rem
rem Environment Variable Prequisites
rem
rem
rem ---------------------------------------------------------------------------
cls


SET DERBY_INSTALL=C:\Translation\Cloudscape_10.1
SET TRANSLATION=C:\Translation
set CLASSPATH=%DERBY_INSTALL%\lib\derby.jar;%DERBY_INS TALL%\lib\derbytools.jar;%TRANSLATION%\lib\Transla tion.jar;

echo %CLASSPATH%

C:\Translation\jdk\jre\bin\java -classpath %CLASSPATH%;C:\Translation\Conversions src.utilities.DataConversionUtilityDaily

pause

*********

Here is the code that is erroring out:

sqlStatement.append(text.deleteCharAt(text.length( )-2));

this code is compiling and executing just fine in eclipse but when i try to run it on a command line it gives me the above error.

Can someone help me find out why my program is not running?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2007
Added on Aug 3 2007
6 comments
894 views