Arduino doesn't run

When I try to run "arduino.exe" it shows the error "Java Virtual Machine Launcher: Could not find the main class. Program will exit.". I've seen this problem in the oficial F.A.Q. but i'm sure that I have the "lib" folder in the right place with the file "pde.jar" inside. Also when I try to run the "run.bat" it shows the error «Exception in thread "main" java.lang.StringIndexOutOfBounsException: Strin index out of range: -1 ... Press any key to continue". I've tried running the 0014, 0013 and 0012 but the problem persists. Also I've instaled the last version of Java and, like i've seen somehere, I deleted the Java folder from the Arduino folder - no results. I'm running Windows XP Pro SP3 in one LG S1 laptop (T2400 1.83 GHz). Does anyone can help me?

Rename pde.jar to and try to open it, maybe this file could be corrupted.

I changed the name to and it’s possible to open and/or extract it. I think the file is ok.

Delete the JAVA folder in the arduino ide path and try again :slight_smile:

When I delete the folder JAVA and try to run "arduino.exe" I don't get any error message but nothing happens, arduino don't run. And next I tried the "run.bat" and I get the error "The system cannot find the path specified...". :-/

Install the Java JRE from Sun's website

I did it, the problem persists... :'(

Very strange, the last thing, try with my installer:

It is the version 0013, but is only as a test

I installed it and when a run Arduino nothing happens... by the way thank a lot for your help eried. I really wish to make arduino run on my computer...

Does anyone have any more sugestion for this problem?

Depending on how this is all packaged, you might be able to run it from a shell as a Java command line. I see there is a run.bat that you might be able to use for this. If this .bat file doesn't work, at least you can see how it can be invoked using a JVM of your choice.

By breaking it down into pieces you might be able to find out where things are going wrong. If you get further, even a stacktrace, make sure you post the entire thing here.

You could also build sketches from the command-line using make and the supplied Makefile, but this probably requires GNU Make.

Clever Monkey when I run run.bat I get this:

«Exception in thread “main” java.lang.StringIndexOutOfBounsException: Strin index out of range: -1
at java.lang.String.substring
at java.lang.String.substring
Press any key to continue"»

This appears in Command Prompt of WinXP. This is diferent to run it like a shell as a Java command line?

The main preferences file is either corrupt somehow. It cannot even start up. It is choking on the "run.window.bgcolor=" property, which should be commented out. Check lib/preferences.txt and make sure it is sane.

It should not have got to the per-use preferences.txt yet, but check that, too, in case I missed something (I haven't had coffee yet.)


Wait, no this is wrong. It is the Java SystemColor.control.getRed() that is returning a String that is failing. It looks like this method is returning a single character, and the Arduino code is assuming (reasonably) that this should never happen.

I'd have to hook the debugger up to see what is going on, but I don't have a Windows box handy (I will in a week or so when my new Mac arrives.)

Meanwhile, trying hacking the run.bat to use a different JVM instead of the one bundled in the Arduino install. For example, you can go to Sun and get JVM 6, which should install a modern JVM in C:/Program Files/Java/jre6/

See if that works instead.

If you can't get this to work even with a new VM we can always patch this class to make it more robust in the face of changing UI information that can't always be counted on to be sane.

Hi Clever Monkey,

I downloaded the JVM 6 from the Sun site and changed the path in run.bat but still I have exactly the same problem. How can I patch the class to make it more robust? I think I don't undertand much about it :)

If I get time today I'll try to download the Arduino source to my Windows box at work and compile a patched class. We will have to tweak the run.bat a little to put our class in the classpath ahead of everything else, but it should work.

I am a little concerned that a fundamental thing like this is so broken on this machine (it appears that the JVM is getting something from your OS that is all wrong somehow) but the Arduino code can stand to be a little more defensive and a little less naive about the Big Bad World.

Just because I'm curious, do you have a very custom UI (i.e., some custom theme of some sort)? What sort of Windows are you running?

I'll post back here with a URL to the new class file(s) and instructions for hacking the run.bat. I have no idea how the .exe actually launches the VM with the main class in Arduino (there are many different ways to do this) so if we get this to work it will be by running a batch file.

I have Windows XP with Service Pack 3 and the normal appearance with "Windows Classic style". Windows is a oficial version that cames with the lg notebook. Thank you for your help!

Ok, grab the following file, and unzip it in your “Arduino-0015” directory. It should create a bunch of class files in the lib/build directory. The run.bat file already has the classpath set up. In fact, when I look inside the arduino.exe I see that the classpath is identical to the one in the run.bat, which is ideal for patching classes in this manner.

I didn’t get a chance to test this on Windows myself, so I hope the classes are picked up like I expect.

The bug was a corner-case. For some reason Java thinks you have GUI controls that have a background colour that (for the red component, anyways) is very dark. The Arduino code never considered this possibility, assuming that all hex colours it got from the OS would have at least two digits in them.

I’ll do my best to make sure this patch gets back to the GoogleCode Arduino project, but in case it doesn’t:

---      (revision 567)
+++      (working copy)
@@ -792,8 +792,23 @@
     String r = Integer.toHexString(what.getRed());
     String g = Integer.toHexString(what.getGreen());
     String b = Integer.toHexString(what.getBlue());
-    set(attr, "#" + r.substring(r.length() - 2) +
-        g.substring(g.length() - 2) + b.substring(b.length() - 2));
+      // Massage each RGB component so that it conforms to a reasonable
+      // "#rrggbb" format. This is pretty gross, actually.
+      if (r.length() < 2)
+            r = "0" + r;
+      if (g.length() < 2)
+            g = "0" + g;
+      if (r.length() < 2)
+            b = "0" + b;
+      r = r.substring(r.length() - 2);
+      g = g.substring(g.length() - 2);
+      b = b.substring(b.length() - 2);
+    set(attr, "#" + r + g + b);

Anyway, see if this helps. It should get you further, anyway.

hehehe!! It works! Man i'm so happy!! Thank a lot Clever Monkey. This should be implemented in the arduino code. If you come to Brno - Czech Republic I can pay you a beer!

Glad I could help.