I recently bought a new computer and I moved my projects from my old one to my new one. I did a compilation on all of my projects and they all worked fine, and most of them still do on my new computer, but one project in particular wouldn't display the custom cursor that I had moved. I made sure that I moved the picture with the project just to rule that out. I rewrote the source to match the new location on my new computer, but it still won't display. It gives me the error message:
Exception in thread "main" java.lang.IndexOutOfBoundsException: invalid hotSpot
at sun.awt.CustomCursor.<init>(Unknown Source)
at sun.awt.windows.WCustomCursor.<init>(Unknown Source)
at sun.awt.windows.WToolkit.createCustomCursor(Unknown Source)
at wtalfvn.Window.<init>(Window.java:32)
at wtalfvn.Main.main(Main.java:9)
My old computer is a 32 bit and my new one is a 64 bit, both run on Windows 7, I am using eclipse Kepler, but does it matter when using the Cursor and Toolkit?
Here is my code I used to create my Cursor
Image cursor = Toolkit.getDefaultToolkit().getImage("graphx/PNG/cursor.png");
Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(cursor,new Point(this.getX(),this.getY()), "cursor");
this.setCursor(c);
EDIT: Here is the whole code for those who want to see it.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Window extends JFrame{
Image ico= Toolkit.getDefaultToolkit().getImage("graphx/ico/icon.PNG");
TextBox tb=new TextBox();
public Window(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(800,600);
setVisible(true);
setFocusable(true);
getContentPane().setBackground(Color.BLACK);
setIconImage(ico);
setLocationRelativeTo(null);
setResizable(false);
setTitle("MYTITLE");
addKeyListener(new KeyAdapter(){
public void keyTyped(KeyEvent e) {
if (e.getKeyChar()==KeyEvent.VK_ESCAPE){
System.exit(0);
}
}
});
Image cursor = Toolkit.getDefaultToolkit().getImage( getClass().getResource("/graphx/PNG/cursor.png"));
Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(cursor,new Point(this.getX(),this.getY()), "cursor");
setCursor(c);
}
}