Run my java app (System Tray) when Windows starts - java

I have searched on the net, but I have not found anything for my case.
I have created an application, that shows only in the SystemTray (icon) when you start. I want to run the jar file or the exe automatically when windows starts.
I would like to do this via code or automatically directly from my app. A menu item (for example) that the user could click on that option, if desired. I searched the internet but have not found anything.
Thank you in advance
Thank you very much
Only code Java or Bat

I think you can register your application as a system service, set the starttype auto start

Follow the below steps for windows 7
1)Click the Start windows button , click All Programs, right-click the Startup folder, and then click Open.
2) Open the location that contains the item you want to create a shortcut to.
3) Right-click the item, and then click Create Shortcut. The new shortcut appears in the same location as the original item.
4) Drag the shortcut into the Startup folder.
The next time you start Windows, the program will run automatically.
I got from this link

Related

How to add "About" tab on Mac

On a Mac, there is a button on the screen menu bar that is the name of an application. For example, for terminal, there is a button at the top of the screen labeled Terminal. When you click it, there is a options that says About Terminal. When this is clicked, it shows information about the application. Here is a picture:
How can I add this to my application in Java? When I do this now, this is what shows up:
As you can see, it shows the Java version etc. Is there a way to change this into a more professional format?
If your Window extends JFrame, just use the setIconImage or setIconImages method to set your icon.
From the corresponding JavaDoc:
Sets the image to be displayed as the icon for this window.
The other information is read from the executable metadata. If you run your app using Java directly, you can't change it. For my applications, I generate an executable file using Install4J, where the installer adds the metadata to the generated executable.
Thanks, I've solved the problem. It was a simple mistake, when I packaged it together using a packager it worked fine. Thanks for all your help!

Libgdx stuck generating an app

When I click on the downloaded libgdx file I select run with Java then the libgdx window pops up I check android (and tried to check desktop too) and leave the names default and some times I tried to change them and for extensions I leave it as default the only one checked is box 2D.
Its says in the little console below that it's generating an app in my desired path then its just stuck there for hours.
(I checked task manager and its not using almost any resources other than 60 mbs of ram)
This problem could possibly happen if the application cannot write into the destination folder you choose. So avoid making the destination folder inside the system32 folder or such.
Run the jar file from the command prompt to see the exception it generates which should explain the problem:
Hold down the Windows button and tap the 'r' key.
In the dialog type 'cmd' then enter.
Copy this text using ctrl-c, include all quotes. Adjust the file names to point to your Java VM runtime and your downloaded
gdx-setup.jar file: "C:\Program
Files\AdoptOpenJDK\jdk-8.0.222.10-hotspot\bin\java.exe" -jar "C:\Users\keith\Downloads\gdx-setup.jar"
Paste the text into the command prompt by pressing ctrl-insert (the zero key on the numpad). Alternatively, tap the top left icon,
then edit, then paste.
See what the specific exception is in the cmd console when the gdx setup program runs.

Files can not be opened directly by an application in which they were created

I have installed a Java Application[which creates slides presentations like powerpoint] on my computer. It runs successfully from start menu. But when I Open the file created in that application, it does not opens, application does not launches. Somehow those files can't find the path to that application. does anyone have any idea what possibly could be the issue? I am using windows 7.
Windows uses file associations to know which application can handle which file type.
These associations aren't created by magic; either an installer creates them or you need to create them manually. When you right-click the file and select "Open", Windows should ask you which application to use. Select your Java app and it might work.
"Might" since some applications don't accept command line arguments. That means Windows can't tell the app which file to open. If that's the case, then you need to launch your app manually and then open the file from within the app.
Related:
Add a new file association in Windows 7

How can I Start My application on Start up of Windows in java

I have My Swing Application. and What I want to do is Lunch that Application when Windows Start up. so how can I do that Can i have suggestion? and application is Desktop application.
and What to do for MAC system is there any way for MAC system for do this same?
On Windows
You could simply place an executable item in the users Startup folder, see Run a program automatically when Windows starts for more details.
This will require to supply a short-cut (which can launch the jar using java.exe) or a batch file or a executable wrapper, like exe4j or launch4j for example.
On Mac
There are a few places to look for startup items:
Items can launch upon startup from the following locations:
System Preferences > Accounts > yourusername > Login Items
(Lion users: System Preferences > Users & Groups > yourusername > Login Items)
/Library/LaunchAgents/ and ~/Library/LaunchAgents/
(Lion users: In Finder, click Go > Go to Folder > then enter the path)
/Library/StartupItems/
(Lion users: In Finder, click Go > Go to Folder > then enter the path)
This assumes that the application has been bundled as an application bundle. See Packaging a Java App for Distribution on a Mac and Java Application Bundler for more details.
There may be additional requirements in the pinfo files that I've not highlighted, but these are the basics. This is not an area I have experience in, but something I've done a little bit of research into
Take a look at:
Take control of startup and login items
How to set applications to automatically launch at startup
For more details
Click the Start button Picture of the Start button , click All Programs, right-click the Startup folder, and then click Open.
Open the location that contains the item you want to create a shortcut to.
Right-click the item, and then click Create Shortcut. The new shortcut appears in the same location as the original item.
Drag the shortcut into the Startup folder.

Eclipse open console apps in separate window

Is there a way to configure eclipse to open console apps in a new window rather than it's own console when you run/debug them?
I'm debugging a client/server application and I'd like to see the output of both apps at once and not have to switch between the tabs...
In eclipse, you can have two console views...
On the console view, you have a button called 'open console' (the most right button in the console view). If you click this and select option 3 (new console view), you will see two consoles.
If you right click on the console tab and click on 'detached' the console will be detached from the eclipse frame. (for Eclipse Juno, see the HRJ's comment below)
You can select which output you want to see on each console by clicking the 'display selected console' button (second button from the right on the console view)
I have a different solution to this that works for my situation, and can probably be adapted by others.
I actually want a real second console window -- gnome-terminal in my case. I want this because I want ANSI color support and I want JLine to operate correctly. I can separately start my program and connect remotely for debugging, but that's annoying.
Locate where Java runs from, for the JRE eclipse will run as part of your debug config. Create a script there named gjava, give it the following content, and set it executable:
#!/bin/sh
gnome-terminal -x java $*
Then, in your launch configuration, on the common page, uncheck "Allocate console". On the JRE page, under Java executable, choose "Alternate" and enter gjava.
When Eclipse launches in debug mode, it will launch a gnome terminal and pass the remaining args to the Java processor, which will be running inside its window.
At that point you have a real console that supports JLine, ANSI colors, and full debug support.
When you create the second console, click on "Pin Console" and this will keep the console attached to the last application it was used for.
This is an old question, but I ran across this - and in my case, I have a Python program that I want to run in a separate DOS window.
My solution was to create a run configuration for CMD.exe under "External Tools".
I opened Run > External Tools > External Tools Configurations...
I right-clicked on Program (on the left) and picked New Configuration and named it "RunFooUnderCMD" (Foo being my project)
Under "Location" I put C:\Windows\System32\cmd.exe
Under "Working Directory" I put ${workspace_loc:Foo/}
Under "Arguments" I put the following all on one line:
/c start cmd /c python -u ${workspace_loc:Foo/path/to/startup.py}
(note that I used forward-slashes even though it is Windows)
and clicked "Apply" and "Close".
Voila! I can navigate to "Run > External Tools > 1 RunFooUnderCMD" and run my program.
Eclipse also automagically provides further menu shortcuts; exploring those are left as an exercise to the reader. :-)

Categories