Can you only run one main() in a jar?

Hi,
I was just wondering if you can only ever run one main() method from a .jar file? I have a project being developed in Eclipse, consisting of several packages and then several classes with main()s in each of the packages. When the whole project is packaged into one big jar then I can run one of the main() methods by specifying it in the manifest, but as far as I'm aware I can't access the others.
Is there some cunning way to call the main() method of a different class to that specified in the jar manifest, or do I have to compile every class as a separate jar? And if that's the case, is there really any advantage to putting the classes into a jar as opposed to just running from the .class files?
Any help much appreciated. :)
h

Wow, thanks for the quick responses guys!
You can execute the other main methods byexecuting:
java -cp the-class-path TheMainClassIsn't that just what I'd use from the compiled .class
files though?Correct, but you specify the jar on your classpath. e.g.
java -cp myjar.jar TheMainClasss1 or
java -cp myjar.jar TheMainClasss2
For example:
java -cp the-class-path my.class1
java -cp the-class-path my.class2
How does this relate to a single .jar file containing
both of those classes? See above
If I try those commands in the
directory containing the .jar file, I just get a
NoClassDefFoundError (they work fine in the directory
with the .class files though).That's because you didn't specify the classpath in the correct way.
Kaj

Similar Messages

  • Can you only download one song at a time or is there a way to select an artist or playlist?

    Foolish me, I loaded EVERYTHING I own onto my iTunes library - about 40 gig.  Problem is I have a 32 gig iPad (v1 - don't laugh, it still works fine).  Now I need to be selective in loading music only it.  I travel a lot on airplanes and want my iPad for music and movies.
    From what I can see, you are only offered the download icon next to individual songs, not on playlists or artist's names.
    One other thing for you experts, is it possible on the iPad to see playlists and artist configuration as a list, rather than icons?  I am much better at organizing via lists than icons.

    You should see a Download All icon at the bottom of your playlists, and also see a download icon to the right of the Artist name at the top.
    AFIK you cannot view Artists or Playlists as lists on an iPad.

  • Can you only check one Exchange account using Mail?

    I use Mail to check multiple e-mail accounts - one IMAP, three POP, and one Exchange. All work great.
    I have an additional Exchange account that I would like to check and when I go to setup the account in Mail, it only lists POP or IMAP as the choices, whereas when I set up the last Exchange account, that was an option on the list. What happened to that choice? Does Mail only allow you to set up one Exchange account? I could not find any notes to this effect in the help, so I'm really confused.
    Thanks in advance for any clarification you might have.

    Spent a lot of frustrated time with my IT guys on this one. There are two equally frustrating solutions available.
    First solution is to access one of the Exchange accounts via IMAP, but the Exchange admins need to configure the server to allow that on their side and may not want to for security reasons.
    Second solution is to create a second user account for the second exchange account. Not elegant by any means.
    Barring that, you can always access the additional account vie webmail, or by installing Entourage.

  • Can you only upgrade one phone on a family plan?

    My Verizon wireless contract just expired this month and I am looking for a new phone. Currently I do not have a smartphone and neither does my brother, who shares this family plan with me. He has decided waht phone he wants, but I'm still deciding between a Droid 3 and waiting for the Droid Bionic. My question is, can I sign up for a new 2-year contract now and he upgrades his phone but I keep my phone until the Droid Bionic comes out? Will I be able to do this and get the Bionic at promotional 2-year contract pricing?

    Each line on your Family Share plan has its own contract.  That means you can upgrade them independently of each other, but if you choose to upgrade them at different times, they will have different contract end dates (which might be a consideration in the future if you wind up looking to switch carriers for whatever reason).  Also, you're only able to take advantage of Buy-One Get-One offers if you have at least two lines available to upgrade.
    You can certainly upgrade your brother's line now and your line later, as long as you are OK with the two lines having different contract end dates.

  • Can you only put one Field in a mailDoc subject line?

    Hi folks,
    Have set up a mailDoc submit button using the tutorial that has been linked to in a few different discussions on here (the "Benny" one, you know what I mean?).
    Anyway, trying to set up a custom subject line, all good until I try to pull information from more than one text box. Is it not possible, or am I just doing the wrong thing?
    So far I have this, which works fine but I want to add "Field 1" directly after Field 2?
    // Set the subject and body text for the email message
    var cSubLine = "Form for " + this.getField("Field 2") .value
    Also, how to I put more of my own wording in bewteen the get.Fields? For example I would like the subject to say something like "Form completed by <Field 30> for <Field 2> <Field 1>"?
    I swear I am going to start dreaming about javascript, it's all I've been doing for the past week!

    It could be something like:
    var cSubLine = "Form completed by " + getField("Field 30").valueAsString + " for " + getField("Field 2").valueAsString + " " + getField("Field 1").valueAsString;

  • Can you only make one file InContext Editable?

    I have a site, and would like to make different people responsible for certain pages - but only "their" pages.  Example: Pastor gets his sermon page, secretary gets her calendar, etc.
    Is this possible?

    I think we should put together a "web designers for churches" user group of some kind!
    Mostly, my web savvy and design is a donation to my own congregation. Infrequently, I am able to be paid for the original design of a site for another congregation, and at off-prices, at that, knowing church budgets.
    But in truth, perhaps we are seeing a new category here, and one to pay attention to, I think...the smaller non-profit sector.
    Z

  • I have both a 1st generation AppleTV and 2nd Generation AppleTV, and my iTunes seems to only recognize one at a time - has anyone else had this problem - can you only use one at a time?

    Is this a design flaw?  Since the 1st Generation has a hard drive (140GB).  If both are on, only the 1st Gen get recognized. I would think you could use both at the same time.....  Help!

    Welcome to the Apple Community.
    Yes iTunes should work with them all together. Do they have different names, are they on the same network, have you noticed any other problems.

  • When using FMIS v4, can you only use one multi-rate file?

    I am planning to upgrade to FMIS v4.  Currently, I am
    using v2 and encoding separate files for each bit-rate (
    i.e. 100K. 400K, 700K).  Can I encode all audiences to one file like Windows Media P
    layer,have FMIS stream that file, and have the local Flash Player detect the correct version and stream it?
    Michael

    No.  Dynamic Streaming requires a separate file encoded to the desired bitrate.

  • I uninstalled Firefox once, reinstalled it and it ran. I had a problem so I did it again. Now it will not run and I get an error message saying that firefox is running and you can only run one at a time. I can't figure out what is running.

    Because of a problem, I uninstalled Firefox once, reinstalled it and it ran. I had a problem so I uninstalled/reinstalled it again. Now it will not run. I get an error message saying that firefox is running and you can only run one at a time. I have uninstalled multiple times and can't figure out what is running. The is only one Firefox installed and it is not open. What does this mean and how do I fix it?

    If you use ZoneAlarm Extreme Security then try to disable Virtualization.
    *http://kb.mozillazine.org/Browser_will_not_start_up#XULRunner_error_after_an_update
    See also:
    *[[/questions/880050]]

  • Ever since the systyem upgraded me to 3.6.6. I can not even run one eight hour day without firefoc either crashing or locking up which requires me use C/A/Deleate to close the program. I used to be able to run 8 to 12 windows at a time and NEVER lock up

    Ever since the systyem upgraded me to 3.6.6. I can not even run one eight hour day without firefoc either crashing or locking up which requires me use C/A/Deleate to close the program. I used to be able to run 8 to 12 windows at a time and NEVER lock up or crash with the older version. Is this problem being looked into and or being corrected. I use Firefox with Google and my system is XP Pro 32 bit. THIS IS REALLY making me MAD. My email is [email protected] and would appreciate a response to this ASAP. I have tried a couple of items from your help section and nothing works.

    <u>'''Anonymous'''</u>
    Please post a separate question. Thank you. https://support.mozilla.com/tiki-ask_a_question.php?locale=en-US&forumId=1
    <u>'''chris'''</u>
    <u>'''''Crashing'''''</u>
    See:
    http://support.mozilla.com/en-US/kb/Firefox+crashes
    http://kb.mozillazine.org/Firefox_crashes
    http://support.mozilla.com/en-US/kb/Firefox+crashes+when+loading+certain+pages
    http://support.mozilla.com/en-US/kb/Firefox+crashes+when+you+open+it
    http://support.mozilla.com/en-US/kb/Firefox+will+not+start
    http://kb.mozillazine.org/Browser_will_not_start_up
    ''<u>'''Hanging'''</u>''
    See: http://support.mozilla.com/en-US/kb/Firefox+hangs
    <u>'''''Hanging at exit'''''</u>
    <u>'''Kill Application'''</u>
    In Task Manager, does firefox.exe show in the <u>'''Processes'''</u> tab?
    See: [http://kb.mozillazine.org/Kill_application Kill Application]
    '''<u>Causes and solutions for Firefox hanging at exit:</u>'''
    [[Firefox hangs]]
    [http://kb.mozillazine.org/Firefox_hangs#Hang_at_exit Firefox hangs at exit]
    [[Firefox is already running but is not responding]]
    ''<u>'''Safe Mode'''</u>''
    You may need to use '''[[Safe Mode]]''' (click on "Safe Mode" and read) to localize the problem. Firefox Safe Mode is a diagnostic mode that disables Extensions and some other features of Firefox. If you are using a theme, switch to the DEFAULT theme: Tools > Add-ons > Themes <u>'''before'''</u> starting Safe Mode. When entering Safe Mode, do not check any items on the entry window, just click "Continue in Safe Mode". Test to see if the problem you are experiencing is corrected.
    See:
    '''[[Troubleshooting extensions and themes]]'''
    '''[[Troubleshooting plugins]]'''
    '''[[Basic Troubleshooting]]'''
    If the problem does not occur in Safe-mode then disable all of your Extensions and Plug-ins and then try to find which is causing it by enabling <u>'''one at a time'''</u> until the problem reappears. <u>'''You MUST close and restart Firefox after EACH change'''</u> via File > Restart Firefox (on Mac: Firefox > Quit). You can use "Disable all add-ons" on the Safe mode start window.
    <u>'''chris'''</u>
    <u>'''''Other Issues'''''</u>: ~~red:You have installed plug-ins with known security issues. You should update them immediately.~~
    <u>'''Update Java'''</u>: your ver. 1.6.0.~~red:17~~; current ver. 1.6.0.20 (<u>important security update 04-15-2010</u>)
    (Firefox 3.6 and above requires Java 1.6.0.10 or higher; see: http://support.mozilla.com/en-US/kb/Java-related+issues#Java_does_not_work_in_Firefox_3_6 )
    ''(Windows users: Do the manual update; very easy.)''
    ~~red:Check your version here~~: http://www.mozilla.com/en-US/plugincheck/
    See: '''[http://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox#Updates Updating Java]'''
    Do the update with Firefox closed.
    <u>'''NOTE:'''</u> Java version 1.6.0.21 has been released. It is mainly an update for developers of Java applications and most users do not need to be concerned about downloading version 1.6.0.21. <u>'''''At this time'''''</u>, the update option in existing installations of Java 1.6.0.20 are not updating to version 1.6.0.21; <u>'''''at this time'''''</u>, it must be manually downloaded and installed. According to the Java release notes:
    ''"'''Bug Fixes'''''
    ''Java SE 6 Update 21 does not contain any additional fixes for security vulnerabilities to its previous release, Java SE 6 Update 20. Users who have Java SE 6 Update 20 have the latest security fixes and do not need to upgrade to this release to be current on security fixes."'' Source: http://java.sun.com/javase/6/webnotes/6u21.html
    <u>'''Install/Update Adobe Flash Player for Firefox (aka Shockwave Flash)'''</u>: your ver. 10.0 r~~red:45~~; current ver. 10.1 r53 ('''important security update 2010-06-10'''; see: http://www.adobe.com/support/security/bulletins/apsb10-14.html)
    ~~red:Check your version here~~: http://www.mozilla.com/en-US/plugincheck/
    See: '''[http://support.mozilla.com/en-US/kb/Managing+the+Flash+plugin#Updating_Flash Updating Flash]'''
    -'''<u>use Firefox to download</u>''' and <u>'''SAVE to your hard drive'''</u> (save to Desktop for easy access)
    -exit Firefox (File > Exit)
    -''<u>In Windows,</u>'' check to see that Firefox is completely closed (''Ctrl+Alt+Del, choose Task Manager, click Processes tab, if "firefox.exe" is on the list, right-click "firefox.exe" and choose End process, close the Task Manager window'')
    -''<u>In Windows,</u>'' double-click on the Adobe Flash installer you just downloaded to install/update Adobe Flash
    -when the Flash installation is complete, start Firefox, and test the Flash installation here: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15507&sliceId=1
    *<u>'''NOTE: On Vista and Windows 7'''</u> you may need to run the plugin installer as Administrator by starting the installer via the right-click context menu if you do not get an UAC prompt to ask for permission to continue (i.e nothing seems to happen). See this: http://vistasupport.mvps.org/run_as_administrator.htm
    *'''<u>NOTE for IE:</u>''' Firefox and most other browsers use a Plugin. IE uses an ActiveX version of Flash. To install/update the IE ActiveX Adobe Flash Player, same instructions as above, except use IE to download the ActiveX Flash installer. See: [[ActiveX]]
    *Also see: http://kb.mozillazine.org/Flash ~~red:'''''AND'''''~~ [[How do I edit options to add Adobe to the list of allowed sites]]
    <u>'''Update Shockwave for Director (aka Shockwave Player)'''</u>: your ver. ~~red:10.1 (very old)~~; current ver. 11.5.7.609 (<u>important security update released 2010-05-11</u>; see http://www.adobe.com/support/security/bulletins/apsb10-12.html)
    NOTE: this is not the same as Shockwave Flash; this installs the Shockwave Player.
    ~~red:Check your version here~~: http://www.mozilla.com/en-US/plugincheck/
    SAVE the installer to your hard drive (Desktop is a good place so you can find it). When the download is complete, exit Firefox (File > Exit), locate and double-click in the installer you just downloaded, let the install complete.
    See: '''[http://support.mozilla.com/en-US/kb/Using+the+Shockwave+plugin+with+Firefox#_Installing_Shockwave Installing Shockwave]'''
    <u>'''You '''</u>~~red:<u>'''MAY'''</u>~~<u>''' need to Update Adobe Reader for Firefox (aka Adobe PDF Plug-In For Firefox)'''</u>: your ver. N/A; current ver. 9.3.3 (important security update release 06-29-2010; see: http://www.adobe.com/support/security/bulletins/apsb10-15.html)
    ~~red:Check your version here~~: http://www.mozilla.com/en-US/plugincheck/
    See: http://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox#Installing_and_updating_Adobe_Reader
    ''<u>You may be able to update from the Adobe Reader installed on your system</u>'' instead of going to the Adobe site and downloading. Open the Adobe Reader installed on your system (''in Windows, Start > Program Files, find and click Adobe Reader to open''), click Help, click Check for Updates.
    ''<u>If you go to the Adobe site to download the current Adobe Reader:</u>''
    -'''<u>use Firefox to download</u>''' and <u>'''SAVE to your hard drive'''</u> (save to Desktop for easy access)
    ~~red:-See the images at the bottom left of this post to see the steps to take on the Adobe site~~
    -exit Firefox (File > Exit)
    -In Windows: check to see that Firefox is completely closed (''Ctrl+Alt+Del, choose Task Manager, click Processes tab, if "firefox.exe" is on the list, right-click "firefox.exe" and choose End process, close the Task Manager window'')
    -In Windows: double-click on the Adobe Reader installer you just downloaded to install/update Adobe Reader
    *<u>'''NOTE: On Vista and Windows 7'''</u> you may need to run the plugin installer as Administrator by starting the installer via the right-click context menu if you do not get an UAC prompt to ask for permission to continue (i.e nothing seems to happen). See this: http://vistasupport.mvps.org/run_as_administrator.htm
    *'''<u>NOTE for IE:</u>''' Firefox and most other browsers use a Plugin. IE uses an ActiveX version. To install/update the IE ActiveX version, same instructions as above, except use IE to download the ActiveX installer. See: [[ActiveX]]
    *Also see: http://kb.mozillazine.org/Adobe_Reader ~~red:'''''AND'''''~~ [[How do I edit options to add Adobe to the list of allowed sites]]

  • I'm buying a new MAC.  How many machines can you associate with one CS Cloud account?

    I'm buying a new MAC.  How many machines can you associate with one CS Cloud account?

    You can install the software on as many computers as you like.
    However you can only activate the software and use it on a maximum of two computers at any one time.

  • I currently have a mini ipod but hubby is buying me a ipod touch for my birthday soon.  Will I be able to use my current itunes library and transfer all my songs to the ipod touch?  Or can I only have one ipod attached to the library?

    I currently have a mini ipod but hubby is buying me a ipod touch for my birthday soon.  Will I be able to use my current itunes library and transfer all my songs to the ipod touch?  Or can I only have one ipod attached to one library?

    You can transfer all your songs.
    http://support.apple.com/kb/HT1495

  • Why can I only add one app in passbook?

    Why can I only add one app (Starbucks) in Passbook? 

    You can add many passes to Passbook, what makes you think you can only add one?
    Check out http://support.apple.com/kb/HT5483.

  • Using Sansung S3, not yet possible to share all the open tabs (using NFC) with another NFC phone. But only the one main tab I am currently browsing is possible.

    Using Sansung S3, Android 4.1.2, Firefox 24.0; not yet possible to share all the open tabs (using NFC) with another NFC phone. But only the one main tab I am currently browsing is possible to share. Is this the feature of current NFC feature of Firefox?
    If so, when will there be feature to share all the tabs?
    Thanks.

    I'm not sure if we will implement this. Sharing all the tabs you have open have many more security and privacy issues. Someone forgets that they had a tab open they did not want to share or miss-clicks on the share all option.
    We are looking into better ways to share tabs with devices that are nearby. Especially if they are on the same WiFi network.

  • How many iPads can you setup on one iTunes account for a school?

    How many iPads can you setup on one iTunes account for a school?
    What is the best system?  We have 30 iPads.

    That would be fine.

Maybe you are looking for