Results 1 to 7 of 7

Thread: Java main class not found

  1. #1
    Join Date
    Mar 2010
    Posts
    303

    Java main class not found

    Hello,
    I'm still relatively new in Java and have now entered a small problem. I have my first programs on the command line and run, which has so far everything works. Now I use NetBeans with a little Hello World program I wrote:
    Code:
    package helloworld;
     
    public class Main (
        / **
         * @ param args the command line arguments
         * /
        public static void main(String[] args) (
            System.out.println("Hello World!");
        )
     
    )
    But the code is not compiling , even I have tried it manually to run it but no success. Any more help regarding this topic is appreciated. Thank you.

  2. #2
    Join Date
    Dec 2009
    Posts
    192

    Re: Java main class not found

    You will need to do this
    Code:
    javac helloworld / Main.java compile
    and
    Code:
    helloworld.Main java call.
    The folder structure must be correct here (Folder = Java package). If you do not know the basics that is the core java then I would recommend you to that first.

  3. #3
    Join Date
    Sep 2009
    Posts
    177

    Re: Java main class not found

    I have the file now with NetBeans trial times as.jar packed. Now when I run (with the javaw.exe on Windows), spits me the "Could not find the main class: PATH \ dist \ hello world.jar. Program will exit "from. PATH \ dist java hello world.jar is the error message from my first post accordingly. PATH \ dist java -jar hello world.jar works, in the MANIFEST.MF
    Code:
    Main-Class: helloworld.Main
    I guess the solution is equally simple? Any help is appreciated.

  4. #4
    Join Date
    Nov 2009
    Posts
    359

    Re: Java main class not found

    For this
    I have the file now with NetBeans trial times as.jar packed. Now when I run (with the javaw.exe on Windows), spits me the "Could not find the main class: PATH \ dist \ hello world.jar. Program will exit "from. PATH \ dist java hello world.jar is the error message from my first post accordingly. PATH \ dist java -jar hello world.jar works, in the MANIFEST.MF
    you can do the following, just issue the following command in the terminal and if you are in linux be sure you have set the environment variables correctly.
    Code:
    javaw -jar hello world.jar ?
    I hope this will help you.

  5. #5
    Join Date
    Sep 2009
    Posts
    177

    Re: Java main class not found

    Code:
    javaw -jar hello world.jar
    There were no error message yet Hello World! out.
    But
    Code:
    java -jar hello world.jar
    works as said. You can.jar files but usually just double-click Start. And that does not work even. I would not go any time via the console.

  6. #6
    Join Date
    Sep 2009
    Posts
    152

    Re: Java main class not found

    javaw is for the only run of applications with GUI control. Therefore, the program displays the console output to none. If you have windows have views in Tools-> Folder Options> File Types you see. There you can find the extension jar java link.

  7. #7
    Join Date
    Mar 2010
    Posts
    330

    Re: Java main class not found

    I have already. .jarfiles are associated with the javac.exe correct (it?).
    For others.jar file that works, anyway. Not for my own. Whether with or without GUI.

Similar Threads

  1. Replies: 11
    Last Post: 22-03-2012, 10:58 PM
  2. Replies: 5
    Last Post: 27-08-2011, 10:36 PM
  3. How Gigabyte has been handling SDD class performance with the main stream ?
    By raghini in forum Motherboard Processor & RAM
    Replies: 5
    Last Post: 03-08-2011, 07:54 AM
  4. Converting java class to java bean class
    By Ucchal in forum Software Development
    Replies: 6
    Last Post: 09-08-2010, 10:24 AM
  5. Unable to call class into main method in c# code.
    By Kasper in forum Software Development
    Replies: 5
    Last Post: 27-02-2010, 07:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,052,305.54012 seconds with 17 queries