Click here to Skip to main content
15,512,502 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys
i have a java class. how i can creat batch file(.bat) so that i can put it in windows start up folder to execute my class at startup, and what things i need to have and to do ?
Posted

Just Drag it into startup folder which is located in your start menu.
Not working? Add this to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run Through regedit.
 
Share this answer
 
v2
You can simply make an entry in the windows register at:
HKCU\Software\Microsoft\Windows\CurrentVersion\Run

And put a new value in something like:

Name : MyClass (or whatever you want to name it)
Value : "C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "c:\myproject\myclass.jar"

When you then reboot windows it will start.

Good luck!
 
Share this answer
 
Comments
THEASCII 14-Jan-11 1:50am    
can i put jar file's shortcut in windows stratup folder to achive the same thing?
E.F. Nijboer 14-Jan-11 3:43am    
You can indeed create a bat file with the command -> "C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "c:\myproject\myclass.jar"
And you can put that in the startup folder. Be aware that the startup folder is a user folder and when you right click on it and choose "explore" in the context menu you will see that it is not located in the windows folder but in "documents and settings" of the current user.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900