3 Replies Latest reply: Apr 5, 2007 10:07 PM by 807606 RSS

    i dont know how to run a jar file

    807606
      hi guys i wanna run with commands, a jar file that is generated from netbeans, in netbeans it runs perfectly but if i try to run it with commands "java file.jar" says:
      Exception in thread "main" java.lang.NoClassDefFoundError: Paint.jar

      and with command "java -jar file.jar":
      well the same errors but like 3 or 4 more

      and with command "java -jar file.Main"
      Failed to load Main-Class manifest attribute from Paint.Main

      any ideas?

      im running on linux, so i have a gnu virtual machine and i dont know if netbeans install other virtual machine, how can i know wich virtual machine is using netbeans? heeellppppppp!!!!!
        • 1. Re: i dont know how to run a jar file
          807606
          im running on linux, so i have a gnu virtual machine and i dont know if netbeans
          install other virtual machine, how can i know wich virtual machine is using
          netbeans? heeellppppppp!
          The command
          java -version
          will tell you what version of runtime you are using. It is really important
          not to use GNU's.

          The errors you are reporting are quite strange. Perhaps you should recompile the
          whole thing outside of NetBeans. Sun's Tutorial describes how classes can be
          combined to form an executable jar file here:
          http://java.sun.com/docs/books/tutorial/deployment/jar/index.html

          Apart from anything else, using the command line to build the jar file will enable you
          to describe your problem more precisely.
          • 2. Re: i dont know how to run a jar file
            807606
            im using GNU virtua machine how can i change settings to use JDK virutal machine instead?....
            • 3. Re: i dont know how to run a jar file
              807606
              On my system there was a link inside /usr/bin that pointed to the GNU runtime. When
              I installed java I removed it and replaced it with one that pointed to Sun's.
              pbrockway@linuxdeskd6off:/usr/bin$ ls -l java*
              lrwxrwxrwx 1 root root 22 2007-02-25 08:35 java -> /opt/jdk1.6.0/bin/java
              lrwxrwxrwx 1 root root 23 2007-02-25 08:35 javac -> /opt/jdk1.6.0/bin/javac
              pbrockway@linuxdeskd6off:/usr/bin$
              The idea is that when you execute a command like "java" the OS will look on
              its path and find /usr/bin/java, it will then follow the link and use the correct java
              executable.