Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Class not found issue

Class not found issue

Scheduled Pinned Locked Moved Java
helpcsharpc++javalinux
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    False Chicken
    wrote on last edited by
    #1

    I am just started playing with java an I am having this issue. I did the simple hello world app like this: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } And when I run it in eclipse the console shows Hello World!, But if I run it in the terminal as "java Hello?WorldApp.class" It will not run it just gives me the error "Class not found". Why is this? Thanks. Running Ubuntu 10.04. Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/class Caused by: java.lang.ClassNotFoundException: HelloWorldApp.class at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: HelloWorldApp.class. Program will exit."

    Y*Live Long And Prosper*Y

    C 1 Reply Last reply
    0
    • F False Chicken

      I am just started playing with java an I am having this issue. I did the simple hello world app like this: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } And when I run it in eclipse the console shows Hello World!, But if I run it in the terminal as "java Hello?WorldApp.class" It will not run it just gives me the error "Class not found". Why is this? Thanks. Running Ubuntu 10.04. Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/class Caused by: java.lang.ClassNotFoundException: HelloWorldApp.class at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: HelloWorldApp.class. Program will exit."

      Y*Live Long And Prosper*Y

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Why did you add ".class" after the class name ? You should execute it like this: java HelloWorldApp

      Cédric Moonen Software developer
      Charting control [v3.0] OpenGL game tutorial in C++

      F 1 Reply Last reply
      0
      • C Cedric Moonen

        Why did you add ".class" after the class name ? You should execute it like this: java HelloWorldApp

        Cédric Moonen Software developer
        Charting control [v3.0] OpenGL game tutorial in C++

        F Offline
        F Offline
        False Chicken
        wrote on last edited by
        #3

        Ohhhh... I didn't know that. Thanks!

        Y*Live Long And Prosper*Y

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups