I have a executable .jar file in a remote machine in windows environment. Now I want to execute this .jar file from other machine (windows environment) and need to open the console.
So far, I have shared the specific .jar file to everyone and created a .bat file in local machine with the below content.
#ECHO OFF
java -Xms512m -Xmx768m -XX:CompileThreshold=8000 -XX:PermSize=256m -XX:MaxPermSize=512m -Dvendor=shell -DvendorFile="\\<REMOTE MACHINE'S IP>\WorkJars\servers_prod_remote.properties" -Dfile.encoding=UTF-8 -Dyfs.logall=N -jar "\\<REMOTE MACHINE'S IP>\Users\tcs\Desktop\Status Compare\statuscompare4.jar"
It works fine for some machine, but for other machine, it fails and it prompts for the username and password of the remote machine.
Even if I try accessing the remote path from local using run command \\<REMOTE MACHINE'S IP>\, for some machine, it prompts for the username and passoword for security.
Security Prompts
So whenever, I use .bat file from those local machine, it says "Access Denied".
Could anyone help me with this issue, as I don't want the username and password to be prompted and I just want to execute the .jar file without any issues.
If the jar file is excute on your machine, then the file is ok no issue with file.
Now your problem is it is not executing on some of the other machine not all. Its simple java need JRE to run or JDK for development.
Downlaod JRE java runtime enviroment from Oracle on the machine on which the file is not running and test it.
hope your problem is solve.
Another way is to quicky test if JRE is installed on the machine.
Open comand promte by clicking on start and type cmd. then type java - version
if it display some verison of java or something that means JRE is installed otherwise some other issue.
Related
Environment: Windows 11
Problem: cannot open .jar file(the MARS assembly language simulator)
Hello, I am currently trying to install the MARS assembly language simulator. It is a .jar file so I downloaded java to open it. However, I still can't open the file even with java downloaded.
I checked if java was installed using my cmd:
Command prompt showing java successfully installed
I tried double-clicking it did not work. So I right-clicked it to open with other apps. But I did not see java in the given options.
Cannot find the java option to open the file
Thank you so much for helping!
Use your prompt
CD into the directory with the jar
then execute
java -jar Mars.jar
...any more troubles , open file properties tab with right click on the jar and check permissions to execute the file.
Installing Java usually means installing a JVM, which is a Java Virtual Machine. You won't be able to launch files from a Windows context menu like this, because "Java" is not a program that opens files.
Instead you need to:
Either a terminal and call javaw.exe with the parameters -jar and your .jar-file. E.g.:
C:\your\java\binaries\javaw.exe -jar -SomeJarFile.jar
Or add the Java installation to your environment variables, then you can call javaw.exe without providing some specific path
If I open manually (java -jar name.jar)it works. When I try to open it with ssh command it opens the browser incognito.
I have a windows vm with windows server. JDK is installed.
I can imagine you have proper installation (your question details was little bit ambiguous) but in any case it could be the java command is not on the command search path for your user account and take this steps to make sure about installation
verify that Java is installed java -version
Confirm the PATH variable includes Java’s \bin directory in your remote machine
After verification create shell file and execute shell as ssh user#host "sh ~/app-runner.sh", you may also see here to how create shell for executing jar file(s).
I have a java application, which has to run as windows service.
I am able to install the service using the following command.
"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass %STARTER% --StopClass %STOPPER% %START_PARAMS% %STOP_PARAMS%
The service is installed successfully but when i try to run it it shows Failed to create java. path also it is not showing in the jkartha log file.
I have JAVA_HOME environment variable pointing to jdk1.5.
and even i copied msvcr71.dll to windows\system32 folder and restarted the PC.
I am running this on windows 2008 server.
I didn't install apache tomcat server. prunsrv.exe and procmgr.exe i just copied.
Please suggest me how i need to overcome this problem.
whether to run application as windows service, prunsrv.exe, prunmgr.exe are enough is it? I am able to successfully install but not able to start why???
You probably need to set your service to run as the user that installed Java, otherwise it won't find its environment variables.
If you must run in the default Local System account, then you can run a batch file that sets up the environment and then launches java.exe.
I have downloaded a program to run on windows XP.
According to the instructions, opening the .bat file that includes the command that calls the .jar file would be enough.
Yet the program does not open.
In a friend's computer the program does open.
I have set correctly the java-related environment variables. Java works fine. I have associated .jar files with java sdk.
When calling the command
javaw -Xms128M -Xmx512M -jar filename.jar from cmd
I get a java virtual machine launcher
error: unable to access jarfile
Then I called the same command while being on the folder where the jar is, I have no error, but still the gui of the program does not open.
Any ideas?
On windows support the suggest unistalling and manually re-installing java, but java works fine in any other app.
Try some of the following:
Run directly from the .exe, so "C:...\jre\javaw.exe" -jar
Try java -jar instead of javaw -jar.
Try moving the file. It could be in a permissions sensitive directory.
Also, if the program was compiled using a 64-bit JDK, it might require a 64-bit JRE to run. In that case, you'd need to have a 64-bit OS/JRE to run it.
i am trying to copy files which are in jar file to the system32 folder of my machine using the following code
Runtime r=Runtime.getRuntime();
Process p=r.exec("cmd /c copy hello.dll c:\\windows\\system32\\");
But here the file is not copied???!!!!
but when iam giving
Runtime r=Runtime.getRuntime();
Process p=r.exec("cmd /c copy hello.dll c:\\windows\\");
the file is copied to the windows folder......
can any one help me..........
iam using a windows 7 machine
The app needs to be run as Administrator or you must prompt the user to raise their permissions to Administrator. In Windows 7, it is insufficient for the user to have Administrative privileges--as they could in xp. They must explicitly give the application permission to perform such a copy.
Make sure your command prompt(or IDE) is running in an Administrator mode, if your are running your program via command prompt.