Autorun a program on computer startup

Hi all,
I have a doubt of how can I make a program autorun on windows startup (we'll leave Linux for later).
I have followed two ideas but in both cases I find the same problem.
- The first idea was to put an Icon on Start Menu / Programs / Startup. For this I have to search where this folder is and, to find it, I have to read the Windows registry.
- The second idea was to write directly on Windows registry so the program will start automatically on windows startup.
So to read or write the windows Registry I have to use JNIRegistry API (because Java itself has no other class to do it, instead a class that can read some certain points in the Registry that I don't need). I can import their classes (JNIRegistry) using a jar and develop with it. But a DLL it's needed too and I want to avoid them because I don't want to install DLLs on customers computers (this program is going to be distributed).
So, is there any other way to do these things avoiding the DLL thing or the need to read the Registry to find where de StartUp folder is?
Thanks in advance and if you don't understand it I'll try to explain better ;-)

Sorry, I thought that maybe it was not a especifically Swing thing and I have copied it here.
Delete it if you find it repetitive.

Similar Messages

  • Starting Program on Computer Startup

    I have an executable LabView program that I would like to start running automatically when the computer is started. How can I do this? Thanks for the help.

    In order to answer your question a few more details are needed. What is your OS? Are you using some flavor of Windows or some other OS? If Windows then you can start the program at login by including a shortcut in the Startup folder. You can access this by right clicking on the start button and clicking open and then going to the startup folder (which will probably be under the programs folder). Depending on the flavor of Windows you may be able to set the program to start for some users and not for others or to start for all users.

  • Office 2010 setup thru computer startup script

    I am trying to install Office 2010 (sp2 seperate in the updates folder) thru group policy startup script and configured with OCT .msp file. Also try to start Access Runtime 2010 with SP2 update in the updates folder.
    In group policy set run scripts asynchronisely disabled and run scripts visible enabled otherwise i could not see what the system was doiing also not when configiguring OCT with full display. The gpo settings lets the screens show during install so the user
    can see what happens.
    There is another problem that rises however: I have made 2 batchfiles and both are starting as a computer startup script in seperate gpo's (that is in another post). First the Accessruntime is installing, after that Office 2010 is running. Both are installed
    after login but only one of the 2 have SP2 installed (7015) in this case Accessruntime has it. When i run only the Office 2010 install and not the Accesruntime 2010 then Office 2010 standard has also SP2 installed (version 7015). When running both only Runtime
    has this sp2 and Office has 4763 this is without sp2 i believe.
    In both folders (Office en Runtime) are the update files .msp in the updates folder of the installation, so thats ok.
    Why is only 1 of the 2 installing the SP2 when running both?
    A second thing is when restarting the system and before the login screen appears a message: Upgradepatch cannot be installed by Windows installer becasue the upgraded program does not excist of the upgradepatch is not suitable for this program?
    Here is part of the batchfile:
    IF EXIST "c:\program files\Microsoft Office\Office14\WINWORD.EXE" (goto mkfile) ELSE (goto DeployOffice)
    :mkfile
    ECHO Office 2010 is reeds geinstalleerd>c:\temp\office.txt
    goto end
    :DeployOffice
    call cscript \\sharename\office2010\Offscrub03.vbs ALL /bypass 1 /q /s /NoCancel
    start /wait %DeployServer%\setup.exe /adminfile %DeployServer%\officeconfig.msp
    echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
    Another batchfile
    start \\sharename\accessruntime2010\setup.exe /config \\share\accessruntime2010\config.xml
    REM echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
    freddie
    after installing both runtime and office both have SP2 in updates folder:
    runtime 4763
    Office 2010: 7015
    So in this example runtme is installed without the SP2. installing runtime alone gives with SP2...
    The message is gone. There was a other policy inherited from above that caused the message. The only problem now is that when installing both, runtime 2010 with SP2 files and Office 2010 with SP2 files, then one of the two don't get the Sp2 installed, why
    is that?

    > In the bat file, I have a line that records if the install completes
    > successfully or failed.  I don't have any other logging in my
    > script.  Are you referring to something like GPO logging? I know that
    > the script runs because when I am looking at one of the PCs, I can
    So it is NOT GP related but rather your script fails?!? Put some "echo
    %~n0 %date% %time%>>Log-File-Of-Your-Choice.txt" in it to check what's
    going on. And put ">>Log-File-Of-Your-Choice.txt 2>&1" at the end of
    critical commands to capture their output.
    > I ran the gpresult /h command which shows all User Configuration
    > policies, but NOTHING appears under the Computer Configuration section.
    Admin commandline? If not, you don't see computer settings :)
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))
    Martin,
    I still did not figure out why the installation script did not work for some of the PCs, even though the PCs have the same image.  For the ones that don't work, I will install manually.  Can you please look at the screenshots of the GPO
    settings I am using, and let me know if there is any settings that I need to remove or add?
      Thanks

  • HT201272 How do I download purchased movies from Apple TV to iTunes program on computer.

    How do I download purchased movies from Apple TV to iTunes program on computer.

    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option from the Quick Links section in the top right corner of the iTunes homepage in your iTunes application on your computer.

  • Trivial program flickers on startup.

    The following program flickers on startup - the field is sometimes displayed, then erased, then displayed again.
    From the output to the error stream, it appears that the field is being painted, before the frame has even been. It's not surprising then that it gets erased when the frame is painted for the first time. This happens after the frame is made visible.
    Indeed. I've got around it with a hack which consists of having JTextField's paint method ignore the request if the frame hasn't been painted.
    But why does this happen?
    import javax.swing.*;
    import java.awt.Container;
    import java.awt.Graphics;
    public class Flicker implements Runnable {
         public static void main(String args[]) {
              SwingUtilities.invokeLater(new Flicker());
         public void run() {
              JFrame jf = new MyFrame();
              jf.setSize(800, 800);
              Container jfcp = jf.getContentPane();
              jfcp.setLayout(null);
              JComponent jtf = new MyTextField();
              jtf.setLocation(500, 500);
              jtf.setSize(jtf.getPreferredSize());
              jfcp.add(jtf);
              jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              System.err.println("Setting frame visible");
              jf.setVisible(true);
         class MyTextField extends JTextField {
              @Override
              public void paint(Graphics g) {
                   System.err.println("JTextField paint called");
                   super.paint(g);
              MyTextField() {
                   super("Field text");
         class MyFrame extends JFrame {
              public void paint(Graphics g) {
                   System.err.println("JFrame paint called");
                   super.paint(g);
              public void update(Graphics g) {
                   System.err.println("JFrame update called");
                   super.update(g);
    }

    OK, FWIW, what I've surmised is this. When the JFrame is set visible, a PaintEvent is posted to the event queue. Then, when the swing component's repaint methods are called, the RepaintManager posts an InvocationEvent to run some code that will call the components' paint(Graphics) methods.
    The problem is that InvocationEvent events have a higher priority than PaintEvent events, so when the code constructing the component graph completes, the first event that gets dispatched is the one for the RepaintManager, which accordingly paints the components. Then finally the paint event is dispatched, and the frame paints itself and its children.
    A workaround, of sorts, is to set the frame visible as soon as it has been constructed and had its size and position set, and then to defer the rest of the code to a point after the PaintEvent is dispatched. This can be done using an AwtEventListener, as shown below. The major downside is that adding such a listener may be prevented by a SecurityManager.
    It becomes more fun when a layout manager is used for the frame, because it cannot be sized until all its descendant components have been added. The best I can think of is to add them all, pack the frame, then remove them again (or just their common ancestor), set the frame visible, and again wait for the paint event before adding them back.
    I can only assume that everyone out there is using such fast machines that the flicker is not visible.
    Sylvia.
    import javax.swing.*;
    import java.awt.AWTEvent;
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.Toolkit;
    import java.awt.Component;
    import java.awt.event.AWTEventListener;
    import java.awt.event.PaintEvent;
    public class Flicker implements Runnable {
         public static void main(String args[]) {
              SwingUtilities.invokeLater(new Flicker());
         public void run() {
              final JFrame jf = new MyFrame();
              jf.setSize(800, 800);
              jf.setVisible(true);
              new MyAwtEventListener(jf, new Runnable() {
                   public void run() {
                        secondPart(jf);
         private void secondPart(JFrame jf) {
              Container jfcp = jf.getContentPane();
              jfcp.setLayout(null);
              JComponent jtf = new MyTextField();
              jtf.setLocation(500, 500);
              jtf.setSize(jtf.getPreferredSize());
              jfcp.add(jtf);
              jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              System.err.println("Setting frame visible");
              jf.setVisible(true);
         static class MyAwtEventListener implements AWTEventListener {
              private final Runnable runnable;
              private final Component component;
              MyAwtEventListener(Component component, Runnable runnable) {
                   this.runnable = runnable;
                   this.component = component;
                   Toolkit.getDefaultToolkit().addAWTEventListener(this, PaintEvent.PAINT_EVENT_MASK);
              public void eventDispatched(AWTEvent event) {
                   if(event.getID() == PaintEvent.PAINT && event.getSource() == component) {
                        Toolkit.getDefaultToolkit().removeAWTEventListener(this);
                        SwingUtilities.invokeLater(runnable);
         class MyTextField extends JTextField {
              @Override
              public void paint(Graphics g) {
                   System.err.println("JTextField paint called");
                   super.paint(g);
              MyTextField() {
                   super("Field text");
         class MyFrame extends JFrame {
              public void paint(Graphics g) {
                   System.err.println("JFrame paint called");
              public void update(Graphics g) {
                   System.err.println("JFrame update called");
                   super.update(g);
    }

  • Group Policy - Computer Startup Scripts - Add/Set Default printer

    Good Morning.
    Let's say we have 2 offices, A and B, and only 1 user.  The user is using Roaming Profiles.  Each office has its own printer.
    What I am trying to do, is make a Startup script that is specific to the COMPUTER being logged into so when any user logs into that computer, they get the printer in that office defined and set as default.
    I am able to do this successfully with my script but ONLY if i have the script be on the USER side of GP (i.e. in the Logon script section)
    That is great that that is working however, when my user goes to Office B, they still get mapped to Office A's printer if I use that method.
    So I figured I could just modify my GP and run the same script from the STARTUP section of the computer, rather than the LOGON section of the user.  It does not work.
    Here is my script:
    Set WRFCUNetwork = CreateObject("Wscript.Network")
    PrinterPath = "\\fileserver\MAINTELLER"
    PrinterDriver = "PrinterDriver"
    WRFCUNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
    WRFCUNetwork.SetDefaultPrinter "\\fileserver\MAINTELLER"
    This is where I Have the script placed:
         Computer Configuration -> Windows Settings -> Scripts(Startup/Shutdown)
    Once i'm in there, I double click Startup, click Add, and select my script which is named:
         MainPrinterSetup.vbs
    I have this GP applied to ONE OU, and that OU has ONE computer in it (my test computer)
    I login with a brand new user called "testuser" (creative, huh?) and basically nothing happens
    except they log in and have some Microsoft Document Image Writer printer set as default (which by the way sure does slow the PC down to the point of it almost being broke if anyone actually tries to print to that by accident)
    No Main Teller Printer, no anything.
    The strangest part about this is, if i apply this script to the user LOGON scripts, it works fine, the printer is there, and is set as default. (but see above why that wont work for my situation)
    So obviously the script works fine, but I guess i'm missing something when it comes to applying GP's to Computers rather than Users.
    Can anyone shed some light as to why the script is not running (i'm guessing the script isn't even attempting to run, rather than failing, but i have no way to know that)
    Thank you in advance!!
    Derek Conlon
    Network Administrator
    WRFCU
    EDIT:  Here are the PC's info that i'm working on:
         Server:  Windows Server 2003 Standard Edition (where my GP's are created and managed with AD)
         Target PC:  Windows XP Professional SP3
    EDIT #2:  I manually navigated to the Script file after logging in and "opened" it and it added and set the default printer no problem.  the issue is definately with the script running at startup.

    I wanted to clarify a few things:
    1. While it is true that printer connections are usually per user, it is definitely possible to create "global printers".  There are a number of ways to do this, but two methods that come to mind are using:
    a. "Rundll32 printui.dll,PrintUIEntry" option with the "/ga" switch.  The "/ga" switch is the key here since it allows you to deploy printers "per machine" instead of "per user".  More information
    about this is available at:
    http://members.shaw.ca/bsanders/NetPrinterAllUsers.htm
    http://technet.microsoft.com/en-us/library/ee624057%28WS.10%29.aspx
    http://www.computerperformance.co.uk/Logon/logon_printer_computer.htm
    http://www.robvanderwoude.com/2kprintcontrol.php
    b. The Print Management console that is available in Windows 2003 R2 and higher can help you deploy printers "per machine" in addition to "per user".  More information about this is available at:
    http://www.czsolution.com/print-management/print-management/print-management-console.htm#DeployingPrintersByGroupPolicy
    http://technet.microsoft.com/en-us/library/cc753109%28WS.10%29.aspx
    2. As Guy mentioned, Group Policy Preferences can help set the default printer.  But there is another way to accomplish this.  The problem with the computer startup portion is that it runs before the user logs in.  And applying this script
    in the login script section would not work per computer unless you used loopback processing.  So another way to do this is to place a script that sets the default printer into the "All Users" startup folder.  Items in the "All Users"
    startup folder run for any user that logs into the computer, but it runs in the user's context.  So, this script would effectively set the default printer on a "per machine" basis.  The script method is a cruder way to approach the problem,
    but it will help get the job done.  Here are some resources on setting the default printer via script:
    http://www.intelliadmin.com/index.php/2007/08/set-default-printer-from-a-script
    http://www.computerperformance.co.uk/ezine/ezine17.htm

  • 2008 Mac Pro 10.5.8 shuts down after hours of no use, Set to never shut down. Can be resumed pressing any key but all programs not in startup list need to be restarted and unsaved data lost .   New behavior.  No system changes.

    2008 Mac Pro 10.5.8 shuts down after hours of no use, Set to never shut down. Can be resumed pressing any key but all programs not in startup list need to be restarted and unsaved data lost .   New behavior.  No system changes.

    2008 Mac Pro 10.5.8 shuts down after hours of no use, Set to never shut down. Can be resumed pressing any key but all programs not in startup list need to be restarted and unsaved data lost .   New behavior.  No system changes.

  • QuickTime opens at computer startup

    I've tried the Preferences and the QT Preferences and it's really starting to P me Off.
    I DON'T WANT QT to start up on it's own on computer startup
    I have Pro, Perian and flip4mac ... is the problem with them???

    Preferences, users, login items, minus sign after selecting QT.

  • How do I stop Firefox launching at computer startup?

    How do I stop Firefox launching at computer startup?
    ''Duplicate post, continue [https://support.mozilla.com/en-US/questions/746670 here]''

    Firefox has no option to launch at startup, it will be an operating system setting that is launching Firefox.
    # Log in as the user who wishes to have a login item or as an admin user.
    # Choose System Preferences from the Apple menu.
    # Choose Accounts from the View menu.
    # Click the name of the user.
    # Click the Login Items button
    # Select Firefox in the list of startup items.
    # Stop Firefox launching at startup by clicking on the minus sign.

  • Every time my wife logs in and uses her email (os included mail program) the computer freezes and causes corruption of the hard drive. What can I do to remedy this problem

    Every time my wife logs in and uses her email (os included mail program) the computer freezes and causes corruption of the hard drive. What can I do to remedy this problem?

    Every time my wife logs in and uses her email (os included mail program) the computer freezes and causes corruption of the hard drive. What can I do to remedy this problem?

  • OS X - on startup iphoto and excel start up casuing delays. How do I control programs at upon startup

    OS X - on startup iphoto and excel start up causing delays. How do I control programs at upon startup
    Thanks for any assistance.

    sys / prefs /users and groups. if iphoto and excel are present in the login items then simply check the sidebar as to prevent them starting up.
    if they are not simply add them and do the above.

  • Gpo computer startup scripts not running

    Hi,
    I´m making some test with a windows 7 pro 64 bit computer and a 2008 r2 domain controller where I have created a computer startup script. I give you more info:
    Domain functional level: 2008 R2
    DC: 2008 R2
    Client: Windows 7 pro x64
    Gpo: Computer configuration -> Windows configuration -> Script -> Startup
    Type of script: bat file copied on \\domain_name\SysVol\domain_name\Policies\{461E688A-E8F8-4C9B-8419-FE83DCDD4C26}\Machine\Scripts\Startup
    The windows 7 machine is full updated, windows firewall disabled, uac disabled, windows defender disabled.
    The bat file works and the gpo is applying, i have seen it via gpresult, another gpo which is in a top level works fine.
    I need some help please, because I don´t know what to try.
    Thanks in advance.

    Hello Egoitz28,
    Do you mean that you add the bat file in the startup group policy and gpresult shows that it is applied, but the bat is not run?
    Please share us the bat file to test.
    Logon/Logoff scripts could only be applied to users, whereas Start-up/Shutdown scripts applies to computers.
    I create a test.bat start %windir%\system32\notepad.exe, and add it to the User Configuration->Policies->windows Settings->Scripts->Logon in the Default domain policy. And it works.
    If I create in the startup policy in Computer configuration, I can see it in the gpresult, but it doesn’t work.
    Please test if the bat works in the Logon policy.
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • Why is Explorer.exe reading my program files at startup?

    Every time I boot my computer, if I open Resource Monitor, I will inevitably find, under the "Disk Activity" section, the process explorer.exe "reading" my program files.
    When I say "program files", I mean the executable files for applications stored in the "C:\Program Files (x86)" or the "C:\Program Files" directories.
    Other files seem to get "read" a lot too. PNF files for example.
    I have indexing turned OFF on all drives, and yet the process SearchIndexer.exe is almost always running too.

    Hi,
    Firstly, did you installed MSE in your system, this phenomenon can be caused by MSE security scanning disk.
    Secondly, this problem can also be caused by 3rd program, it would be better to use AutoRuns to check system startup items if there is any 3rd process or dll file start with system.
    AutoRuns:http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx
    Roger Lu
    TechNet Community Support

  • Running java program at windows startup

    I need to run java program at startup and then it will continue to run in its own thread.
    Any body having idea how to do that programmatically?
    Zeeshan

    This is one option but this is not feasible in my scenario as this application will be running over a network which involves hundreds of computer so is there any way to do it programatically?
    I mean if I can load java class file through an exe file then I can load my class file in the startup using C++.
    Any Suggestions.
    thanks for the help
    regards,
    Zeeshan

  • Prevent elevation message for some programs at windows startup

    Hi
    I'm using Windows 8.1 in a 2012 R2 Domain.
    When my main computer starts, 3 Programs require elevation to run.
    When I logon my adminstrator account I know the password but for my non administrator user, it's an issue.
    Is it possible to setup startup of those programs to run without elevation or to type the password once for all lauches ?
    Thanks for your answers,
    Laurent

    Hi,
    In this situation, it means when you want to run this kind of applications, you need the administrative token, basically, this is designed by the application provider:
    Running with Administrator Privileges
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms717801(v=vs.85).aspx
    Alex Zhao
    TechNet Community Support

Maybe you are looking for