• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
https://www.youtube.com/watch?v=ghQay370oXk
please check this link
 
Marshal
Posts: 65467
249
  • Mark post as helpful
  • send pies
  • 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.
 
The knights of nee want a shrubbery. And a tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!