a jni error has occured

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite
1












I uninstalled Eclipse IDE due to this issue.
Then I tried to run java program in my Linux mint Terminal.
So I started with a small code



public class Myth
public static void main(Stringargs)
System.out.println("Hii There");




and run it by giving commands javac Myth.java
and java Myth but insted of giving output it gives the following error



Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Myth, offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:729)
at java.net.URLClassLoader.access$400(URLClassLoader.java:95)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1184)
at java.security.AccessController.doPrivileged(AccessController.java:732)
at java.net.URLClassLoader.findClass(URLClassLoader.java:604)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:926)
at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:343)
at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:507)






share|improve this question

























    up vote
    2
    down vote

    favorite
    1












    I uninstalled Eclipse IDE due to this issue.
    Then I tried to run java program in my Linux mint Terminal.
    So I started with a small code



    public class Myth
    public static void main(Stringargs)
    System.out.println("Hii There");




    and run it by giving commands javac Myth.java
    and java Myth but insted of giving output it gives the following error



    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Myth, offset=6
    at java.lang.ClassLoader.defineClassImpl(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:729)
    at java.net.URLClassLoader.access$400(URLClassLoader.java:95)
    at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1184)
    at java.security.AccessController.doPrivileged(AccessController.java:732)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:604)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:926)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:343)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:507)






    share|improve this question





















      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      I uninstalled Eclipse IDE due to this issue.
      Then I tried to run java program in my Linux mint Terminal.
      So I started with a small code



      public class Myth
      public static void main(Stringargs)
      System.out.println("Hii There");




      and run it by giving commands javac Myth.java
      and java Myth but insted of giving output it gives the following error



      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Myth, offset=6
      at java.lang.ClassLoader.defineClassImpl(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:729)
      at java.net.URLClassLoader.access$400(URLClassLoader.java:95)
      at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1184)
      at java.security.AccessController.doPrivileged(AccessController.java:732)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:604)
      at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:926)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:343)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:507)






      share|improve this question











      I uninstalled Eclipse IDE due to this issue.
      Then I tried to run java program in my Linux mint Terminal.
      So I started with a small code



      public class Myth
      public static void main(Stringargs)
      System.out.println("Hii There");




      and run it by giving commands javac Myth.java
      and java Myth but insted of giving output it gives the following error



      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Myth, offset=6
      at java.lang.ClassLoader.defineClassImpl(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:729)
      at java.net.URLClassLoader.access$400(URLClassLoader.java:95)
      at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1184)
      at java.security.AccessController.doPrivileged(AccessController.java:732)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:604)
      at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:926)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:871)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:343)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:507)








      share|improve this question










      share|improve this question




      share|improve this question









      asked Jul 20 at 5:42









      Ujjwal Singh

      6112




      6112




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          This




          java.lang.UnsupportedClassVersionError




          means, that some of the libraries in your project are using diferrent version of java , and set accordingly in path.
          Quick things to resolve this:



          $>which java


          output->location of current java (eg. /usr/bin/java)



          java --version


          output->1.7.0 or 1.8.0
          if this is the case , try switching version, for this do the following:



          export JAVA_HOME=<path to diff java version sdk>
          export PATH=$JAVA_HOME/bin:$PATH


          This allows new path to come in front of old path, also for eclipse specific errors, take a look at eclipse cache in home directory(.eclipse folder in your project). You may safely delete this directory along ith .project files if any and recompile.



          Hope this helps!!
          Edit: Offset=6 means your current version for java(JDK) is 1.6. Try switching it to later versions. Also check that you are using Jdk path and not jre path






          share|improve this answer





















          • after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
            – Ujjwal Singh
            Jul 20 at 6:12











          • java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
            – Pavan Kate
            Jul 20 at 6:16










          • my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
            – Ujjwal Singh
            Jul 20 at 6:25










          • change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
            – Pavan Kate
            Jul 20 at 6:30







          • 1




            Reinstalled jdk and now it is working . Thanks @PavanKate
            – Ujjwal Singh
            Jul 20 at 7:12











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f457340%2fa-jni-error-has-occured%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          This




          java.lang.UnsupportedClassVersionError




          means, that some of the libraries in your project are using diferrent version of java , and set accordingly in path.
          Quick things to resolve this:



          $>which java


          output->location of current java (eg. /usr/bin/java)



          java --version


          output->1.7.0 or 1.8.0
          if this is the case , try switching version, for this do the following:



          export JAVA_HOME=<path to diff java version sdk>
          export PATH=$JAVA_HOME/bin:$PATH


          This allows new path to come in front of old path, also for eclipse specific errors, take a look at eclipse cache in home directory(.eclipse folder in your project). You may safely delete this directory along ith .project files if any and recompile.



          Hope this helps!!
          Edit: Offset=6 means your current version for java(JDK) is 1.6. Try switching it to later versions. Also check that you are using Jdk path and not jre path






          share|improve this answer





















          • after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
            – Ujjwal Singh
            Jul 20 at 6:12











          • java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
            – Pavan Kate
            Jul 20 at 6:16










          • my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
            – Ujjwal Singh
            Jul 20 at 6:25










          • change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
            – Pavan Kate
            Jul 20 at 6:30







          • 1




            Reinstalled jdk and now it is working . Thanks @PavanKate
            – Ujjwal Singh
            Jul 20 at 7:12















          up vote
          1
          down vote



          accepted










          This




          java.lang.UnsupportedClassVersionError




          means, that some of the libraries in your project are using diferrent version of java , and set accordingly in path.
          Quick things to resolve this:



          $>which java


          output->location of current java (eg. /usr/bin/java)



          java --version


          output->1.7.0 or 1.8.0
          if this is the case , try switching version, for this do the following:



          export JAVA_HOME=<path to diff java version sdk>
          export PATH=$JAVA_HOME/bin:$PATH


          This allows new path to come in front of old path, also for eclipse specific errors, take a look at eclipse cache in home directory(.eclipse folder in your project). You may safely delete this directory along ith .project files if any and recompile.



          Hope this helps!!
          Edit: Offset=6 means your current version for java(JDK) is 1.6. Try switching it to later versions. Also check that you are using Jdk path and not jre path






          share|improve this answer





















          • after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
            – Ujjwal Singh
            Jul 20 at 6:12











          • java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
            – Pavan Kate
            Jul 20 at 6:16










          • my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
            – Ujjwal Singh
            Jul 20 at 6:25










          • change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
            – Pavan Kate
            Jul 20 at 6:30







          • 1




            Reinstalled jdk and now it is working . Thanks @PavanKate
            – Ujjwal Singh
            Jul 20 at 7:12













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          This




          java.lang.UnsupportedClassVersionError




          means, that some of the libraries in your project are using diferrent version of java , and set accordingly in path.
          Quick things to resolve this:



          $>which java


          output->location of current java (eg. /usr/bin/java)



          java --version


          output->1.7.0 or 1.8.0
          if this is the case , try switching version, for this do the following:



          export JAVA_HOME=<path to diff java version sdk>
          export PATH=$JAVA_HOME/bin:$PATH


          This allows new path to come in front of old path, also for eclipse specific errors, take a look at eclipse cache in home directory(.eclipse folder in your project). You may safely delete this directory along ith .project files if any and recompile.



          Hope this helps!!
          Edit: Offset=6 means your current version for java(JDK) is 1.6. Try switching it to later versions. Also check that you are using Jdk path and not jre path






          share|improve this answer













          This




          java.lang.UnsupportedClassVersionError




          means, that some of the libraries in your project are using diferrent version of java , and set accordingly in path.
          Quick things to resolve this:



          $>which java


          output->location of current java (eg. /usr/bin/java)



          java --version


          output->1.7.0 or 1.8.0
          if this is the case , try switching version, for this do the following:



          export JAVA_HOME=<path to diff java version sdk>
          export PATH=$JAVA_HOME/bin:$PATH


          This allows new path to come in front of old path, also for eclipse specific errors, take a look at eclipse cache in home directory(.eclipse folder in your project). You may safely delete this directory along ith .project files if any and recompile.



          Hope this helps!!
          Edit: Offset=6 means your current version for java(JDK) is 1.6. Try switching it to later versions. Also check that you are using Jdk path and not jre path







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jul 20 at 6:02









          Pavan Kate

          263




          263











          • after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
            – Ujjwal Singh
            Jul 20 at 6:12











          • java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
            – Pavan Kate
            Jul 20 at 6:16










          • my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
            – Ujjwal Singh
            Jul 20 at 6:25










          • change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
            – Pavan Kate
            Jul 20 at 6:30







          • 1




            Reinstalled jdk and now it is working . Thanks @PavanKate
            – Ujjwal Singh
            Jul 20 at 7:12

















          • after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
            – Ujjwal Singh
            Jul 20 at 6:12











          • java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
            – Pavan Kate
            Jul 20 at 6:16










          • my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
            – Ujjwal Singh
            Jul 20 at 6:25










          • change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
            – Pavan Kate
            Jul 20 at 6:30







          • 1




            Reinstalled jdk and now it is working . Thanks @PavanKate
            – Ujjwal Singh
            Jul 20 at 7:12
















          after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
          – Ujjwal Singh
          Jul 20 at 6:12





          after the command java --version terminal gives the following output JVMJ9VM007E Command-line option unrecognised: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
          – Ujjwal Singh
          Jul 20 at 6:12













          java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
          – Pavan Kate
          Jul 20 at 6:16




          java -v, would also do it, there should be no spaces. If it is then your current java path is something like (/usr/java/jre1.x.y/) instead it should be (usr/java/jdk/1.x.y)
          – Pavan Kate
          Jul 20 at 6:16












          my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
          – Ujjwal Singh
          Jul 20 at 6:25




          my java path is /usr/java/jre1.8.0_171 and after changing that the error is still active
          – Ujjwal Singh
          Jul 20 at 6:25












          change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
          – Pavan Kate
          Jul 20 at 6:30





          change it to /usr/java/jdk1.8.0_171 . If you dont have a jdk installed get it from oracle site by accepting icense agreement, its free. oracle.com/technetwork/java/javase/downloads/… see java jdk 1.8 u171, and download jdk
          – Pavan Kate
          Jul 20 at 6:30





          1




          1




          Reinstalled jdk and now it is working . Thanks @PavanKate
          – Ujjwal Singh
          Jul 20 at 7:12





          Reinstalled jdk and now it is working . Thanks @PavanKate
          – Ujjwal Singh
          Jul 20 at 7:12













           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f457340%2fa-jni-error-has-occured%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)