Unable to access jarfile
Verfasst: Dienstag 27. Juli 2021, 13:04
Excuse my English, mein Deutsch is nicht gut.
I had a java application which was testing servers. We are migrating to python, and for a start we are making use of the jar from the java application.
I use the jar in my python script, and call the
```
subprocess.call(
['java', '-jar', 'XYZ.jar', '-url', 'opc.tcp://localhost:XXXX', '-check', 'AB', '-specVersion', '2.0', '-test', 'testclient.TestGeneral'])
```
This works perfect!
However, we plan to have a clear structure by using classes(OOP).
So I make some modifications and I write the below
```
class TestClient:
def performTest(self):
subprocess.call(['java', '-jar', 'XYZ.jar', '-url', 'opc.tcp://localhost:XXXX', '-check', 'AB', '-specVersion', '2.0', '-test', 'testclient.TestGeneral'])
if __name__ == "__main__":
client = TestClient()
client.performTest()
```
I get an error saying
```
Error: Unable to access jarfile XYZ.jar
```
How is it that the jar becomes unaccesable? Am i missing something here? Please let me know
I had a java application which was testing servers. We are migrating to python, and for a start we are making use of the jar from the java application.
I use the jar in my python script, and call the
```
subprocess.call(
['java', '-jar', 'XYZ.jar', '-url', 'opc.tcp://localhost:XXXX', '-check', 'AB', '-specVersion', '2.0', '-test', 'testclient.TestGeneral'])
```
This works perfect!
However, we plan to have a clear structure by using classes(OOP).
So I make some modifications and I write the below
```
class TestClient:
def performTest(self):
subprocess.call(['java', '-jar', 'XYZ.jar', '-url', 'opc.tcp://localhost:XXXX', '-check', 'AB', '-specVersion', '2.0', '-test', 'testclient.TestGeneral'])
if __name__ == "__main__":
client = TestClient()
client.performTest()
```
I get an error saying
```
Error: Unable to access jarfile XYZ.jar
```
How is it that the jar becomes unaccesable? Am i missing something here? Please let me know