YET another double-clicking a jar question!

Hi all.
Sorry about this but I've been searching this forum for the last couple of hours and I still can't figure out why I can't double-click my jar file.
I've 'jarred' my application into a file named <i>parserTTe.jar</i>.
This jar includes a package named <i>parser</i>, wich includes the main class <i>Parser</i>, and several other subpackages.
In the manifest file (created by ant 1.5), there is an entry as follows:
Main-Class: parser.Parser
followed by a couple of blank lines.
The main method of <i>Parser</i> class demands as an argument the path to the file to parse.
Now, if I run the command line <b>java -jar parserTTe.jar <i>pathtosomefile</i></b>, everything works smoothly.
As the parser does its job, I can watch its verbose flowing in the command line window.
If I double-click the jar file, though, <b>nothing happens</b> and I would expect that a <i>java.lang.ArrayIndexOutOfBounsException</i> would be thrown, as it does when I simply run <b>java parser.Parser</b>.
If instead of double-clicking the jar, I run the command line <b>parserTTe.jar <i>pathtosomefile</i></b> or just <b>parserTTe.jar</b>, still nothing happens, the command line just refreshes.
My WNT is set to recognize jar files as Executable Jar Files and the open action is set as follows:
C:\...\javaw.exe" -jar "%1".
I've tried changing this to <i>java.exe</i> instead of <i>javaw.exe</i> but then I get a <i>java.lang.ArrayIndexOutOfBounsException</i>, either if I specify the path to the file to parse or not.
Currently I'm bypassing this problem using a <i>parserTTe.bat</i> file, wich works, of course, but I'm annoyed for not understanding what's wrong: why can't I run the jar file directly?
Thanks for your help!

And where do you expect that argument to come from if
you double-click to run the class? That's why you are
getting the array index exception, because your class
is being called with no parameters. You need to
redesign your class so that it prompts the user for
the file name; and since it's being run via javaw.exe,
it will have to use a GUI to prompt. A JFileChooser
would be a good choice.Please look closer to my description: I said I'd be expecting that exception to be thrown because of what you say but the problem is that it doesn't.
In fact, nothing happens when I double click it, or when I run it directly from the command line, passing along the needed argument or not.
Let us forget about the double-clicking that I won't use anyway.
What puzzles me is that I should be able to run that jar as if it was a bat file. I do it all the time with other apps I've built, although none of them requires a starting argument...
Like I explained, I thought it could be something related with the javaw.exe so I set WNT to open jar files with java.exe and not javaw.exe.
The double-clicking resulted in a DOS Prompt window that opened and closed before I could see what happened. So I thought: it's ok. It threw an exception because no argument was passed.
Then I tried to run the jar from the command line passing the argument but the exception was thrown again, though, wich I didn't understand why.
Basically, that's it.
Thanks anyway for your time.

