This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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: 74695
335
  • 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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic