Could not find the main class error with executable jar

Hello,
I have troubles creating an executable jar file and I ran out of ideas how to solve it so I would appreciate some help.
I have created a jar file with the export function in eclipse
the Manifest.MF file contains:
Manifest-Version: 1.0
Main-Class: view.AppTennisViewI tried starting the file with a batch file which contains following code:
@echo off
javaw -classpath c:\TennisHSQLDB_GC2\tennisApp.jar
@start javaw -jar tennisApp.jar
exitthe batch file and the jar are both located in c:\TennisHSQLDB_GC2.
When i try command line I get the same result.
I also tried alternate statements such as SET CLASSPATH iso javaw -classpath and including the classpath in the manifest file but no luck. It keeps given me the error: could not find the main class. program will exit
Anyone any suggestions for my problem?

nevermind, found it.
classpath in manifest was incorrect

Similar Messages

  • Could not find the main class - Problem with Webservice-Access

    Hello Everybody,
    I'm having serious Problems with accessing a WebService (Tomcat-Axis) per executable jar-File.
    I constructed a simple GUI with 3 Textboxes 1 Button and 1 Resultbox.
    I use eclipse so it was no Problem to simple generate the Backgroundclient by Processing the .wsdl-File of the WS.
    Now I do this:
    Head_tServiceLocator serviceLocator = new Head_tServiceLocator();
    Head_t service = serviceLocator.getRPCCall();
    RPCCallSoapBindingStub Head_t = (RPCCallSoapBindingStub) service;and use the Webservice like an Object.
    All this works very well.
    Now the Problem:
    Head_t service = serviceLocator.getRPCCall();this Line has to throw a ServiceException.
    If i add a try-catch Block to Process the Message JAVA tells me after i exported to JAR (with Manifest-stuff and so on) and double Click on the JAR the following :
    Could not find the main Class - Program will exit.
    And if i add a throws Declaration to the Methodheader it tells me:
    Fatal Exception Occured - Program will exit
    But if i Comment out that Line at least the GUI is being displayed (so it DOES find the main-Class). But then of course the Webservice won't be accessed.
    All the JARs needed (axis.jar, commons-discovery.jar and so on) are in the same Directory as the Webservice-Client.jar
    Please Help me.
    Greets,
    Zap

    I am not done any typing mistake while creating the jar file i already followed the suggestion that you have mentioned but still the same error .
    This is my MANIFEST.MF file created under META-INF folder
    Manifest-Version: 1.0
    Class-Path: qtjambi-4.4.3_01.jar qtjambi-win32-msvc2005-4.4.3_01.jar
    Created-By: 1.5.0 (Sun Microsystems Inc.)
    Main-Class: Ui_MainWindow
    When i extracted the app.jar following this i got
    1. META-INF folder inside that MAINFEST.MF file the contents i have already placed above
    2. qtjambi-4.4.3_01.jar
    3. qtjambi-win32-msvc2005-4.4.3_01.jar
    4. Ui_MainWindow.class
    Please tell me whats wrong in that i can also give you the app.jar file please let me know the email id ..

  • "Could not find the main class" Error While installing 11g in windows 7

    Dear All,
    I am getting error message while installing oracle 11g R1(32 bit) on Windows 7(32 bit)
    I have downloaded from oracle website only..
    After Clicking the OUI I am getting the Error Message pop up is "Could not find the main class.Program will exit"
    I don't know what is the reason behind this error .
    what would be the reason for this error..
    Pls help me....
    By
    Muthu

    I think you need to download oracle software again...
    Oracle Universal Installer - Could not find main class

  • Could not find the main class Error

    Hi all,
    I think that JRun compiles something to jsp files if the jsp
    folder does not contain jsp files. Is that right? I started a
    server running in JRUN4. And later at some point (I don't know what
    I was doing), I got this Error Dialog that said "Could not find the
    main class. Program will exit." In addition, the title of that
    dialog was "Java Virtual Machine Launcher". What does this message
    mean? Please help me. Thank you.

    Okay, I created a simple hello jsp file in the test folder.
    Then I ran the command:
    D:\JRun4\bin\jspc at the current directory of C:\Documents
    and Settings\user\Desktop\test>
    The result that I got this:
    C:\Documents and
    Settings\user\Desktop\test>D:\JRun4\bin\jspc
    Compiling: /index.jsp
    java.io.FileNotFoundException: C:\Documents and
    Settings\user\Desktop\test\WEB-IN
    F\jsp\jrun__index2ejspa.class (The system cannot find the
    file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at
    jrunx.compiler.SMAPAttributeWriter.writeSMAP(SMAPAttributeWriter.java
    :49)
    at
    jrunx.compiler.JavaCompiler.processSMAP(JavaCompiler.java:184)
    at
    jrunx.compiler.JavaCompiler.compile(JavaCompiler.java:151)
    at
    jrunx.compiler.JavaCompiler.compile(JavaCompiler.java:100)
    at jrun.jsp.Translator.compilePage(Translator.java:176)
    at jrun.jsp.Translator.translate(Translator.java:254)
    at jrun.jsp.Translator.translate(Translator.java:101)
    at jrun.jsp.JSPEngine.translateJSP(JSPEngine.java:693)
    at jrun.jsp.JSPC.compile(JSPC.java:85)
    at jrun.jsp.JSPC.main(JSPC.java:223)
    C:\Documents and Settings\user\Desktop\test>
    What is wrong?

  • "Could not find the main class" when running a jar

    Hi, I'm trying to create and run a jar from my application, but I can't figure out how to properly set an entry-point. Looking at the Java Tutorials http://java.sun.com/docs/books/tutorial/deployment/jar/index.html I still can't get it to work.
    I have a directory myApp, which contains a directory images and some class files, including mainClass.class. I also have a manifest Manifest.txt in the directory myApp with the following line:
    Main-Class: mainClass.class
    + one empty line
    I create a jar successfully, while inside the myApp directory, with the following command:
    jar cfm myApp.jar Manifest.txt *.class images\*.*
    I then proceed to run the jar with the following command:
    java -jar myApp.jar
    and receive the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: myApp/class
    My completely uneducated guess is that there is something wrong with my manifest. The tutorial says that the line should be:
    Main-Class: MyPackage.MyClass
    I'm assuming that I get the error because I didn't specify a package, which I didn't do because I didn't know what to put there. Do I even have a package?
    Can anyone tell me what I've done wrong? thanks.
    Message was edited by:
    SmurfZG

    One problem is you are specifying a file name instead of a class name. It probably should beMain-Class: mainClassA good test is to run your app before jaring it - if you run it with "java mainClass" then the Main-Class attribute must be mainClass.
    Also class naming conventions say that class names should start with a capital letter - MainClass for example. It is just a convention, but it is easier to get help when you follow conventions.

  • Running JAR files (Could not find the main class error)

    Hi all,
    I'm having a bit of a problem with my app. I created an application with the current Netbeans edition, containing multiple .class files, and a few .jar libraries that are needed too.
    Now I'm having problems with running the .jar that the Netbeans creates, so I figured I'd make a one on my own.
    Okay, this is what I have going on:
    C:\MyApp\ <--- root for the application
    C:\MyApp\src\ <--- this is where the .class files are
    C:\MyApp\lib\ <--- here are the .jar libraries which are needed
    C:\MyApp\jar.exe
    C:\MyApp\Manifest.txt
    Now I have a couple questions.
    1. Is it ok that the .class files all have a "package MyPackage; " thing in the beginning?
    2. How should I proceed on making the Manifest.txt file correctly? I have tried various different outputs and read a few topics here from how it should be done, but I just can't nail it. Currently my Manifest looks like:
    Main-Class: MyPackage/Myapp
    Class-Path: lib/xxx.jar lib/xxx2.jar lib/xxx3.jar
    Any help would be appreciated! Thanks.

    Oh, almost forgot:
    3. The right way to create a jar? I used this:
    C:\MyApp\jar cmf Manifest.txt MyJar.jar src\*.class
    And system is Windows XP.

  • Help needed with application: "could not find the main class"

    I am pretty new to java and am trying to figure out applications a bit now. The one im working on does run within my editor, but when i "test" it or try to run it from within a .jar file it returns a "could not find the main class" error.
    I have a code similar to this:
    public class user{
    public static void main(String[] args){
    new user();
    public user{
    Does this have to do with it? I've been trying to get this right for a couple of days now, I just wanna be able to run it (on either my pc or another) without starting the Editor.
    Looking forward to receiving an answer..

    It sounds like you are missing the Main-Class attribute in your manifest file. Create a file 'manifest.mf' with the following line 'Main-Class: user'
    Then include that manifest in your jar:
    'jar -cfm user.jar manifest.mf user.class'
    Then run the jar: 'java -jar user.jar'
    http://java.sun.com/docs/books/tutorial/jar/basics/mod.html

  • Can not start WebLogic in Eclipse. Error: "Could not find the main class."

    I have installed Eclipse 2.0 and WebLogic Server 6.1. and the WebLogc plug in from GENUITEC (and jdk1.3.1_04, on Win2K Server). After I have done the configuration, the WebLogic start/stop buttons are integried into the Eclipse Toolbar, but when I click on the start button to start Weblogic, it pops up a dialog box "Java Virtual Machine Launcher" with message: "Could not find the main class. Program will exit!"
    Starting WebLogc Server from the Start panel works fine.
    Does any one have seen this before or have a suggestion what I should do?
    Many many thanks in advance.
    Huan

    Weblogic must be started with a full JDK; otherwise
    JSPs and dynamic EJB stubs could not be deployed. The
    error message
    indicates you are attempting to use a JRE. Configure
    Eclipse JRE to point to a JDK. The product
    documentation will help you with this process. It does not work for me. :-(
    I have tried JDK 1.3.1 and 1.4.1: same result: I get a "Could not find the main class: Program will exit"
    For free expert support please consider contacting
    Genuitec at [email protected] If just want any
    answer ask a newsgroup.
    WayneI'll try the support at '[email protected]' :)
    Michel
    Michel Szybist
    [email protected]
    Fax: +33 (0)173729897
    SMS: http://www.szybist.net/

  • Could not find the main class (with every jar)

    This isn't a developer question. I get the error Could not find the main class with every jar I try to open (for example the jar downloaded from https://gjar.dev.java.net/ gives the same problems - and I don't think there is something wrong with that JAR). It isn't a problem with the jar or MANIFEST because the same jar works fine on my laptop. So there is something wrong with my JRE installation, but what?
    I tried to remove and reinstall the JRE 6 Update 18 but that didn't work. When I run the JAR with command line java -jar "file.jar" it works fine, but if I dubbelclick on it I get the error message (and it's irritating me).
    I'm a bit desperate so I hope that someone here can help me ;)
    Thanks in advanced

    hai T.B.M ... Sorry to post here... I know that i posted my question in wrong thread..but i dont have another solution to contact with you.. I had seen your answers which are really excellent and helped to do my project..
    Now i am having very less time to complete my project and i am very new to JMF.. I am not getting output in JMF video capture ..please check the code and guide me where i gone wrong.......please pardon me once again to post here.. Heres my code
    import javax.media.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.media.protocol.*;
    import java.io.*;
    import javax.media.control.StreamWriterControl;
    public class webcam implements ActionListener,ControllerListener
    boolean eomReached = false;
    boolean realized = false;
    JFrame f;
    BorderLayout bd1;
    CaptureDeviceInfo device;
    MediaLocator m1;
    Player player;
    Component videoScreen;
    JButton b1,b2;
    Processor processor;
    DataSource ds=null;
    DataSink fileWriter=null;
    JLabel status=new JLabel("");
    public webcam()
    try
    JFrame f=new JFrame();
    JPanel p =new JPanel();
    JPanel p1=new JPanel();
    device=CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
    m1=device.getLocator();
    System.out.println("1");
    processor.configure();
    processor = Manager.createProcessor(m1);
    processor.setContentDescriptor(new
    FileTypeDescriptor(FileTypeDescriptor.MSVIDEO));
    ds=processor.getDataOutput();
    player.addControllerListener(this);
    MediaLocator dest = new MediaLocator("file://foo.avi");
    fileWriter = Manager.createDataSink(ds, dest);
    fileWriter.open();
    ds.connect();
    ds.start();
    player=Manager.createPlayer(m1);
    player.addControllerListener(this);
    blockingRealize();
    videoScreen=player.getVisualComponent();
    b1=new JButton("START");
    b2=new JButton("STOP");
    bd1=new BorderLayout();
    p.setLayout(bd1);
    p1.add(b1);
    p1.add(b2);
    p.add("South",p1);
    p.add("East",videoScreen);
    f.getContentPane().add(p);
    f.setVisible(true);
    f.setSize(500,500);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    b1.addActionListener(this);
    b2.addActionListener(this);
    catch(Exception e){}
    public void actionPerformed(ActionEvent e)
    if(e.getSource()==b1)
    try{
    processor.start();
    player.start();
    fileWriter.start();
    catch(Exception e1){}
    if(e.getSource()==b2)
    try{
    player.stop();
    processor.stop();
    processor.close();
    fileWriter.close();
    catch(Exception e2){}
    public static void main(String args[])
    webcam obj=new webcam();
    public synchronized void blockingRealize() {
    player.realize();
    while (!realized) {
    try {
    wait();
    } catch (java.lang.InterruptedException e) {
    status.setText("Interrupted while waiting on realize...exiting.");
    System.exit(1);
    public synchronized void controllerUpdate (ControllerEvent event) {
    System.out.println("myPlayer generated "+event.toString());
    if (event instanceof RealizeCompleteEvent) {
    realized = true;
    notify();
    } else if (event instanceof EndOfMediaEvent) {
    eomReached = true;
    }

  • Help Me Urgent...Error: "Could not find the main class. Program will exit."

    Am using Eclipse 3.3.2
    I have a project called: SWDS
    Initially i have JDK1.6 installed in my system. At this time the project is running succesfully.
    But when i removed(uninstalled and environment path also removed) JDK 1.6 and installed JDK 1.5 and path also given.
    No changes are made in the project code.
    When I Run the project SWDS then showing an alert "*Could not find the main class. Program will exit*" and then getting error messages like:
    {color:#ff0000}java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    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)
    Exception in thread "main"{color}
    Pleez help me how to rectify this error.

    The manifest file is missing from the project.
    I searched the net and read about the manifest file and I saw that it is supposed to be located in META-INF/MANIFEST.MF. I suppose that means project_root/META-INF/MANIFEST.MF, right ?
    I am asking this because I haven't got that much experience in Java and this is the first time I hear about a manifest file.
    Does anyone have any Ideea how I add a manifest file to a project with Eclipse SDK? I searched the menus and I didn't find anithing of such sort... o
    Does Eclipse have support for editing manifest files at all?

  • Could not find the main class. & java.lang.NoClassDefFound error:

    sir / madam
    I am facing problems with j2ksdk1.4.0 beta instalation on my windows 2000 advance server.
    while installing pops up a message saying could not find the main class.
    while using java or javac it says
    Exception in thread main
    java.lang.NoClassDefFound error:
    com/sun/tools/javac/main
    even when double clicking java plugin from the control panel
    I get the Java virtual machine launcher saying could not find the main class.
    I don't have any other java sdk installed.
    And i have my environment variables (classpath, path and java_home) set correctly.
    this same j2sdk1.4.0 version is installed in the windows 98 system and it's working fine.
    Kindly do help me to solve this problem.
    eagerly awaiting for your response.
    Thanking you
    Sajeev Nair
    [email protected]

    you must check with the classpath
    please see that you have not repeated %classpath%
    at the end of the class path like you do in win98.
    similiarly with %path%
    in win2000 it is automatically taken care off.

  • Could not find the main class JRE 1.6 only with console program into Contro

    Hi,
    I want replace JRE1.5-11 with JRE 1.6.
    Applet is running correctly with JRE 1.6.
    But when i want launching Java program located into "Parameters/Control Panel"
    I have following error message "Could not find the main class JRE 1.6 "
    Regards
    Philippe

    i wouldn't report a nullpointer to sun unless you're fairly confident there's some sort of bug. if main() can't be found it sounds to me like a config issue. if nullpointer, sounds like a code issue. post the code if you want, but i don't think sun will help you debug this.

  • Error: "Could not find the main class: Files\NetBeans"

    I am working on a WorldWind mapping application but I think this issue is more of a straight Java question. I was attempting to add a web service reference by means of the NetBeans IDE. The reference compiled as it should have but then the application would not run. I deleted the reference, commented out all the code that used the web reference, basically restored all the code to how it was before trying to add the web service. The applicaiton still will not run with the message that it can't find the main class. I do, however, get a clean build. What should I do to fix this?
    Here is the error: "Could not find the main class: Files\NetBeans"
    thanks!

    nigel25840 wrote:
    I am working on a WorldWind mapping application but I think this issue is more of a straight Java question. I was attempting to add a web service reference by means of the NetBeans IDE. The reference compiled as it should have but then the application would not run. I deleted the reference, commented out all the code that used the web reference, basically restored all the code to how it was before trying to add the web service. The applicaiton still will not run with the message that it can't find the main class. I do, however, get a clean build. What should I do to fix this?
    Here is the error: "Could not find the main class: Files\NetBeans"
    thanks!Sounds like something (a .cmd file or .bat file, perhaps) is set up to launch NetBeans with a command line like this:
    java -classpath ... c:\Program Files\NetBeans ...
    So since the path has embedded space(s) in it, it thinks you are wanting to run a class named "Files\NetBeans", which does not exist.
    You need someone there who knows what they are doing to look into it for you.

  • Error msg Could not find the main class.Program will exit. in jar execution

    Hello,
    I have created a jar so that I can used it in the webapp.
    but when I click on it it says "Could not find the main class.Program will exit."
    I searched a lot in the net and found that it has to do with the manifest file.
    I even updated the manifest file using the command "jar umf main.txt filefolderupload.jar" with the class name mention along with the package heirarchy.
    (pakage heirarchy in /,\ and .)
    I am using JDK 1.5 . and have Updated JRE 1.6.
    Also tried with extending the class with JApplet, but in vain.
    Kindly help me in the above mention issue.
    tia,
    Sarwa

    This post hints at a number of misunderstandings on your part, and raises a couple of important questions.
    Note that this 'simple question' has a complicated answer. Given the complexity of it, it might pay to add Dukes to it, ..a lot of Dukes.
    The important questions are.
    1) Does this file/directory uploader need to provide the end-user with a file dialog in which they can choose a local directory to upload, or will a multi-file chooser do?
    2) Does this uploader need to upload to foreign sites, or does it upload back to its own server?
    Looking at this table I prepared to describe the [uploader/local file access|http://pscode.org/test/uploader/fileuploader.html] possibilities, if the answers to the questions are 'multi-file chooser will do' and 'home site only', the best option is a sandboxed app. launched using webstart (JNLP) - option 5. If either of those questions go the other way, option 6 (digitally signed with extended permissions) is needed.

  • Error:-could not find the main class programe will exit(Java virtual mach)

    Hi,
    i changed the mainfest file for an executive jar file(judge.jar) using the command on dos :-"jar cvfm judge.jar c:\judge\MAINFEST.MF -C judge/ ." , but when i run this jar file again after making changes in mainfest file it is not working. an error encounter like "could not find the main class programe will exit how to solve"(Java virtual machine launcher).please suggest me how to solve this error.
    Thanks
    Ashwani Gupta

    Hi,
    mainfest file has a entry like "main -class: judge.repository.corpus"
    please tell me the solution of this error i am doing internship in national university of singapore......and my project is related to data mining.I am using judge.jar when i extract this jar files i saw there was no main-class in manifest file so i change it and make it again jar file using dos command.please suggest me how i can reomove this error.
    Thanks in advance.
    Ashwani

Maybe you are looking for