Similar Messages

  • Double click on JAR file to execute it.... How???

    Hello,
    I wrote a standalone java application, and im wondering how to put a shortcut on my desktop to run the application without having to go into the command prompt to type "java -jar MyProgram.jar".
    I want to be able to just double click on it and have it run. Is there a way to do this?

    Here is how I did it:
    Just install the JDK/JRE and then make a shortcut to the jar file you want to execute. When you install the jre jar's are registered and all you need do is double click them. I've done this in windows 95, 98, Me, NT, and Win2000.

  • Double click on jar file but does not launch

    My PC has windows7 operating system
    The jar file was working fine, everytime I double click it would launch, no problems
    Somehow the .jar file association was changed to open with winrar so now when I double click it does not launch and run like before, winrar opens it
    How can I change the file association back to java?
    Regards
    Edited by: muddy777 on Jan 9, 2010 9:42 PM
    Edited by: muddy777 on Jan 9, 2010 10:14 PM

    muddy777 wrote:
    I understand
    I know how to do this in windows xp but in windwos7 there is no way to enter " -jar "%1" %*
    I can only browse to where javaw.exe is located and select itI can't help you specifically, but found this using Google. [http://www.winvistaclub.com/t19.html]

  • Yet another problem getting a .jar file working on Mountain Lion

    The program I need to run is used for generating sounds. Its a simple java program, set up in a Windows .msi container: http://innertotality.com/?q=node/9
    I currently have the most up to date Java build from Oracle, according to their online test: v7 update 15. However, it shows up in Terminal after a java -version command as 1.6.0_41.
    Whatever version it is, I can't get this program running on it. I've pulled the .msi file apart to get the cab file, pulled that apart to get my jar file, in this case "headwave.jar". Clicking on it makes the JRE icon appear in the dock and do its dance, then it closes down. I can repeat that all I want and never get a running app out of it. I've opened the console up and watched for messages. This is all I've managed to get:
    2/23/13 9:58:44.218 PM login[2871]: USER_PROCESS: 2871 ttys000
    Nothing more, and I've only seen that once. I get more out of Console simply dragging a word around in this box to edit this post.
    If anyone could shed some light on what I need to do to get this running, I would greatly appreciate it. There are very few Mac OS X sound tools available to do what I need so this is really holding my project back. Most everything out there has to do with professional or amateur audio editing, not pure tone generation. I tried ToneGen and it just isn't doing what I need, and Perfect Tone and Tone Generator X haven't been updated for Intel Macs.

    No I haven't, but I just tried it. I tried to cd to the desktop (worked), found the Headwave folder with ls and then cd into it, found the jar folder I extracted earlier (disk1), cd into it, etc etc. I found HeadWave.jar and knew I had the right directory. java -jar HeadWave.jar gave me the following:
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Widgets/JSSampleListener
              at headwave.Main.<init>(Unknown Source)
              at headwave.Main$1.run(Unknown Source)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:708)
              at java.awt.EventQueue.access$400(EventQueue.java:82)
              at java.awt.EventQueue$2.run(EventQueue.java:669)
              at java.awt.EventQueue$2.run(EventQueue.java:667)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlConte xt.java:87)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:678)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:29 6)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:20 1)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.lang.ClassNotFoundException: Widgets.JSSampleListener
              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
              ... 16 more
    This is the same message I received earlier. I'm sure the info I need is hidden behind the "...16 more" lol

  • Yet Another "How to Delete Apps" question

    I'm trying to delete some unused/unwanted apps from within the iTunes structure.  Here's what I've done already:
    Deleted directly from my iPad 2 by holding my finger on an app's icon, then tapping the "delete" icon in the uppoer left corner
    Connect my iPad 2 to my Mac and to iTunes.  Went from screen to screen hovering my pointer over the apps in question and clicked the "delete" icon in the upper left corner.  Some apps asked if I wanted to keep them or trash them, which I answered "trash."
    Turning our attention to the left sidebar in iTunes under the Apps tab, it's labeled "Sync Apps" and has a sort dropdown between the head and the list of apps.  The unwanted apps still reside in thhis list though the checkbox to their left is unchecked.  (see image below)
    I have searched through the different discussion on this forum as well as others, with answers that pretty much mirror what I've done so far, with the exception that some people recommended using the "delete" key (which I assume is the same as the "backspace" key, however I've pressed both), which doesn't do anything.
    Here is where I have come up against a stone wall. 
    How on earth do I get iTunes to delete those apps that I absolutely and positively don't want hanging around?  I don't want them to suddenly appear on my iPad through some vagaries of the sync process and I don't want them showing up within iTunes.
    My setup:
    A 64GB WiFi iPad 2 running 4.3.5
    A 2009 Mac Mini running Lion and iTunes 10.4 (build 80)
    Any help would be greatly appreciated.
    -Tod

    I feel like such a dipstick sometimes.  I'll fret over a problem for hours, then post a question somewhere, then minutes later it seems that a lightbulb goes of over my head.
    One thing I forgot to do was go to the Apps tab under the Library area of iTunes.  <headsmack!>
    Going there and viewing the app icons, I found that selecting an app and either right-clicking and selecting "delete", or simply hitting my "backspace" key cause it to disappear, both from the Apps panel in the Library, but also in the list of Apps next to my iPad screens.
    Sorry for the intrusion.
    -Tod

  • Yet another cross-country store purchase question...

    Right, so http://store.apple.com/us/help/gifting says that you CAN send gifts to some specific "other countries" from the U.S. Store.
    All the threads that I read on this forum regarding cross-border gifting just end with "it is not possible, sorry, too bad for you" etc. Yet the gifting page specifically states it is possible within the context of specific countries.
    It also says you have to purchase within the specific country store. That makes sense, I want to gift an app to someone in Indonesia, so I should go into iTunes, switch to Indonesia store, and purchase the app, hence no cross-border BS on different stores.
    The problem is that once I click on "purchase" "gifting an app" or whatever to try to buy the thing in the Indonesia iTunes store, it ask for Apple ID log-in. Which immediately kicks me out of the country store (in this case Indonesia) and back to the U.S. Store.
    And nothing I can find in the U.S. Store that says anything about international gifting to those countries specified in that gifting advisory page.
    So has anyone figured out how in blazes to gift to those countries stated in the "Gifting outside of the U.S." advisory? I'd like a step by step walkthrough on how to do this if anyone has a clue, because otherwise that advisory is sure as **** misleading, confusing and unhelpful.

    The page you linked to refers to the online Apple Store, which sells Macs, Mac accessories, and Mac OS X software. It doesn't apply to the iTunes Store, which sells music, videos, books, and iOS software.
    (85342)

  • Yet another 3G battery charge issue/question

    All...
    Lately my iPhone 3G is draining it's battery much quicker than it had previously. It will not last a full day. Even with no Safari, games, music, etc. Also, when I charge it, it gets hot, more than usual.
    Not sure, but I think this all started when I let the battery completely drain. I partially charged then the battery completely drained again.
    I've reset shut the phone off then back on with no improvement. I've had the phone for less than a year. Apple replaced my 1st 3G with this phone due to another issue.
    I'm going to let the battery completely drain then will completely charge to see if that helps. Otherwise, any ideas?
    Message was edited by: Greg Begay

    I am having the same problem. It barely makes it through 12 hours now, when previously I was used to about 36 hours. It has only started doing it recently, but I'm not entirely sure what I've done to provoke it.
    Have seen similar issues in other threads, with people suggesting restoring/updating etc. I am yet to try this so will give it a go, but not convinced it will help.
    Message was edited by: bigtom182

  • Yet another Logic Vs.Pro Tools question. Please help!!

    Hi guys! I just arrive to the world of mac a few days ago, and I couldn't be happier. Now it's time to purchase new audio gear, and I am torn between Logic Studio/Apogee interface, or the Digi 003. I've been a Sonar user for the past couple of years, and before that I was on Cubase.
    I love Sonar, but I'm sick of PC's(hence the switch). I need something with good compositional/midi tools, but I also need powerful audio editing. One thing I love about Sonar is the ability to use non-destructive editing in the arrange window. Can the new logic do this? Currently I am leaning towards logic...but I still haven't made a decision. I definitely need drum programming ability, and I'm not sure if Pro Tools le even has a drum map? Any and all advice would be greatly appreciated. Thanks!

    servo2112 wrote:
    I need something with good compositional/midi tools, but I also need powerful audio editing...non-destructive editing in the arrange window... I definitely need drum programming ability..
    Taking just the key points above, Logic will definitely fit the bill better. Logic seems to be a better compositional tool, although PT can also be used for that. Both do SOME non-destructive editing in the arrange windows. Protools has no drum editor at all.
    However, PT is still better at audio editing.
    It would depend on how much audio editing you plan on doing vs midi/composition.
    The above poster is certainly in the ballpark about the add-ons you have to buy with PT just to equal the tools that come with Logic. I would say you'll probably have to spend at least another $1000 on plugin instruments and utility tools (CD burning/mastering) above the cost of PTLE software. Assume you will need at least the Music Production Toolkit in addition to PTLE. You will also want Toast Titanium to burn CDs unless you get Logic w/Waveburner.
    The 003 will definitely not sound as good as the Apogee.
    I've used PTLE since 1999 and it's great for recording and editing audio, but nothing special for writing and nothing special for midi.

  • Yet another string to date format  question

    I have searched the forums and cannot find the exact answer I am looking for so here goes.
    SimpleDateFormat sdf = new SimpleDateFormat("M/d/y");
    String strDate = "02/25/04";
    Date myDate = sdf.parse(strDate);
    gives me : Wed Feb 25 00:00:00 EST 2004
    but I need the output of myDate to stay 02/25/04 in order to add the date object to a sql query.
    strDate will come from request.getParameter variable.
    Any help would be greatly appreciated.

    >
    This will only work if I return the value as a string,
    which puts me back right where I started. I simply
    cannot get the formatted value Wed Feb 25 00:00:00 EST
    2004 to return as a Date object 02/25/04. Is this
    possible? When using SQL, as stated above use a PreparedStatement.
    Use the setDate/setTimestamp/setTime methods to put it into the database.
    Use getDate/getTimestamp/getTime to get it out.
    The 'Date' classes do NOT store anything as "02/25/04". They store milliseconds since the epoch in UMT (Universal Mean Time = Greenwich Mean Time.) That is all they store.
    When you display a 'Date' instance it is converted to a display format. You can use SimpleDateFormat to create any display format that you want.

  • Issue with .jar file (double clicking)

    Hi.
    I've been having a problem with a certain .jar file when I attempt to double click it. From my understanding, I was under the impression that when someone double clicks a .jar file, the contents are supposed to execute by itself (kind of like a .exe file, I guess?)
    I've been able to successfully create my .jar file and have been able to run it through a command prompt in Windows using the following:
    java -jar testjar.jar
    However, whenever I try to double click on the testjar in the folder it is located in, a command prompt quickly pops up and goes away. I've been able to tell I'm getting an error, mainly consisting of something along the lines of "Exception in thread "main" java.lang.NoClassDefFoundError: ...
    I'm not entirely sure what information is needed for support, but I'd be more than happy to provide what is necessary. Thanks in advance!

    I've been having a problem with a certain .jar file when I attempt to double click it. From my understanding, I was under the impression that when someone double clicks a .jar file, the contents are supposed to execute by itself (kind of like a .exe file, I guess?) Only if it has a manifest file which specifies the main class
    java -jar testjar.jar
    However, whenever I try to double click on the testjar in the folder it is located in, a command prompt quickly pops up and goes away. I've been able to tell I'm getting an error, mainly consisting of something along the What does your program do? It's possible that it runs and then closes before you can notice when you double click. It's also possible that the java version that double click is invoking is different from what you're using on the command line.

  • Can't write to file when double-clicking jar...

    This issue has me stumped. I have a jar dssetup.jar... The manifest looks like the following...
    Manifest-Version: 1.0
    Main-Class: DSsetUp
    Created-By: 1.3.0_02 (Sun Microsystems Inc.)
    I also have a text file that I read and write to(this file is outside the jar):
    datasource.txt
    If I execute my jar from the command line, I can read and write to the file...no problem. However, if I double click my jar to run it, I can read the text file but cannot write to the text file. Has anyone seen this before?
    Thanks

    It is true ..
    you can not write anything to .jar file directly..
    .jar file is not a common file, it is compressed.
    the following tool give you some cue.
    tool named JavaJar(written by java) can compress and decompress jar,war, ear and.zip...
    may download from http://www.qwerks.com/download/4114/JavaJar.zip
    the tool is very verygood tool.
    but the homepage(www.pivotonic.com) of JavaJar cannot be accessed.
    it is funny.
    good lucky.

  • Jar runs from Dos prompt, but not when double clicked.

    Hello everyone,
    My executable jar file will run fine when called from the Dos prompt like so: java -jar myJarFile.jar
    But not when I double click it. I've associated *.jar files with java.exe as suggested here on the forums but all that happens when I double click the jar file is that I get an instance of the Dos prompt that flashes up on the screen and closes immediately. Any help or suggestions would be appreciated, thank you.
    This short tutorial I found earlier may be of help to somebody.
    http://www.cs.princeton.edu/introcs/85application/jar/jar.html

    Yes Carmello, I had associated jar files via folder options in windows explorer with java.exe, now when I have the jars associated with javaw.exe as in the following:
    ACTION:
    javaw.exe -jar "%1"
    APPLICATION USED TO PERFORM ACTION:
    javaw.exe "%1"
    I get an error dialog with the title string "Java Virtual Machine Launcher" and the error message itself is "Could not find the main class. Program will exit." when I double click on the jar file. As I said in my first post the application [GUI based with around ten different forms] runs fine when called from the Dos prompt. Any idea as to what is wrong? Thanks for replying by the way.

  • Can't Double Click Jar in Fedora 2 Core

    Hi,
    Have a Jar that works in XP and was created with Ecliplse 3.
    I can double click the Jar File and it works great.
    I even compiled with Jet Excelsor to and EXE and it works great.
    Installed Java 1.4.2 SDK with Net Beans onto Fedora 2 Core OS, final release.
    Copied the Jar over using the Fat32 partition.
    I get a JAR looking ICON for the file, but double clicking on the Jar does nothing (as far as I can tell)
    When a user gets the JAR, it could be located in ANY directory.
    Anyone solve this or have this problem?
    I been looking at the JAR documention, and not finding anything that I know about that could relate.
    Thanks

    Does
    java -jar <jarfile>
    work?
    YES: Main-Class is set correctly in manifest, its just that the SDK for the Fedora 2 OS doesn't support double clicking.
    NO:
    Does
    java -cp <jarfile> <mainclass>
    work?
    YES: Main-Class is set incorrectly
    NO: Jar might be corrupted during transfer, try to unzip or unjar it.

  • When user double-clicks on a file, then I want my program to open it...

    Ok, so I have been having a lot of trouble finding the answer to what I at first thought was a simple question.
    I do not know, at all, how to make my program able to open files in the normal sense. Normal sense meaning user double-clicks my_file.xxx, or for that matter right-clicks my_file.xxx and selects open with, and then my_app.jar starts up and opens the file.
    I have already created the app, and it runs nicely. This app has a menu bar with the usual File >> Open which works just fine reading my_file.xxx. My_app.jar can also saves my_file.xxx. So I am not having trouble with I/O.
    So if someone can give me even the slightest hint in the right direction I'd be very thankful.
    p.s. I am working on a mac but my_app.jar will be running mostly on windows so cross-platform is very important.

    Actually, I was more wondering what kind of code I
    need to add to my program to make it possible at all.
    My file input and output is all done from a Utilites
    class which I made but quite obviously any OS will
    not know to call Utiities.load(...arguments...).
    But, my goal is to have my program work as seamlessly
    as possible with a normal person's desktop.I'm sorry, you're right, I completely misread your post. I would definitely take the tactic of writing a .reg file and executing it. That seems to be the accepted way of creating registry entries on Java if you have to do such a thing.
    Here is a link to the type of .reg file you're going to need to associate a file with a certain program, and you'll need to modify it slightly to do a 'java -jar myJar' type of thing. Then, just point Runtime.getRuntime().exec() at it, and you should be good to go.
    The only thing I'd be worried about is how to find the JAVA_HOME. If you launched your installer via WebStart (or had the user double-click the jar for the first time), though, you could just use
    System.getProperty("java.home");

  • Project locks up when user double clicks click box

    I have a series of practice questions in my Captivate 5 projects that use click boxes to select the question's answers.  The project pauses at the click boxes (which all appear at the same time), and a feedback caption appears.  A second later, a continue button appears.  The project again pauses until the user clicks the continue button.  Then the project goes to the next slide.  My problem is that when the user double clicks a click box,  or clicks it right when it appears (the cursor changes from arrow to a hand), the continue button does not appear.
    I am just considering deleting the continue button but my intent there was to allow as much time as the user needed to read the feedback captions after clicking the click box.  Any help on this is appreciated.
    Options selected on click box: hand cursor, and pause project until user clicks.
    Thanks.

    Actually, I was more wondering what kind of code I
    need to add to my program to make it possible at all.
    My file input and output is all done from a Utilites
    class which I made but quite obviously any OS will
    not know to call Utiities.load(...arguments...).
    But, my goal is to have my program work as seamlessly
    as possible with a normal person's desktop.I'm sorry, you're right, I completely misread your post. I would definitely take the tactic of writing a .reg file and executing it. That seems to be the accepted way of creating registry entries on Java if you have to do such a thing.
    Here is a link to the type of .reg file you're going to need to associate a file with a certain program, and you'll need to modify it slightly to do a 'java -jar myJar' type of thing. Then, just point Runtime.getRuntime().exec() at it, and you should be good to go.
    The only thing I'd be worried about is how to find the JAVA_HOME. If you launched your installer via WebStart (or had the user double-click the jar for the first time), though, you could just use
    System.getProperty("java.home");

