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();
}
1
  • 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. Commented Feb 24, 2012 at 19:58

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.