Using a class that has a main from another class

Can I call a class that has a main from another classes public methods?

Yes, you can, although strictly speaking you won't be calling that classes "main" method, you will simply be calling and initializing the class through it's constructor, the "main" method will be ignored. If you have code inside your main method that you want executed as well consider moving it inside your constructor and simply using the "main" method as an application initializer:
public static void main( String args[] ) {
new MyClass();
This way you can use your class as an application or call it from another class and not have any duplicate code inside your "main" method and constructor. You can also take this further and have it call the applet initialization so that you can launch it any way you like, I suspect this is a bit beyond what you were asking.
Does this solve your problem?

Similar Messages

  • How can i delete a photo album that has been synced from another computer

    I am trying to delete a photo album that I do not need anymore from an iPad 4. But the album has been synced from a computer that I don't have access to anymore. Is there anyway around this ?

    Photos that were synced from a computer can only be deleted by connecting to a computer's iTunes and changing the sync selection on the device's Photos tab.
    Is that the only album that was synced from that computer (and you now sync the iPad to a different computer ?), or do you have other albums from it that you want to keep on the iPad ? If you want to keep one or more albums on it then they will need to be on the computer that you sync to so that they can be selected on the Photos tab and re-copied to the iPad from that computer. If you want to remove all synced photos then try selecting and syncing just an empty folder

  • I can't delete photos in albums that has been sent from a pc

    What is the procedure for deleting photos in albums on iPad that has been sent from another PC.

    You need to remove them the same way you put them on the iPad.
    That is by Unsyncing them in iTunes on the computer.
    You can unselect the folder you wish to remove in ITunes on the computer, or sync an empty folder to remove them all.

  • How do I make it so that the one computer that has the main itunes account on it be used on other computers, when it comes to backing up phones and not deleting data off of phone that isnt on that computer itunes becasse its all on the one main computer

    how do I make it so that the one computer that has the main itunes account on it be used on other computers, when it comes to backing up phones and not deleting data off of phone that isnt on that computer itunes becasse its all on the one main computer. Baiscally the problem is that one comuter and one account has always been sued for eey persons itunes. Now if we want to be able to backup and use itunes on our own computers fro our iphones and such, how will all he data that is on our phones not be deleted once its plugged into a new computer? Also, is theere a way to get all the stuff on thw current itunes onto each computer, via differtn account name?

    option discovered in preferences. Really this and any feature that moves deletes or edits a users data should as far as possible be OFF BY DEFAULT. It shouldn't by default and without the users specific say do this dangerous and unnecessary thing without even letting the user know what it's doing!!! And then cause me a few hours (as i'm new to mac) searching for the option so as to switch it off. If i hadn't noticed the status cage declaring that it was copying files then i might never have twigged that this insane thing was occurring. And if i hadn't of noticed i would have been left maintaining the contents of the folder i copied the files to, the folder which as far as i was informed and so believed was also the location of the music files i was playing. How does Apple justify this 'genius' piece of software non-design? Surely it will hurt no one if this was off by default for new users - overall at least i dare say it would cause a lot less distress in the future for the unsuspecting public at large. Thanks for the support.

  • "COM object that has been separated from its underlying RCW cannot be used.

    I am constantly getting the following error when closing my app if we viewed/printed a report.  What do I need to do to correct this error?  For the following error, I opened my app, viewed a report on the screen using the 'CrystalReportViewer', closed the report viewer window, closed my app.  When closing the app, the following error occurs.
    CR version: 11.5.3300.0
    VB.NET v2.
    System.Runtime.InteropServices.InvalidComObjectException was unhandled
      Message="COM object that has been separated from its underlying RCW cannot be used."
      Source="mscorlib"
      StackTrace:
           at System.Runtime.InteropServices.UCOMIConnectionPoint.Unadvise(Int32 dwCookie)
           at CrystalDecisions.ReportAppServer.%. {(_ISCDClientDocumentEvents_OnClosedEventHandler  u)
           at CrystalDecisions.ReportAppServer.%.remove_OnClosed(_ISCDClientDocumentEvents_OnClosedEventHandler value)
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.DisconnectEventRelay()
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.  (Boolean  \b, Boolean       )
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Dispose(Boolean bDisposeManaged)
           at System.ComponentModel.Component.Dispose()
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Boolean      :)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Boolean      ;)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.Close()
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.
        (Object      >, EventArgs      ?)

    Hello,
    First thing is to install Service Pack 6 which you can get from the download page by clicking on BusinessObjests tab above and then downloads on the left...
    When you close your viewer be sure to add/have Youreportobject.close and Youreportobject.Dispose. Adding a GC.Collect may help also.
    Thank you
    Don

  • I want to use icloud but i have a lot of music on itunes that has been downloaded from elsewhere on the internet. Will i be able to access this on icloud if it has not be bought through itunes?

    I want to use icloud but i have a lot of music on itunes that has been downloaded from elsewhere on the internet. Will i be able to access this on icloud if it has not be bought through itunes?

    Not on iCloud itself - what you need is 'iTunes Match' which seeks to find versions in the Store of songs you already have, and failing that allows you to upload your own copies. This will cost you $24.99 per year; it does not count towards your 5GB free iCloud space. Limit 25,000 songs (purchased songs do not count towards this limit). You will need iTunes 10.5.1 or later on your Mac or PC and iOS 5.0.1 or later on your iPhone 3GS or later, iPod touch (3rd and 4th generation), or iPad.
    Please see this page: http://www.apple.com/itunes/itunes-match/
    Also note that some people have found that when using this facility with songs which contain strong language, iTunes Match is substituting a cleaned-up version.

  • O I need Pages on my iMac in order to open a file that has been transferred from my iPad?

    Cannot open the Pages file on my computer that has been transferred from my iPad. Do I need to purchase Pages for my computer?

    I guess you could open it using the icloud version of Pages (on www.icloud.com).

  • Does tethering my iPad to my iPhone 4s use more data than using an iPad that has its own data plan?

    Does tethering my iPad to my iPhone 4s use more data than using an iPad that has it's own data plan?

    No, it won't work.. the Airports are not media devices.. they have no brains .. no media extensions.. and itunes must be running on a computer.
    You can however watch movies from storage but not with itunes..
    See how people use tools like VLC to get around Apple's built in iTunes limitations.
    http://www.videolan.org/vlc/download-ios.html
    https://itunes.apple.com/gb/app/vlc-streamer/id410031728?mt=8

  • "Attempted to use an object that has ceased to exist" error when opening list with grouping and item level permissions

    Hi All,
    I have a list with few items. If I break role inheritance for at least one item and try to open list view page, I receive this error:
    Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))
    This occurs only if view has GroupBy in query. If I remove grouping from view, then error disappears. But I need to have grouping in view as well as item level permissions.
    How can I achieve this? Is this some limitation?
    Any help will be appreciated.
    The full stacktrace:
    System.Runtime.InteropServices.COMException: Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))    
    at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListContentTypes(String bstrUrl, String bstrListName, ISPDataCallback pXMLCallback)     
    at Microsoft.SharePoint.Library.SPRequest.GetListContentTypes(String bstrUrl, String bstrListName, ISPDataCallback pXMLCallback)
    System.Runtime.InteropServices.COMException: Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED)),
    StackTrace:    
    at Microsoft.SharePoint.SPContentTypeCollection.FetchCollection(IList`1 exceptions)     
    at Microsoft.SharePoint.SPList.get_ContentTypes()     
    at Microsoft.SharePoint.SPCustomActionElement.QueryForToolbarButtons(SPWeb web, SPList list, SPListItem item, PAGETYPE pgtype)     
    at Microsoft.SharePoint.SPCustomActionElement.AddCustomToolbarButtons(SPWeb web, SPList list, SPListItem item, SPContext renderContext, PAGETYPE pgtype, ToolBar toolbarControl, WebPart webPart, Page page)     
    at Microsoft.SharePoint.WebControls.ViewToolBar.CreateChildControls()     
    at System.Web.UI.Control.EnsureChildControls()     
    at Microsoft.SharePoint.WebControls.TemplateBasedControl.OnLoad(EventArgs e)     
    at System.Web.UI.Control.LoadRecursive()     
    at System.Web.UI.Control.AddedControl(Control control, Int32 index)     
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()     
    at Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.CreateChildControls()     
    at Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls()     
    at System.Web.UI.Control.EnsureChildControls()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Control.PreRenderRecursiveInternal()     
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     
    at System.Web.UI.Page.ProcessRequest()     
    at System.Web.UI.Page.ProcessRequest(HttpContext context)     
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     
    at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     
    at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     
    at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

    Does the site use any custom code? Not necessarily the task list but can be anywhere. If yes, ensure that current context SPWeb/SPSite objects are not being disposed off.
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Is there a way to retrieve a text message that has been deleted from my iphone?

    Is there a way to retrieve a text message that has been deleted from my iphone?  I did't delete the message but after i synced my phone the message was gone.

    No, the app doesn't use Safari.  The app is AutoDesk Inventor Publisher Viewer.  I think there is a way that you can have a publish Inventor file, and if you create a correctly formatted hyperlink, you can click on it and it will immediately open the file in the viewer.
    I know that if you offer the file as a standard download, iOS will ask whether you want to open it with Inventor Pub. Viewer or save it to another app that can accept files.  I would prefer to skip the prompt, and just open the viewer.
    I've heard mention that this can be done with this application, but I can't find reference material anywhere.

  • How can I email a video in iPhoto that has been uploaded from my iPad?

    How can I email a video in iPhoto that has been uploaded from my iPad?

    It is so compliv=cated. U had yo find in troubleshootung sime ways. Then i found so many files in the profile menu that have been filed .I had to open every one to choose the right one that never found Then nothing could be done No way to revert.I had decide to uninstall the firefox Then i ttried the restore system way and it worked.
    In any case these add ons of persona are comletely silly.So many unfitting colors and no way to revert.Only to choose a different stupi d icon.Too silly for my sense of style

  • Have photoshop 6 on a dead pc laptop with windows XP.  Have a pc laptop that has been upgraded from Vista 64 bit (where photshop wouldn't install) to windows 7 professional 32 bit (clean install).  Photoshop still won't install. Also having reinstallation

    I have photoshop 6 on a dead pc laptop with windows XP.  Have a pc laptop that has been upgraded from Vista 64 bit (where phootshop 6 wouldn't install) to windows 7 professional 32 bit (clean install).  Photoshop still won't install. Also having reinstallation issues with pse6 on this same pc.  Pse6 was installed and working on vista 64bit version of the OS, now won't install on rebuilt windows professional 7 32bit (keeps giving me serial number not valid errors).  I'm not trying to pirate these programs.  Just want to reinstall them.

    you need,
    Windows 98, Windows 2000, Windows NT 4.0 with Service Pack 4, 5, or 6a, or Windows Millennium
    Microsoft Windows 98/Millennium/2000/NT 4.0 (Service Pack 4, 5, or 6a required)

  • How to check the sales order that has been PGI from a range of dates.

    Hi SAP Gurus,
    I have a query on how can I check the sales order that has been PGI from a range of dates in SAP?
    Thanks,
    Madelyn

    Dear Madelyn
    Go to VA05, give the date range and execute.  List of sale orders will be generated.  There you can see a tab "Status"  in which, the status would be like
    -  Not delivered
    -  Partially delivered
    So based on this, you can decide whether the order is still open or completed.
    thanks
    G. Lakshmipathi

  • Why does Epson app for the iphone show a folder that has been deleted from my camera roll?

    Why does the Epson app for my iphone 4 show a folder that has been deleted from my camera roll for months now?

    Thanks @pdroth. I did a quick Google search of DB indexing. I'm not sure I found exactly what you were referring to but I see where you're going with it. I can understand that indexing my database of stored photos can be time consuming. It's frustrating that the space can't be recognized as being free more quickly.
    I notice that some items I delete seem to free up the space much more quickly. Removing an app entirely or deleting from my Music generally shows up as available space in Usage pretty quickly.
    Deleting a photo or video from the Camera Roll will take MUCH longer, so I guess that has something to do with the indexing process you are referring to.
    I'd like to point out that when I run out of space on an SD card on any budget point and click digital camera that I can quickly delete a picture or two and INSTANTLY be able to take a couple of new photos in their place. I guess I just have that same expectation for the $500+ engineering marvel I have in my hand right now.
    Thanks for chiming in.

  • [svn:bz-trunk] 14804: Changed securityConstraint samples to use a channel that has login-after-disconnect =true.

    Revision: 14804
    Revision: 14804
    Author:   [email protected]
    Date:     2010-03-17 01:45:39 -0700 (Wed, 17 Mar 2010)
    Log Message:
    Changed securityConstraint samples to use a channel that has login-after-disconnect=true. Login after disconnect does not seem to work right now but at least there's a sample for it now for when it works.
    Modified Paths:
        blazeds/trunk/apps/team/WEB-INF/flex/remoting-config.xml
        blazeds/trunk/apps/team/WEB-INF/flex/services-config.xml
        blazeds/trunk/apps/team/features/security-constraints/securityConstraint_Custom.mxml

    Have you solved your problem? I think I have the same issue.

Maybe you are looking for