Error executing .jar outside Netbeans

Hi
I am importing classes that are from other .jar files. This runs perfectly in Netbeans.
When i compile this and try to run it outside Netbeans it stops when it comes to the imported classes. I have added the .jar files in the �Project Properties� under �Compiling Sources�.
Thanks

But shuld Netbeans not beable to to this automaticly?
I says so in "help".Do what automatically? It sounds to me like NetBeans is running your app just fine. How you run it outside NetBeans is your responsibility, which is what you're having a problem with, no? Do you mean that NetBeans creates the JAR file specifically to run outside NetBeans? If that's the case, read my previous post to check that the JAR file was made correctly. It is possible that NetBeans isn't doing what you think.
And CeciNEstPasUnProgrammeur is also correct - if this is a NetBeans problem please go to a NetBeans forum where you can receive better help.

Similar Messages

  • Error executing jar file from console (conection to JDBC)

    I've a problem executing a .jar file when it invokes the Sql Server Driver.
    I've no problem inside the IDE (Eclipse) but when I deploy it to a jar file
    and execute it from the console I got this:
    (Not to say that I've modified the classpath with the jar libraries of the
    driver from Microsoft)
    java.lang.ClassNotFoundException:
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    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)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at csAccesoBD.ActualizarBD(csAccesoBD.java:36)
    at Principal$1.actionPerformed(Principal.java:39)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
    Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
    Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
    Sour
    ce)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    If someone has the key, please tell me.
    Thanks

    Add the jar file that contains the missing class to your CLASSPATH (note upper case variable name.) The ClassNotFoundException tells you the name of the missing class; try to guess where the class is located - if it is a JDBC driver, it is in the JDBC driver's jar.

  • Netbeans 5.0 Executable Jar Problem--One Solution

    Hi all.
    This issue seems to constantly come up with all the Netbeans IDEs. I managed to solve the problem I was having so I felt obligated to post my solution since it can be mind-numbingly frustrating to deal with.
    This may not work for you, but it worked for me in my situation so you may want to give it a shot.
    This is what I did to solve the problem:
    a) make sure a file called manifest.mf is in the root of your project folder. The manifest file should contain the following text (do not include the lines with ----------- on them of course):
    Manifest-Version: 1.0
    X-COMMENT: Main-Class will be added automatically by build
    To be safe:
    Note the trailing carriage return after the X-COMMENT line--LEAVE THIS IN.
    Note the case of the file name manifest.mf--MAKE SURE YOU DO NOT ADD CAPITAL LETTERS.
    b) In the nbprojects folder of your main project folder, open the file project.properties and add the line:
    manifest.file=manifest.mf
    Clean and build your project. If you check the manifest in the main jar file, you'll see (hopefully) it has the Main-Class attribute set, as well as the class path to any other jar files you've put in your project classpath.
    BTW1:
    Make sure you don't have any files open in the directories that will need to be deleted by the 'clean' step or you'll get an error.
    BTW2:
    Also, make sure you've set your main class in your project by right-clicking the project node, click Properties, select Run from the tree on the left side, and fill in the 'Main-Class' text field.
    This worked for me. I hope it helps others with the overly-confusing executable jar issues the Netbeans series of IDEs always seem to have. I think the complexity lies in its use of Ant in the build process. While Ant adds a ton of flexibility--it also a ton of complexity.
    For example, this jar issue has been very annoying, but I wouldn't have been able to add a hook into my build process that signs my jar files (for use with Java Web Start) without the Ant system.
    Netbeans 5.0 is still currently my favourite Java IDE though.
    Cheers!
    Michael N. Christoff

    Genius! thank.

  • Class not found error while executing jar file

    I have written a java code in which i am connecting to database....when i run the class file using......java class_filename it works........
    but when i run the jar file using .......java -jar jar_name ...yi gives me the error as 'Class not found'......
    can anybody help me please......
    Thanks and Regards,
    Siddhesh

    that class is part of jar file.....in classpath i have included zip files for jdbc ...to get databse connection.....and the jar being executed ................still it gives the error ClassDefnotfound which i think is due to database connection problem.....the exception is raised while.....
    Class.ForName("Driver_name").newInstance();/ This driver is present in zip files that i have added in classpath....
    above statement doesn,t giv error while i execute the class file............but exception while executing jar file only..
    Thnaks and regards,
    siddhesh

  • 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

  • Error trying to run an executable Jar file

    Hi,
    I know a million people have asked this before. In the past 5 hours I have waded thru a dozen questions-answers-FAQs that were no help. So if anyone is willing to help a stupid person her is my problem:
    I developed a java program using the eclipse ide and it runs fine from within that ide.
    I packaged it into a Jar file, created a manifest file per the instructions.
    But when I double click on the jar file I get the following error from the Java Virtual Machine Loader;
    "Could not find main class. Program will exit."
    My Manifest file has the following text:
    Manifest-Version: 1.0
    Class-Path: swt.jar
    Main-Class: .graphicalUserInterface.AppStandAlone
    <blank line>
    the class AppStandAlone has the method "public static void main(String[] args) "
    it is in a package called "graphicalUserInterface".
    Any help anyone can give me would be greatly appreciated.

    Another 3 hours spent trying to run this java application in a Jar file.
    I identified that I did not have all class paths specified. So I tried to enter them in the "Class-Path:" line of the manifest file. But, according to the java tutorial, the syntax in a manifest file for classpaths is a space SEPARATING each path name. I have a space IN the path name and java is not understanding the paths correctly. For instance, I have a classpath c:\Progran Files\Java\etc... and java interprets this to be a classpath c:\Progran with Files\Java\etc as the program I want to run.
    I tried enclosing the paths in double quotes. Didn't work
    I tried enclosing the paths in single quotes. Didn't work
    I tried using a semicolon as a separator with double quotes. Didn't work
    I tried using a semicolon as a separator with single quotes. Didn't work
    I tried using a semicolon as a separator with no quotes. Didn't work
    I removed the "Class-Path:" line from the manifest and tried adding -cp param to the java command. Example:
    java -cp %classpath% -jar myapp.jar
    I tried all the variations above in the -cp param. None of them worked.
    The only thing that works is if I move executable jar file to the same directory as the required libraries. Then I specify a "Class-Path:" line with no spaces in the path names. Obviously this is not a permanent solution.
    If anyone else has the patience to help me I would really appreciate it.

  • Error obtained when launching executable jar in Mac - Jar works in Windows

    Hi,
    I have a problem using my executable jar in mac. When I run the application(executable jar) from Windows OS, it works perfectly.
    But when I try to launch the application from Mac, I get the following error
    apples-imac:CreateJar apple$ java -jar TreeTable.jar
    Unable to load sqlite: java.lang.
    UnsatisfiedLinkError: no sqlite_jni in java.library.path
    I use the db sqlite.jar
    I had the same error when I executed the application in Windows
    E:\Personal\1>java -jar TreeTable.jar
    Unable to load sqlite: java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path
    But, when I used sqlite_jni.dll, it solved the problem.
    Can you kindly help me by saying what need to be done, so that this error does not come anymore in mac.
    Any help in this regard will be well appreciated with dukes.
    Regards,
    Rony

    Install sqlite correctly on the Mac. It is looking for sqlite_jni.so on the java.library.path and not finding it.

  • Executable JAR containing images doesn't load them

    I'm using Netbeans 4.0 for developping a Java Application. This application is composed of 3 packages:
    - daemonexplorerv10: which contains the main class.
    - GUI: which contains classes I use to create the GUI of the application.
    - images: which contains GIF and PNG images used by the application. It also contains a class named ImageLoader which is used to load the images contained in the package. I will detail this class later.
    My main class, named Main.java, simply lauches the main JFrame of the application GUI. Here is the code of it's main method:
    public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    MainFrame.createAndShowGUI();
        }In the GUI package, I created a class named MainFrame which extends JFrame and is the main frame of my application GUI. Here is the code of it's method createAndShowGUI:
        public static void createAndShowGUI() {
            //Suggest that the L&F (rather than the system)
            //decorate all windows.  This must be invoked before
            //creating the JFrame.  Native look and feels will
            //ignore this hint.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            MainFrame main_frame = new MainFrame(main_frame_title);
            main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Display the window.
            main_frame.pack();
            main_frame.setVisible(true);
        }And here is the beginning of the code of it's constructor:
        public MainFrame(String title) {
            super(title);
            ImageLoader il = ImageLoader.getSingleton();
            ImageIcon application_icon = il.loadImage("application_icon.png");
            if (application_icon != null) {
                this.setIconImage(application_icon.getImage());
            else {
                System.out.println("Error - application_icon could not be loaded");
    ...As you see, MainFrame uses ImageLoader so as to customize the frame icon. ImageLoader follows the singleton pattern. It has a method called loadImage which returns an IconImage for a given image name. Here is the code of this method:
        public ImageIcon loadImage(String image_name) {
            ClassLoader cldr = this.getClass().getClassLoader();
            URL image_url = cldr.getResource("\\images\\"+image_name);
            if (image_url != null) {
                return new ImageIcon(image_url);
            else {
                return null;
        }For every image I want to use in my application, I use ImageLoader. It fetches the image thanks to the given name, provided that the image is placed in the package called images, or else the method loadImage returns null.
    So the MainFrame uses ImageLoader which fetches the image "application_icon.png" for the frame to set it as it's custom icon.
    My application runs perfectly well :)... as far as I run it through Netbeans launcher. But Netbeans also creates automatically an executable JAR file for each builded application. So I tried to lauch this JAR. Through this way, the application works, but all the images that should be loaded aren't!
    I unpacked the JAR so as to check if all the images are in it. Netbeans includes the images. Netbeans also creates a manifest file which seems perfectly correct.
    So I can't understand why my application runs without any images when I launch it through an executable JAR while it works fine (with all the images) when I lauch it through Netbeans.
    I checked many forums to find a solution. Using ImageIO doesn't or ToolKit doesn't solve the problem. It simply seems that the path of the package called images can't be found by the method getResource when this package is compressed in the JAR.
    P.S: I use J2SE Development Kit 5.0 and J2SE Runtime Environment 5.0.

    So ReinerP, I tried your code today in a little test application which has a single package containing two classes:
    - Main.java
    - JMainFrame.java
    Here is the code of Main.java:
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    //Suggest that the L&F (rather than the system)
                    //decorate all windows.  This must be invoked before
                    //creating the JFrame.  Native look and feels will
                    //ignore this hint.
                    JFrame.setDefaultLookAndFeelDecorated(true);
                    //Create and set up the window.
                    JMainFrame main_frame = new JMainFrame();
                    main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    //Display the window.
                    main_frame.pack();
                    main_frame.setVisible(true);
    }And here is the code of JMainFrame.java:
    public class JMainFrame extends JFrame {
        /** Creates a new instance of JMainFrame */
        public JMainFrame() {
            super();
            //load and set icon
            URL imgURL = JMainFrame.class.getResource("icon.png");
            ImageIcon img = new ImageIcon(imgURL);
            setIconImage(img.getImage());
    }As you said, it works :). It works when I run it through Netbeans launcher, and it also works when I run it through the Executable JAR Netbeans generated during the building of the application.
    So I adapted the code of the application I was talking about in the first post of this topic. I modified the code of the method loadImage in ImageLoader.java:
    public ImageIcon loadImage(String image_name) {
    //not working in JAR:  ClassLoader cldr = this.getClass().getClassLoader();
    //not working in JAR:  URL image_url = cldr.getResource("\\images\\"+image_name);
            URL image_url = ImageLoader.class.getResource(image_name);
            if (image_url != null) {
                return new ImageIcon(image_url);
            else {
                return null;
        }And it works well. Thanks again. However, I still can't explain why the use of class loader isn't undertood by the executable JAR.

  • Creating executable JAR from JDeveloper 11

    Hello
    Iv'e been using JDeveloper for developing my Java desktop app. It includes my classes and some additional external jar's. From within JDeveloper everything works fine, but now I want to deliver my app as a single JAR file (including the external jars).
    I searched and searched and couldn't find such an option. I tried creating deployment profiles and deploy my app but the resulting JAR was very small, did not include the utility jars and did not run in double clicking.
    I tried both Eclipse and NetBeans and they produced nice running executable jars of the sane application with only a few clicks. However, Im used to JDeveloper and would rather continue working with it. Is there a way to create a complete executable jar from JDeveloper (or maybe a plugin) ?
    If not than how do I do it manually so I can write my own generator ? (I know the basics, but how do I include the library jars ?)
    Thanks
    Guy Shilo

    Hi
    If you to want include external jars, don't keep those inside src folder but outside to that folder. Then only framework consider this as resources and will be packed while deploying. You can ensure it by creating a simple file using wizard. It will be displayed in application navigator under the folder 'Resources'
    See the related thread from How to read .txt file from adfLib jar at model layer using relative path . See what
    Frank Nimphius has replied. You may get some idea
    Edited by: Raguraman on Dec 13, 2011 10:12 PM

  • Executable Jars and their Classpath

    I have made a java application that takes requires several libraries to run. I am using netbeans 4.0 but have reached the stage where I'd like it to become a standalone application.
    I have editted the projects properties in netbeans to use the correct libraries for compilation and set the correct arguments to run it. It runs fine in netbeans. However, when i try to execute the jar file that netbeans generates with the command...
        java -jar  PeerPressure.jari get the error...
      Exception in thread "main" java.lang.NoClassDefFoundError: net/jxta/pipe/PipeMsgListenerI have tried to modify the manifest.mf file to (it has 2 enters at the end)....
    Manifest-Version: 1.0
    X-COMMENT: Main-Class will be added automatically by build
    Main-Class: Main
    Class-Path: /lib/jxta.jar /lib/bcprov-jdk14.jar /lib/javax.servlet.jar /lib/log4j.jar /lib/org.mortbay.jetty.jarbut i get the same error. I've also tried the command...
      java  -classpath \lib\jxta.jar;\lib\log4j.jar;\lib\bcprov-jdk14.jar; -jar PeerPressure.jarI'm not sure what else i could try. I've already looked through loads of tutorials and forums posts but still havent got any further. Any help would be great.
    Cheers

    Tried it and still no luck :(
    I tried executing the jar that netbeans 4.0 generates with a project that doesnt require the classpath to be set and that works fine. Also, looking at the stack trace, I've noticed that the executable jar file that i'm having problems with does actually execute. But when it reaches a class that implements the PipeMsgListener it stops.
    C:\Documents and Settings\Scottie\PeerPressure\dist>java -classpath ..\lib\jxta.
    jar;..\lib\log4j.jar;..\lib\bcprov-jdk14.jar;. -jar PeerPressure.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: net/jxta/pipe/PipeMsg
    Listener
            at java.lang.ClassLoader.defineClass0(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)
            at peerpressure.Main.main(Main.java:26)i get the same error when i try
    java -jar PeerPressure.jarMy first thought was that the class that implements the PipeMsgListener was at fault. But when i run the project through netbeans it works fine!
    Not sure whats going on really. Does anyone know how to find out the command that netbeans is using to execute a project? If i could find out what it is i could use it to execute my jar.
    cheers :)

  • Executable JAR Problems

    I made an executable JAR file (With the Manifest file). When I double click it, it just sits there. (Note: Im using XP and i did assosiate the file).
    Please help

    I had a similar problem running an executable Jar file on the XP platform. I was constantly getting the ClassNotFound error when I ran the program outside of the JBuilder 9 environment. I finally resorted to the newsgroups for help and found this suggestion. Including the classpath in the manifest file! This worked for me and hopefully it will help you.
    Main-Class: ewc.DocumentManager
    Class-Path: file:///C:\ewc\classes
    file:///C:\ewc\classes12\ojdbc14.jar

  • Executable Jar? - Googled for hours, tried many solns, still doesn't work!

    I am fairly new to Java, and I'm just simply trying to create an executable jar that will run when I double-click on the icon.
    I have created my very basic program that uses java swing on Netbeans. I have right-clicked on the project, selected properties, and checked the packaging section to make sure that it creates a jar file. I also selected compress jar file, which some tutorial told me to do as well. (I've also tried not checking compress jar file to see if it made a difference... it didn't).
    I then went to folder options to make an association with the jar file to javaw.exe so that when I clicked on the icon, it would know to use javaw.exe to open it. When I double click on the jar file, it now just makes the error noise and nothing happens. Before I made the assocation, it would open up ultimatezip which would show me the original source code, the class file, and the manifest.mf file.
    In any event, I'm just playing around with creating an executable jar file and any advice on how to make it so that the GUI launches when I double click on it would be extremely helpful.
    Edited by: bigbamboo on Oct 13, 2009 8:41 AM

    bigbamboo wrote:
    Thanks for your prompt response. I just tried your suggestions. 1 & 2 both worked for me. I have fiddled around some more with my file association and have looked at several sites that go through it step-by-step and I have tried them all. I went to tools, folder options, and I have changed the association to javaw.exe
    I just can't figure out what's wrong.Good. So at least you know that it is the file type association that is not working correctly.
    On my Windows PC, when I edit the open Action for .jar files, the command string is
    "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %*Maybe that will help. Of course, the path to your javaw.exe may be different.

  • Need help with loading images in executable Jar

    Hi,
    I've developed an application using netbeans that needs to load and display images.
    I use netbeans Clean and Build function to create an executable Jar file. When I run the executable Jar file it runs fine but when I come to a section of the application that needs images it freezes and can't load the images.
    When I then return to netbeans the part of the program that did successfully run before Clean and Build doesn't work anymore and I get an error message saying Uncaught error fetching image:
    I use,
    URL url = getClass().getResource("images/image1.png");
    Image image1 = Toolkit.getDefaultToolkit().getImage(url);to load an image.
    Can someone tell me why, when I clean and build my project to create a JAR, my images fail to load.
    Should I be storing the images in a specific folder or something??
    Thanks

    I've opened the JAR using winzip and, for some reason, the JAR hasn't preserved my file structure. So, when I try to look for an image as follows:
    URL url = getClass().getResource("images/file1.png");
    Image img= Toolkit.getDefaultToolkit().getImage(url);The folder doesn't exist and so it can't find the image.
    Can someone tell me how to keep my file structure when I create the JAR or an alternative way to find the images within the JAR file.
    Cheers

  • Making Executable Jar file using java Application

    Following Program creates the jar file at specified location. but, I wonder why this file does not execute on double clicking on it, in spite of that the Manifest file contain correct main class file name
    //MakJar.java
    import java.io.*;
    public class MakJar
    public static void main(String[] args)throws IOException{
    Process p;
    String str="D:\\Himesh\\JFiles";
    try {
    BufferedWriter out = new BufferedWriter(new FileWriter(str+"\\mainClass.txt"));
    out.write("Main-Class: TestFrame\n");
    out.close();
    } catch (IOException e) {
    try
         p=Runtime.getRuntime().exec("cmd /c D:\\Java6\\jdk1.6.0\\bin\\javac.exe "+str+"\\TestFrame.java");
         p=Runtime.getRuntime().exec("cmd /c D:\\Java6\\jdk1.6.0\\bin\\jar cvmf "+str+"\\mainClass.txt "+str+"\\Demo.jar "+str+"\\*.class");
    catch(IOException e)
    System.err.println("Error on exec() method");
    e.printStackTrace();
    }

    Sir,
    On execute the jar using a "java -jar. . ." command. it gives the error--
    "Exception in thread "main" java.lang.NoClassDefFoundError : TestFrame"
    On Extracting the files from jar file made by the java program,i found that the manifist file ( containing the name of main class) and t the class file are included in the jar file.
    But if I make the jar file manually it works perfectly.I have even reinstalled the java but the problem persists
    Same thing happen if i use MS-DOS batch file.
    ??????If i put the batch file in the same directory and execute it The resulting jar file works,But
    ??????if the batch file is executed from outside the directory The resulting jar file fails execute.
    what should i do???

  • Building JAR with NetBeans 4.1

    I have a NetBeans 4.1 project. I build a JAR file. So far so good.
    When I run:
    java -jar AmazonSample.jarI get, "java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException"
    Apparently, it can't find "jaxrpc.jar". This file is both in the root of the JAR file and I've also tried copying it to the current working directory next to the the JAR. I try;
    java -classpath .\jaxrpc.jar -jar AmazonSample.jarand
    java -classpath jaxrpc.jar -jar AmazonSample.jarI still get the same error. As an aside question, can you specify a classpath like that when running a JAR file?
    On other projects, I've added a classpath entry to the JAR's manifest file and that works fine. However, NetBeans doesn't provide an easy way to do that.
    This must be a very common scenario. How do I resolve?
    Thanks!

    If you put the jar files in a library and then add that library to compile
    and runtime classpaths its works fine running from within the
    netbeans but when you try to run the jar outside it doesn't workIt doesn't work because you aren't providing any classpath information. When you run using the -jar variant [java -jar <proggie>] or by clicking the jar in Windows, all external classpath information is disregarded.
    The only valid source for classpath information in that case is to provide it in the jar's manifest file, in the form of a Class-Path: <classpath> entry.
    To add this to a Netbeans-created jar, look for a file manifest.mf in the Project's files, and add the above entry to this file. NB constructs the actual manifest file from this file, and the classpath entry will transfer.
    Here's how to make this work:
    1. Create an empty directory test somewhere in the computer.
    2. Copy the external library directory or jar file to test.
    3. Add the line Class-Path: <name> (where name is the library's directory or jar name) to the manifiest.mf file. If multiple items need to be listed, separate them with a space - not a colon or semi-colon.
    CAUTION: The file must end with a linefeed/newline, and as far as I can determine, the <name> can't contain spaces.
    4. Build the Project in NB.
    5. Copy the jar it creates (in the dist directory) to test.
    6 From the test directory, either issue the java -jar <proggie> command or [in Window, assuming your machine is setup to do this] click/double-click the jar.
    The contents of test can be zipped for distribution; the recipent needs to unzip into a directory to run.

Maybe you are looking for

  • Every time I log onto firefox it comes up in dutch. This also affects everything as it is all in dutch...why? I am english!

    For the last couple of weeks every time I log onto firefox it is in Dutch. Someone is accessing my facebook account from Amsterdam and that also appears in Dutch. Hopefully that one has been resolved but it is a big worry. I did nothing to change my

  • Display image in HTML region???

    I made blank page, and on that page I made html region. Then I go to the Shared Components>Images Create and Upload the image DMD.gif to the Application 106, that the Application with which I'm working.I trying to put that image to the html region. I

  • When I click on links in other applications (email is one) Firefox does not open it.

    If I click on a link in another application, such as one to the application's help service or a link in an email, it looks as if Firefox is trying to open a page or tab, but there is just a brief flash and nothing appears. This is a fairly recent phe

  • IPhone 4s not being recognized by iTunes.

    It seems that ever since the latest iTunes release, iTunes no longer regonized my iPhone. When my iPhone is plugged into my laptop, it simply says "iPhone", not "Ian's iPhone". I plugged my phone into my wifes laptop(she's also an iPhone user) and it

  • Sender RFC error

    Hi guys, I'm doing an RFC to File async scenario just as mentioned in the blog /people/swaroopa.vishwanath/blog/2006/12/28/send-rfc-to-sap-xi-150-asynchronous and i have done the configurations also from the blog /people/michal.krawczyk2/blog/2005/03