Can't run java programs

I'm having trouble getting java programs to run on my computer. I have no problem compiling programs but whenever i try to run them through the command prompt window i get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: hello
where 'hello' is the name of the 'hello world' test program i made (just prints the words 'hello world' world on screen.)
The programs run on eclipse but i really prefer using the good old command prompt window. Can anyone explain to me what's wrong here (I'm guessing it's some sort of windows/java sdk setting that must be off.) Thanks in advance!!!

I thought that this was resolved a couple days ago but apparently it wasn't (it was the temporary fix that was working.)
I still get the same noclasseffounderror whenever i try to run the java program. The link tells me to add the correct 'path' to the system folder to make it work. It's actually already there (otherwise the javac command wouldn't work either.) However, the java programs do run whenever i execute the command
set classpath=
However, i have to do this every single time i open up a new shell window. Anybody know what the problem could be given that it works when i 'clobber it into working' as the tutorial put it?

Similar Messages

  • Can't run java program with GUI

    My computer can run java program properly.
    However, for those program with GUI (using swing),
    my computer is unable to display the GUI.
    What's wrong with it? Is there any PATH I need to set before running GUI program?
    Thanks
    icedgold

    Cut, copy, paste then compile and run this;-import java.awt.*;
    import javax.swing.*;
    public class MyJFrame extends JFrame {
      public MyJFrame() {
          super("My first JFrame");
          Container c  = getContentPane();
          JPanel panel = new JPanel();
          panel.setBackground(Color.white);//  (new Color(255, 255, 255));
          JLabel jl = new JLabel("Yes it works");
          panel.add(jl);     
          c.add(panel);
      public static void main(String[] args) {
        MyJFrame frame = new MyJFrame();
        frame.setSize(180,120);
        frame.setLocation(200, 300);
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.setVisible(true);
    }

  • Can't Run Java Programs -- java.lang.NoClassDefFoundError Error

    I am running 10.4.11. For some reason I can no longer run Java programs. (I could in the past)
    For example. I create a simple Hello World program as follows and save it as Hello.java:
    class HelloWorld
    public static void main (String args[])
    System.out.println("Hello, world!");
    Then I compile it:
    Javac Hello.java
    Then I try to run it:
    java Hello
    But I get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: Hello
    I think it must be a CLASSPATH problem but normally you do not need to worry about ClassPATH. Apple sets it up for you out of the box.
    What is wrong?

    I totally forgot that the class name should be the same as the filename.
    After I renamed the file to HelloWorld.java and recompiled, I could run "java HelloWorld"
    Rob

  • Can i run java program in the same way of .exe program?

    I am beginner in java and i'd like to know that java program can run in the same of .exe program(double click program icon) , instead of typing "java [class name]" or
    choose execute botton from forteCE.
    Thank you for your help
    [email protected]

    You can write a .bat script which launches the java command for you:
    @echo off
    java <your prog name here>
    Then move your .bat file icon wherever you want...
    bye
    Michele
    Tip: if you don't want to see the black VM window, try javaw instead of java.

  • Can't run Java Programs from home computer

    Hi, sorry if this is a simple problem.
    I downloaded Java version 1.4.0_03 but can't get it to work. I have configured the PATH variable and the CLASSPATH but it isn't working.
    If I type java -version the right stuff comes up.... so where have I gone wrong?
    Any ideas much appreciated
    Thanks
    cat

    I downloaded JDK
    this is whats in the PATH variable:
    ;C:\Program Files\Java\j2re1.4.0_03\bin
    and in the CLASSPATH:
    .;C:\Program Files\PhotoDeluxe HE 3.0\AdobeConnectables;C:\Program Files\Java\j2re1.4.0_03\lib\tools.jar

  • Can a running java program reset itself internally so it ...

    so it behaves just as if it was run for the first time!
    Thank you

    Something like this?Runtime.getRuntime().exec("java thisClass");
    System.exit(0);

  • Can we able to run java program inside  javascript

    Hi all
    can we able to run java program inside javascript or integrate java with javascript.....whether its possible...

    No. You can't execute Java code from within a JS script in Acrobat/Reader.

  • Running java program at windows startup

    I need to run java program at startup and then it will continue to run in its own thread.
    Any body having idea how to do that programmatically?
    Zeeshan

    This is one option but this is not feasible in my scenario as this application will be running over a network which involves hundreds of computer so is there any way to do it programatically?
    I mean if I can load java class file through an exe file then I can load my class file in the startup using C++.
    Any Suggestions.
    thanks for the help
    regards,
    Zeeshan

  • Run java program in background

    I want to run a java program in background in windowsXP...can anyone help please......can anyone suggest an easy software for running java program as windows service...i tried one but without any success

    How many of the links here have you tried while you were waiting for an answer?
    http://www.google.com/search?q=running+java+program+as+windows+service
    (Note that the query is a direct copy/paste from your post.)

  • How to run java program from website?

    Hello
    I'd like to know how to run java program from my web page.
    I'd like to push some button in this web page so java program that would be on my server
    would pop-up. Can it be done automaticaly upon running this web site? (without any buttons - I just enter website and program pops up).
    Cheers

    I rather thought about RMI. But I could try servlets. So how it would look like?.
    I would make http request in browser (enter address) and program would show up in its window?. And I would not have to change anything in my program?. This program would run then on both boxes?. One remotely and one not?.
    But I would have to learn some basics, I've never worked with servlets. Could you suggest some good sites about it?. With ready examples so I could tweak them to my purpose.
    Message was edited by:
    macmacmac

  • Compile and run java programs in different directroy

    Hi,
    I often encounter many problems when I run java programs in the different directories. Like
    javac -d dir_name a.java
    java -cp dir_name a
    Something wired often happens, such as, there is not a.java file in some directory, but javac -d dir_name a.java can still work or "java -cp dir_name a" often doesn't work. Moreover, file_name.jar is also a tough problem and solving compiling problems is often time-consuming.
    So I hope to read something about how to compile and run java programs in different directory properly.
    Could you pleae give me a detailed description for that or recommend a book or website?
    Thanks a lot.

    Can you post a small amount of code that does not work, including the directory structure, and the error messages? Some one here can likely explain the problem.

  • I want to run java program on windows environment as background process

    Hi all
    I want to run java program on windows environment as background processSo command prompt return after executing java command and program on background In Linux we can do this easily �but I do not how to do this in windows
    for example look this programe
    import java.io.*;
    import java.util.*;
    public class TestClass {
         class ravi extends Thread{
              public void run(){
                   try {    
                        String target_file = "ravind.txt";
                        File targetfile = new File(target_file);
                        PrintWriter writer = new PrintWriter(new FileWriter(targetfile)) ;
                   for (int i =0 ; i < 100 ;i++ ){
                        Thread.sleep(10000);
                        writer.println(" ravindra shukla ");
              } catch (Exception e) {               
                             e.printStackTrace();
         public static void main(String[] args) {
              TestClass test1 = new TestClass();
              TestClass.ravi r1 = test1.new ravi();
              r1.start();          
    System.out.println(" return from main ");
    first i compile this
    javac TestClass.java
    then i run this by using this command
    java TestClass
    but becouse i put sleep on threads run function so it takes to much time to get return on command promt .... i want to run this programe as background process so command promt return as soon as i execute java command

    Thanks dude
    This solution �start java TestClass� works fine �. But it does not solve my problem
    It opens another black window and that black window persist till the life time of my program
    Is it possible application run on complete background without opening another black window �as in Linux

  • Can i call java program from VC++ code...... Urgent!

    hi,
    I have VC++ code.
    I want to run java program from VC++ (SDK).
    Can I call it?
    plz help it's urgent....
    thanks in advance...

    We do it all the time using the JNI invocation API (this is actually how the java.exe application works).
    Here's a tutorial I just found (not sure how good it is, but it should get you going):
    http://www.inonit.com/cygwin/jni/invocationApi/
    One note: If you are going to be invoking the JVM from different threads in your native app, there is some special handling you will have to do - the above tutorial doesn't address this scenario (a dig through the JNI docs should help with that one, though).
    Cheers,
    - K

  • How to run java program on clients system when system strats

    hi
    I want to run java program on clients computer automatically when system boots up. plzzzzz help me .......

    You can add the call to the java program to the auto start group (under windows).
    You can't start a client program when the server starts, if that is what you mean.
    Timo

  • Reg:Unix shellscripts running java programs

    hi,
    We are using unix shell scripts , by running that script it will execute some java programs.
    when we running shell scripts, which executes the programs it is generating some log files ie some error is occuring.
    i want to why these files are generating
    Thanks and Regards,
    Meer S.

    HI ,
    we are running the shell script which runs java programs,
    we are getting the result no problem ,
    but it is generating the unwanted ORBTRC files
    we are using websphere application server.
    we donot want these orbtrc files.
    HOW CAN WE DISABLE THE FILES
    pls guide this.
    Thanks and regards,

Maybe you are looking for

  • Crystal Report 9.0 and Websphere

    hi can any body give me some steps regarding integration of crystal report and websphere i have already search this forum and i got lot many topics regarding this but all were using cyrstal report version 8 and 8.5 which requires mandatory using IIS

  • Help in SQL Developer

    Is there any context-sensitive help in SQL Developer. I'm looking for a way to link SQL syntax with some sort of a Help function. Searching the SQL Reference pdf just doesn't cut it. For example, when I search the SQL Reference pdf for Round, I get 1

  • Performance Appraisal Document final rating

    All Expert: The appraisal Form will has a final  appraisal rate. how to exacter the final rating in the Appraisal Form, which FM can be use? and how to distinguish the zero and blank final rating? I want to distinguish them. Can any one can help me?

  • Question related to SAP Tables

    Hi all,    I am trying to get the list of all tables in my SAP instance by viewing the contents of the table DD02L (List of tables) . I see that the no of entries is more than 3 lakhs when i click on "Number of Entries" button. Since this does not sh

  • Is there a driver for cannon selphy

    Is there software available for a connon cp900 printer?