Target VM failed to initialize

edited March 2017 in Using Processing

A friend of mine is a teacher and is interested in programming but has never really done it before. I wrote a clock program after I saw a similar project online and sent it to her. One of her students was trying to run the program and got an error saying "Target VM failed to initialize". I know that the program works. I have been trying to run it on multiple operating systems including on a raspberry pi and have had no issues getting it to run. Could someone try and explain what exactly might be going wrong on their end?

I have verified that they have the Clock.pde and the ttf font I used in a folder called Clock and I can't seem to figure out why the program will not run.

Thanks in advance!

Answers

  • What OS does she have? Processing version?

    Notice there was issues recently with NVidia cars and a version of processing: https://forum.processing.org/two/discussion/20562/could-not-run-the-sketch-target-vm-failed-to-initialize-errors-windows-nvidia
    https://forum.processing.org/two/discussion/comment/87939/#Comment_87939

    Also, can she run any of the provided examples? Does it work? if it does, then the issue is in your code and if you post it, people will e able to run it in other machines and maybe figure out the problem....

    Kf

  • edited March 2017
    int x;
    int y;
    int diameter;
    int length;
    PFont Font;
    
    void setup(){
      fullScreen();
    
      x = width/2;
      y = height/2;
      diameter = (47*height)/48;
      length = (11*height)/24;
    
      stroke(0, 0, 150);
      smooth();
    
      Font = createFont("georgia.ttf", height/15);
      textFont(Font);
      textAlign(CENTER, CENTER);
    }
    
    void draw(){
      background(0, 0, 25);
    
      strokeWeight(5);
      fill(0, 0, 50);
      ellipse(x, y, diameter, diameter);
      fill(0, 0, 150);
    
      fill(0, 0, 255);
    
      DigitalClock();
    
      DrawNumbers();
    
      fill(0, 0, 150);
    
      //SECOND HAND
      strokeWeight(3);
      float theta = ((TWO_PI * second())/60);
      PVector endPoint = PolarConvert(theta, length);
      line(x, y, endPoint.x, endPoint.y);
    
    
      //MINUTE HAND
      strokeWeight(4);
      theta = ((TWO_PI*minute())/60)+((TWO_PI*second()))/3600;
      endPoint = PolarConvert(theta, length*7/8);
      line(x, y, endPoint.x, endPoint.y);
    
    
      //HOUR HAND
      strokeWeight(5);
      theta = (TWO_PI*(hour()%12)/12) + ((TWO_PI/12)*minute()/60);
      endPoint = PolarConvert(theta, length*2/3);
      line(x, y, endPoint.x, endPoint.y);
    }
    
    void DigitalClock(){
      int hourI = hour()%12;
      if(hourI == 0)
        hourI = 12;
      String hour = Integer.toString(hourI);
    
      int minuteI = minute();
      String minute = Integer.toString(minuteI);
      if(minuteI < 10)
        minute = "0" + minute;
    
      int secondI = second();
      String second = Integer.toString(secondI);
      if(secondI < 10)
        second = "0" + secondI;
    
      text(hour + " : " + minute + " : " + second, x, y + (width/6));
    }
    
    void DrawNumbers(){
      for(int i = 0; i < 12; i++){
        int hour = i;
        if(hour == 0)
          hour = 12;
        float theta = (i*TWO_PI)/12;
        PVector numPoint = PolarConvert(theta, length-16);
        text(hour, numPoint.x, numPoint.y);
      }
    }
    
    PVector PolarConvert(float theta, float r){
      theta -= HALF_PI;
      return new PVector(r * cos(theta) + x, r * sin(theta) + y);
    }
    
  • I believe she is running windows 7 and i know that she is using version 3.3.

    The student I was talking to trying to get it working had to go to class but i will ask them to try to run a sample program when they get back.

    Sorry i dont know how to format the code but i posted it there anyways.

  • No problem about formatting. Edit your post, select your code and hit ctrl+o to format your code. Make sure there is an empty line above and below your code

    I removed the PFont references and it works by the way.

    Kf

  • edited March 2017

    Simple fix. They did not have java installed on the school computer. Didn't know that was absolutely necessary as I thought processing covered those files for setting up the VM.

  • Answer ✓

    .... I thought processing covered those files for setting up the VM.

    When exporting a sketch, we've got the option to bundle Java's runtime or not. L-)

Sign In or Register to comment.