What Causes "Unable to Access Jarfile" Error

What causes Unable to access jarfile error?

Fixed

I just placed it in a different folder and it worked.

What causes Unable to access jarfile error?

Fixed

I just placed it in a different folder and it worked.

Error unable to access jarfile C:\Jar

That's because of the space you have in the path name. On Windows, use quotes:

java -jar "C:\Jar Folder\P2.jar"

Python, unable to access jarfile using os.system()

Resolved:

Maybe this is obvious for a lot of people but I'll write what worked for me to help people with the same issue.

Let's say whe have this folder structure:

folder\start.py #is the python starter
folder\server\server.jar #is the server jar
folder\server\start.bat #is the server jar starter (java -Xmx1500M -Xms125M -jar server.jar nogui)

When with python you call os.system('server\\start.bat') it opens a new console which led me thinking it was the start.bat cmd, it is not, in fact python executing your batch commands in the folder directory.

There are two methods I found to resolve this issue and both of them are not really convinient (I guess I'll make a python function to automate the process):

Option one: change the start.bat file to java -Xmx1500M -Xms125M -jar server\server.jar nogui

Option two: change the start.bat adding cd server before the first line.



Related Topics



Leave a reply



Submit