Prob in running Jar

Scenerio:
I have 3 class file i create Jar file suppose abc.jar;
one of my class need db driver to load ,that is also in my class path
Actually when i run jar file its gives error of loading driver
but when i run just class file without creating jar it works fine
Reason ????

java.lang.IllegalArgumentException: DB Driver [org.gjt.mm.mysql.Driver] could not be loaded. Exception occured: org.gjt.mm.mysql.Driver
at DBConnector.init(DBConnector.java:96)
at DBConnector.<init>(DBConnector.java:30)
at ExpiredAccount.<init>(ExpiredAccount.java:109)
at ExpiredAccount.main(ExpiredAccount.java:375)

Similar Messages

  • Problem running jar files of java in Linux

    I cannot run jar files in java/jdk1.3.1_01/demo in Readhat Linux 6.2
    The command is :--
    [root@localhost Notepad]# java -jar Notepad.jar
    java.lang.NoClassDefFoundError: javax/swing/JPanel
    at java.lang.Class.forName(Class.java:33)
    at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
    at kaffe.jar.ExecJar.main(ExecJar.java:61)
    [root@localhost Notepad]#
    My ~/profile setting is :---
    PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/usr/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
    export JAVA_HOME=/usr/java/jdk1.3.1_01
    export NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/ns4

    [root@localhost Notepad]# java -jar Notepad.jar
    java.lang.NoClassDefFoundError: javax/swing/JPanel
    at java.lang.Class.forName(Class.java:33)
    at
    at
    at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
    at kaffe.jar.ExecJar.main(ExecJar.java:61)
    [root@localhost Notepad]#
    My ~/profile setting is :---
    PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/u
    r/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
    export JAVA_HOME=/usr/java/jdk1.3.1_01
    export
    NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/n
    4Add the line:
    export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar
    Then, run the command "source ~/.profile" and then the jar file should be able to run.
    Bhav

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • Set java path to run jar in command prompt

    i have installled only jre.. i dont have jdk..
    Is it possible to run jar command in command prompt.
    if possible please give me jar command...
    thanks in advance

    i have installled only jre.. i dont have jdk..ok
    Is it possible to run jar command in command prompt.Please, read java tutorial before posting such question
    if possible please give me jar command...Please, read java tutorial before posting such question

  • Run jar-exe on windows systems.

    Hi. I`m trying to find a way to run jar files on Windows systems. The key is to do so without having installed "explicity" the jre (1.5 or higher) sun installation program. I mean, I want to users be able to run my .jar executable programs on machines where jre isn`t set. I know how to create executable jar programs, but I have no idea about how to change Windows behaviour to instantiate the java virtual machine.
    Help and comments wil be welcome, Thanks and regards.

    Are you trying to run .jar executable on Windows system without JRE installed? Remember, executable jar file contains java classes and they need a JVM/JRE in order to run themselves.
    In plain you cann't run a jar executable without jvm/jre installed.
    Now, on another note, if you are trying to provide user the ability to run jar file without downloading/installing JRE, this forum entry might interest you:
    http://forum.java.sun.com/thread.jspa?threadID=695898

  • Error messege when run jar file

    when i run jar file of my project give me that error(Fatel exception occured.program will exist)
    what is the reason of that error

    "can't get that path". Sounds like requisite classes aren't on the classpath.
    Please paste the ENTIRE error message that it's producing into your next reply. You have probably forgotten to include necessary classes - perhaps a JDBC driver - in your JAR file.

  • Problems with running jar on linux

    Are there any known problems when running jar files on linux, that were compiled on windows?
    http://turkeybot.info/DuckHunt.jar
    The images directory that is in that refuses to load under linux, but there's no problem with windows (it's using System.getProperty("file.separator") to get hte correct file separtor to refer to the image directory).

    Java code should run in all JVMs. But if you did something Windows-specific (such as looking for a file named C:/something/or/other) in your code then you can't expect it to run in other environments.

  • Console not display when run jar file

    i run jar file with command javaw -jar test.jar or double click on jar file, it's console app, it just run well but console not display, can i made console display and when i close console, it's stop jar file too?
    thanks

    i got it, javaw = no console window, i tried java command and i got error: can not access jar file?

  • Run .jar as window services.

    Hi,
    I?ve tried running .jar using batch file in window scheduler. The program will auto end if we logoff from the OS(window server 2003).
    How can we run .jar as window services, beside using Java wrapper?
    Most window wrapper need license to execute. I will like to deploy this .jar as window services in our customer side.

    You have to chose the option while creating the task as "When my computer starts", this will work as soon system boots up and until the task is explicity stopped later. This works independent of user logging into the computer; as soon the machine boots up to windows.
    If you choose "When I login" during task scheduling, the task becomes active as log as you have logged on to that desktop.
    Hope this helps.

  • Running jar in Linux and Windows

    Hi
    I created a jar file in Linux and it is running fine under Linux.
    But when I tried to run the same jar under windows,I got the following error
    Exception in thread "main" java.lang.NoClassDefFoundError:
    Is there any difference between running jar files in Linux and Windows?

    Hi
    I have a jar(say program.jar) containing a program which uses some libraries(again some jar files).The manifest file is written to look for the library jar files in the current directory.
    Main-Class: package_name.program_name
    Class-Path: fits.jar image.jar util.jar myutil.jar
    But while running the jar file in WINDOWS (java -jar program.jar <parameter list>)
    the following error occurs:
    Exception in thread "main" java.lang.NoClassDefFoundError:
    nom/tam/fits/Data"
    the class Data is present in the fits.jar jarfile.
    The same jar(run in the same manner)does not give any problems in Linux

  • Unable to run jar file without lib folder containing swing-layout-1.0.jar

    I have done my project through NetBeans 5.0. Eventhough I have copied my lib foloder containing swing-layout-1.0.jar inside my project.jar, I am still unable to run my project.jar in other systems, it is creating an error as Could not find the main class. Program will exit. But if I copy the lib foloder containing swing-layout-1.0.jar in the same path as the project.jar, then my project.jar is running.
    But I want to give only the project.jar for other users and not also lib foloder containing swing-layout-1.0.jar each time.
    Could someone please help me with this.

    When you develop GUI applications using the Netbeans you may endup using netbeans specific jar files in your auto generated code.
    And when you build jar files with netbeans it copy the third party jar files used in a application in to a lib folder in the same directory as the jar file of your project. And then set a class path entry to those jar files in your project jar file's manifest file.
    So if you want to redistribute the package you have to redistribute your jar file and every thing in the lib folder in with the same directory structure.
    If you want to change the structure you will have to change the class path to suit the new structure.

  • Getting error while running jar file

    Hi,
    I am getting below error while running the jar file
    "Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdeveloper/layout/XYLayout:"
    I have created a simple ADF desktop app in which i am displaying the frame.I created the jar from Jdeveloper.
    Please help..

    How do you run the jar file? Take a look at this thread for a possible a solution: Re: deploying a jdeveloper adf application to a desktop
    Is the class XYLayout packaged or referenced? Take a look at this thread: XYlayout  classes - can I distribute with my code?

  • Saving a file in the same location as run .jar

    I have been playing around with an auto updating client for a project I am working on.
    I have been able to get the client to update fine and save a copy of the new client into where ever the original was run from using the below code:
    File file;
    CodeSource src = HemClientMain.class.getProtectionDomain().getCodeSource();
    if (src != null)
         try
              URL url = new URL(src.getLocation(), "UpdatedClient.jar");
              System.out.println("Writing to: " + url.getPath());
              file = new File(url.getPath());
              if (!file.exists())
                   file.createNewFile();
              FileOutputStream fos = new FileOutputStream(file);
              BufferedOutputStream bos = new BufferedOutputStream(fos);However when I tried running this on my laptop I get a file not found error:
    Writing to: /C:/Documents%20and%20Settings/Rob/Desktop/UpdatedClient.jar
    java.io.IOException: The system cannot find the path specified
            at java.io.WinNTFileSystem.createFileExclusively(Native Method)
            at java.io.File.createNewFile(File.java:883)
            at Client.ClientGameThread.saveNewClient(ClientGameThread.java:584)
            at Client.ClientGameThread.gameClientFinishedUpdating(ClientGameThread.java:564)
            at Client.ClientListenThread.dealWithPacket(ClientListenThread.java:96)
            at Client.ClientListenThread.listen(ClientListenThread.java:74)
            at Client.ClientListenThread.run(ClientListenThread.java:38)It's clearly something to do with the location and the path not being correct, as if I move the client to say .. c:/ and run it it updates and saves fine.
    Is it something to do with the spaces in between document and settings? And if so how do I stop this from happening? Is there another way I can accurately find the path to the current jar file and save a copy there?
    I used to do it via this code:
    String fileLocation = System.getProperty("java.class.path");     However I now have more than one thing in my classpath and this doesn't produce one path but a combination of them all ... which is not really what I want. There must be a nice way to do this!
    Any help / suggestions appreciated. Any further questions I will attempt to answer my best :)

    iexus wrote:
    I have been playing around with an auto updating client for a project I am working on. ...Launch the app. using Java Web Start. It has update ability built in, and will save you a lot of headaches.

  • Unable to clear DOS window after running JAR

    Hi guys,
    I am trying to write a batch file to launch my JAR, this is because the JAR is on a networked drive, and each user can have a .bat file on their desktop to run it.
    Anyway, when the .bat file is run, the DOS console pops up behind it but I don't want it there,
    How can I make it dissappear after the JAR is launched, or even better, not come up at all?
    I have tried all these to no success.
    call "H:/folder/myApp.jar";
    exit
    call "H:/folder/myApp.jar";
    end
    javaw -jar H:/folder/myApp.jarThanks in advance.

    Why don't you create a shortcut to the jar file?
    Then you won't have a bat or a dos window to close.

  • Running Jar Files created in Sun Java Studio

    Hi everyone,
    I am still trying to explore the functionalities (especially as regards deployment issues) of this robust IDE. However I do have a problem. I have developed a very basic program that connects to a database (MSSQL) using Java Studio 8. However after building the jar file, if I try to execute the jar file it gives me this message
    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver.....
    But all goes well within the IDE and it runs well if I use my notepad or vi editor,compile it from the command line and execute the generated class file. The classpath have been set for all the necessary jdbc jar files.
    Any Help Will Be Appreciated

    1. Sun Java Studio Enterprise 8 is based on NetBeans 4.1 which does not provide direct support for packing an application. One alternative you may want to consider is to use NetBeans 5.0 (http://www.netbeans.info/downloads/download.php?type=5.0) or JSE 8.1 which is based on NB5.0 and which is now in beta (http://developers.sun.com/prodtech/javatools/jsenterprise/downloads/index.jsp).
    You may want to refer to http://www.netbeans.org/kb/articles/javase-deploy.html for packing and deploying a standalone application is NB5.0 or JSE8.1.
    2. Using JSE8, you may want to try copying all the library jars (including database drivers) used by your application to your projects dist directory manually and then package them all into one jar.
    3. You should not have to know the exact location of the jdbc jar on the client machine. How are you instantiating the driver in your code? Are you using 'Class.forName()'? If so, java should be able to pick up the driver from the classpath. (Pl. ref to http://forum.sun.com/jive/thread.jspa?forumID=122&threadID=62696, which may be of help).

Maybe you are looking for