Java program will not work in his development directory

I have a 12 years/applet program that is on the web for 12 years. It's an interactive color wheel:

* http://r0k.us/graphics/SIHwheel.html

My development tools are a nice text editor and the JDK. No IDE is involved.

I'm doing a major update, which shows the names of the closest color to a database of the names of 1 567. I wrote it so it can run as an applet or program, and it works beautifully in the development directory. However, when I move the jar anywhere else, the following error appears:

D:\progming\temp > java SIHwheel
Exception in thread "main" java.lang.NoClassDefFoundError: SIHwheel
Caused by: java.lang.ClassNotFoundException: SIHwheel
in java.net.URLClassLoader$ 1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
The main class is not found: SIHwheel. Program ends.

The file I'm running is SIHwheel.jar. To further complicate things, TI sorting only works as an applet. Main elements of the canvas are missing, like the preset itself. So 3 cases:

(1) directory of the part: works beautifully as a program
(2) another directory, fails as program
3) run as an applet, highly degraded operation

This used to work fine, any where, as a program or an applet. There are two fundamental differences about what I did before.

(1) the new ntc.class has an own main() (essentially for the test and demo for developers who can use it). I don't think it's a problem, because I have a jar manifest by declaring that the class has the main() I want to run.
(2) above, all classes comes from the SIHwheel.java file. However, ntc.class is from the ntc.java file. All classes are jar'red in SIHwheel.jar, however. Since ntc.java implements the functionality of the script ntc.js (name as color), and I want to share it, to keep this as a separate file.

I include a manifest file in the jar and, from the unzipped pot, the MANIFEST file. MF displays a line from the Main-Class: SIHwheel

What's not?

No, the main method is not called when you run a cmdlet (only when run as an application). See the Applet tutorial [url http://download.oracle.com/javase/tutorial/deployment/applet/subclass.html] (note that the example he use Swing and you use AWT).

A static initializer is called when a class is loaded. If do you the private init() method and make sure it is called when someone uses the class with:

public class NameThatColor {
  private static float[][] rgbhsl;
  private static final String names[][] = { .. }

  static {
    init();
  }

  private static init() { ... }
}

Note that the static variable are reported before the static initializer and nothing else should call init();

Tags: Java

Similar Questions

Maybe you are looking for

  • When I hit the play button to a voice message, it does not play

    I have an iPhone 5 and trying to listen to voice messages, it won't play.  I hit the play button (arrow) and the button show break but does not do anything, and the number of bands/message remains the same.  How can I fix it?

  • Satellite L500 - impossible to find on the laptop model Toshiba support page

    Hello! I have support problems with my laptop...When I try to get help or register my Satellite, I can find my number of series/model number on any site of toshiba. When I try to serial number valid; I get this: "Spiacenti! He number di series non es

  • The desktop icons highlighted

    Hello Just a small problem.My desktop icons have all highlighted and I can't seem to fix this Anyone have clues Thank you Fred

  • NDK errors with external file

    I get no error in my code, but for some reason, I get errors in the file: 'unistd.h' located in '\target\qnx6\usr\include\ [ndkdir] '. I have 13 of them. Errors are: '' ssize_t' in the namespace "std" does not name a type', "std::dev_t has not been d

  • Archiver written in parallel with Eve local standby site or copies of files?

    Dear administrators, Please help to alleviate the situation below. We have a database of Oracle 11 g 2 (production) and a physical rest for the same.for example, if the redolog files to archive are affected by the Virus on the Production site.Will be