0

The following code did worked without any errors in Eclipse, but strangely when run by windows command prompt (cmd) it throws an exception. Does anyone know the reason?

spinner = new JSpinner(new SpinnerDateModel());
spinner.setEditor(new JSpinner.DateEditor(spinner, "HH:mm:ss"));
java.text.DateFormat df = java.text.DateFormat.getTimeInstance(DateFormat.SHORT);
try{
    Date date = df.parse("00:00:00");
    spinner.setValue(date);
}catch(Exception ex){
    ex.printStackTrace();
}
fazxclusive
  • 11
  • 1
  • 1
  • 3
  • 4
    Be more specific about the problem. What kind of exception is being thrown? With no other information, my initial suspicion is a `ClassNotFoundException` due to misconfiguration of the classpath when running from the command line. – Hamed Feb 24 '12 at 19:58

1 Answers1

1

Are Eclipse and your command prompt using the same JVM? Try checking the versions of both.

Find the JVM Eclipse is using: https://stackoverflow.com/a/557259/151110

For Windows check your PATH system variable or use this: https://stackoverflow.com/a/304441/151110

Community
  • 1
  • 1
Lchi
  • 416
  • 2
  • 6
  • 16
  • I checked both using the same jre that 1.7 I used System.out.println(System.getProperty("java.runtime.version")); the results were 1.7.0-b147 – fazxclusive Feb 25 '12 at 08:55