Running Jars with other Jars

Hello people, let me tell you a little stroy
I'm using netbeans IDE to wrtie a program that uses the mysql connector package to interface with a database. Every time I compile in the IDE, it gives me a nice little command line executable to try. (Something along the lines of
"To run this application from the command line without Ant, try:
java -jar "C:\...path to my jar"
... so I go ahead and try it ...
I'm getting a class not found error. the class its not finding is the connector:
com.mysql.jdbc.Driver
thus, im wondering what the syntax would be to include that in the command line call .... or if there's a better way to run my application with all of the extensions it needs without the IDE.
Thanks in advance ..

Sorry, but we have heard that story before...
To run an Java application use:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument

Similar Messages

  • Running iSight with other programs?

    I am trying to figure out if there is a way to play a DVD while using iSight to record. I have a DVD with a prompt on it and need to watch this and also capture my video of the response. Can I do them both on the same computer? I have been using a TV/DVD player to watch and then a camcorder to record, but iSight, if it will work, seems simpler.

    Welcome to Apple Discussions, anselu
    If I understand what you want to do correctly, you could use an external iSight to record your computer monitor. Of course, you would need some way to mount your iSight so it is pointed where you want it. You would also need some application that can record movie or video clips. You could use iRecord, iMovie, QuickTime Pro, or one of the other clip/movie recording apps linked in Some Applications You Can Use With iSight.
    If you are looking for higher quality recordings or want an alternative that does not require the use of iSight, you may find that SnapZ Pro, which is also linked in the "Some Applications..." page, is a better alternative for recording what is displayed on your Mac's monitor.
    You do not say which Mac you use. If your Mac has a built-in iSight, SnapZ Pro will offer much more convenience than trying to rig some way to record what is on your display with a built-in iSight.
    Jim

  • Help with a question about making/running .jar files.

    First i have a question, can i make a .jar file that can run on a computer without JRE installed. And if i can, how do i make it. I have tried to make it on my computer, that has JRE but i keep getting the error when i run it: Exception in thread "main" java.lang.NoClassDefFoundError: Sample\FileSearchAnd im using the command:
    jar cvfm jarname.jar directory\manifest.txt directory\FileSearch.class directory\FileNode.classIt says it creates the .jar but is unable to run it.

    dford425 wrote:
    First i have a question, can i make a .jar file that can run on a computer without JRE installed. No, not unless you package the JRE with your dist. Hence the name JRE (Java Runtime Environment).
    And if i can, how do i make it. I have tried to make it on my computer, that has JRE but i keep getting the error when i run it: Exception in thread "main" java.lang.NoClassDefFoundError: Sample\FileSearch
    That simply means your not pointing the runtime to the classes. Set your CLASSPATH environment variable correctly and it will run (given you have a JRE which it appears you do).
    And im using the command:
    jar cvfm jarname.jar directory\manifest.txt directory\FileSearch.class directory\FileNode.classIt says it creates the .jar but is unable to run it.

  • 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.

  • Java error when trying to run .jar program---help?

    I have a Java program that runs fine on a Windows box.
    When I run it with the GUI "Jar Launcher", the program name appears at the top of the screen very briefly but then the program crashes. When I run it using Terminal, I get the following errors:
    +Exception in thread "AWT-EventQueue-0"+
    +java.lang.NoClassDefFoundError: javax/swing/GroupLayout$Group+
    +at PPBSOjdb.PPBSOjdbApp.startup(PPBSOjdbApp.java:20)+
    +at org.jdesktop.application.Application$1.run+
    (Application.java:171)
    +at java.awt.event.InvocationEvent.dispatch+
    (InvocationEvent.java:209)
    +at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)+
    +at java.awt.EventDispatchThread.pumpOneEventForHierarchy+
    (EventDispatchThread.java:269)
    +at java.awt.EventDispatchThread.pumpEventsForHierarchy+
    (EventDispatchThread.java:190)
    +at java.awt.EventDispatchThread.pumpEvents+
    (EventDispatchThread.java:184)
    +at java.awt.EventDispatchThread.pumpEvents+
    (EventDispatchThread.java:176)
    +at java.awt.EventDispatchThread.run(EventDispatchThread.java: 110)+
    When I run "java -version" (Terminal again) I get:
    +java version "1.5.0_16"+
    +Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-275)+
    +Java HotSpot(TM) Client VM (build 1.5.0_16-132, mixed mode, sharing)+
    The programmer believes it should run under Java 1.5 as well was 1.6, but he develops on Windows.
    Any suggestions on how to get this program to run?
    Thanks!

    Thanks. Crud.
    Am I just out of luck or is 1.6 available on the Mac? Is Apple just slow getting 1.6 out (since my computer is all Software Updated)?
    Is there someplace that explains the relationship between Java SE 6, J2SE, version 1.6/1.5?
    I'm very new to Java.
    Apple says that "Java for Mac OS X 10.5 Update 2 delivers improved reliability and compatibility for Java SE 6, J2SE 5.0 and J2SE 1.4.2 on Mac OS X 10.5.4 and later. The release updates Java SE 6 to version 1.6.0_07, J2SE 5.0 to version 1.5.0_16, and J2SE 1.4.2 to 1.4.2_18."
    (Apple has since come out with Update 3, but it's not mentioned on the developer.apple.com/java/ page for some reason.)
    It seems like "version 1.6.0_07" would be version 1.6 but apparently it's still 1.5! (Bizarre.)
    Thank you!

  • Impossible to run jar file

    Hi! I've got a problem is getting me crazy. I'm using JDK 1.1.8 to develope a consulting application in java. Everything works well, but I need to create a jar file to distribute the program to other PCs. I install the JRE 1.3.1 to simply click on the file and run it, but it doesn't work. The problem is the famous "Could not find main class", I've already read about it in other threads. But there is one curious thing. If I run the jar file with c:\jre...\bin\java -jar MyJar.jar this exception ocurred:
    Exception in thread "main" java.lang.ClassFormatError: Consulta (Illegal method modifiers: 0x402)
    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)
    and "Consulta" is not my main class, my main class is another one.
    What is the reason of this error? How could I create a jar file and run it with double-click?
    Thanks a lot!!

    Yes, I've defined the main class.
    I've just solved the problem. I think it was related with a private method I had defined in the class "Consulta". I changed it to public and it works. A bit strange....
    Thanks anyway for your response! See you!

  • 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?

  • 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

  • Updating a running JAR file without using JDK

    Hi guys, I have been stuck on this problem for days. I have a program that allows the user to log in and encrypt/decrypt files. This program must be stored on the removable drive and it should work on any operating system without requiring any installation of files. In order to store their login data, I wrote it to a shadow.txt file. My idea was to pack this shadow file into the JAR file so as not to create unnecessary files. I understand that in order to update JAR files, all I need to do is to do
    Runtime.getRuntime().exec("jar uf login.jar shadow.txt");However, here's the problem. I cannot assume that every user PC has JDK installed. As JRE doesn't have jar.exe, that command won't work anymore. Furthermore, the JAR is currently in use. So even if the user has JDK, windows will never allow this command to go through. Anyone has any ideas?

    I had similar requirement, except that, i used a war file.
    Had a client.war file in JBoss deploy directory, and i needed to update client.jnlp file present in it.
    But as jar.exe comes only with jdk, could not use jar -uf command.
    But not sure if it works with other application server too,
    in jboss we can explode the war file, meaning we can create a directory "client.war" in deploy directory and extract your client.war contents to it. Now when server starts, it considers the extracted directory as web archive application.
    This extraction can be done with out using jar.exe. can be done using jarinputstream aswell.
    Once the contents are extracted , the files in it can be modified with out jar.exe.
    For my case it worked as my client.war file is not signed, although the resources inside are signed.

  • 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)

  • 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.

  • 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

Maybe you are looking for

  • Mac Mini won't boot from dvd

    I just picked up a used Mac Mini and the previous owner didn't wipe the hard drive. He did include the original install disks in the package, though. I inserted the install disk & it says that OS X Tiger can't be installed on the mini (currently it i

  • TS1717 When trying to open itunes I get an error message "New iTunes Library".  any suggestions?

    i can't open itunes.  i get an error message: New iTunes Library.  Anyone else encounter this?

  • InDesign CS3 epub export photo problem

    Hi, I am trying to format a book in epub, using InDesign CS 3. The text styles translate satisfactory, but I have not been able to get inline photos to show up at full galley width. I have so far done about 2 doz tests, with different anchored object

  • How to turn iphone as a hotspot?

    Hi there! Does anyone here know how to turn your iPhone 4s as a hotspot for internet? It's like being a modem/router, then, other devices near it would be able to have internet access via wifi. Thank you for the response. Cheers, Jenssen

  • Windows 7 office 2013 acttivation

    Why must I activate my windows 7 microsoft office home and business 2013 every time I start up my computer and access a program (outlook) in office 2013??? I get the message "sorry we ran into a problem while trying to install the product key. If thi