Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Jar file on PC at startup

I know that similar questions were asked before here. But I couldn't make mine work somehow. Here are the steps that I tried already.

  1. I created a bat file as javaw -Xmx200m -jar C:\Path\to\jarfile\TheJar.jar and put in the startup folder. It worked for the current user. This doesn't help because I want to run this file for all users once they login to PC.

  2. I created key value as HKEY_local_machine>software>microsoft>windows>current version >run and put it the samething in the string value. That didn't work either.

So I have windows 10 64 bit machines and the jar file needed to be placed on those computers. Once any user login, the jar file needs to run. But I couln't make that so far.

like image 686
Fabian Avatar asked Mar 29 '16 15:03

Fabian


People also ask

How to open jar files in Windows?

The first way you can try to open JAR files is to add Java to Windows. Without it, Java apps will not run on Windows and the JAR files also will not be opened. So, in order to run .JAR files, you need to add JAVA to Windows. Now, here is the tutorial. Open Command Prompt.

How to run a JAR archive on other computers?

If you’ve compiled a .jar archive on your own and would like to run the same on other PCs then a .bat file can help you with the same. To do so, first, open up any Windows Explorer window, click on the 3-dot menu icon and select ‘Options’. Now, go to the ‘View’ tab and uncheck the option ‘Hide extensions for known file types.’

How do I run jarx on Windows 10?

Jarx is one of the Jar executors you can add to Windows by clicking Jarx-1.2-installer.exe on this page. Click the jarx.exe to run the software, which doesn’t really have a GUI as such (except an About jarx window). Then you can double-click Jar files to run them in Windows.

Can I run a pure Java JAR file in Windows?

While you can extract JARs with archive software such as 7zip, you can’t run a pure Java JAR app as you would with other programs in Windows. Since that’s the case, we’ll cover how you can run a pure Java app JAR file in Windows.


1 Answers

Try the following:

Write a batch file as follow ans save it as *.bat or *.cmd:

start javaw -Xmx200m -jar C:\Path\to\jarfile\TheJar.jar

Save the file created in the startup folder for all users, which should be C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

It is important to pay attention on the folder, because if your used Windows + R and shell:startup shortcut like I usually do, it will only work for the current logged user.

like image 190
dambros Avatar answered Oct 16 '22 23:10

dambros