Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

A JNI error has occurred, please check your installation and try again

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a simple Java code.It is compiling without any error but when i am running in using java command it is throwing an Exceptin.The Code is:

public class Simple
{
public static void main(String[] args)
{
System.out.println("Hi i am a Simple class");
}
}

I am running code like this

C:\javaxcomm>java Simple
Exception in thread "main" java.lang.NoClassDefFoundError: Simple
Caused by: java.lang.ClassNotFoundException: Simple
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Error: Could not find the main class.
Error: A JNI error has occurred, please check your installation and try again



Still Simple.class is generating at my c:
what will be the reason???Please help
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How To Create Your First Java Program This should help you

Whats the name of the .java file? You need to first compile to create a .class file and then run this class file.
 
Aasif Iqbal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

mohamed sanaullah wrote:How To Create Your First Java Program This should help you

Whats the name of the .java file? You need to first compile to create a .class file and then run this class file.




I have already compiled it with javac command.It is generating .class files also,My Class name is Simple.,But still it is not finding class file.
 
Ranch Hand
Posts: 121
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aasif Iqbal wrote:

mohamed sanaullah wrote:How To Create Your First Java Program This should help you

Whats the name of the .java file? You need to first compile to create a .class file and then run this class file.




I have already compiled it with javac command.It is generating .class files also,My Class name is Simple.,But still it is not finding class file.




Aasif your program is very correct. I think there must be problem with JVM. Please reinstall it and see.
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aasif Iqbal wrote:

mohamed sanaullah wrote:How To Create Your First Java Program This should help you

Whats the name of the .java file? You need to first compile to create a .class file and then run this class file.




I have already compiled it with javac command.It is generating .class files also,My Class name is Simple.,But still it is not finding class file.



have you set the CLASSPATH variable? If you have set it- Then can you tell us its value?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://www.youtube.com/watch?v=ghQay370oXk
please check this link
 
Marshal
Posts: 78424
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Did you post that YouTube video yourself? It has very poor sound quality, I am afraid.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic