• Post Reply Bookmark Topic Watch Topic
  • New Topic

Works in window but not in Linux  RSS feed

 
Abdur Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am running a JAVA application on IBM Websphere on my local machine (Windows XP) which works fine but when I deploy that app on Linux with same configuration I am getting �java.lang.StringIndexOutOfBoundsException: String index out of range:� exception. Any idea???

Abdur
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Abdur-

Welcome to JavaRanch.

You'll need to tell us a bit more about what the code does when the exception occurs. Post the problematic piece of code, what kinds of values it's working with, and the full stack trace of the exception. Without that information, it's not possible to guess what might be going wrong.
 
Abdur Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I afraid if I post the code it won't help that much since the code is huge. However, if you could tell me about string limitation of Linux. Does linux (Ver: 2.4.21-32.0.1.ELsmp
) have restrictions on Java string? Does it matter whether it is running on 64bit or 32bit applications? Thanks.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The length of a String is only limited by memory. There may also be a limit imposed by the size on int, i.e. it can't be longer than 2GB.

But it's not the length of the string that's causing the problem, it's that the index is out of bounds. So you should determine what the index is, and whether at the time of the exception the string is what you think it is.
 
Gonzalo Nadal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we dont see the piece of code we cant help you.

Trying to read the program's mind I would say check the enviroment variables or the access to the file system.

Maybe you take a directory from your system and try to manipulate it removing the unit but as you know in linux there isn't the unit in the directory string.

Post the code, only the piece that fill the string and the line in which you have the exception and maybe we can help you.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to post the code for the entire program, just the part that is causing the problem. I'm not sure why you see this behavior in Linux but not in Windows. Please post some of the code so that we can see what you are trying to do.

Layne
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!