Maybe you are looking for

  • What HD (1920x1080 )file formats can Quick Time Pro export in??

    Given an input video in .mov  Mpeg (quick time) what codec/formats can Quick Time Pro covert it to/export in ...? I have read the user manual and they are not given. I do not own the software and want to buy only if it will work for me..... thanks.. 

  • XFCE vs. Openbox for my older system

    The system in question is: PIII @ 1Ghz, w/ 512MB RAM and fbs 133MHz. (These numbers sound good, but keep in mind that it's 7-8 years old) I know that I could just as well install GNOME or KDE techincally, but they will be pokey. My questions are as f

  • STANDBY_USING_GRID

    Hi,     We plan to create standby database , i saw this doc on net : Scenarios Using Oracle Enterprise Manager is there any other document for creating STANDBY using GRID ? 1. if i create standby using GRID , what about the parameters in primary and

  • Link GR entry(ies) to IR entry on a PO

    Hi, Table EKBE shows all the GR and IR entries for a PO item but it does not link an invoice to the GRs that the invoice is posted for.  There could be multiple GRs and IRs done for the same line item, and I need to know which IRs are for which GRs. 

  • Force Pages to open Word documents...

    We just installed iWork on all of our work stations (we are an elementary school). I would like Pages to open all documents that end with the ".doc" extension. I've done this for my own work station (through "get info"). What preference do I copy to