Laxmi Das
Laxmi Das

Reputation: 1

run java file by shell script - where the java file and shell script are in same package

I have a snmp agent running in my machine, which will run a shell script when a snmpwalk request came to the agent with a particular OID. By

exec TestFile /bin/sh /location/of/file/testShFile.sh

Then the sh file in turns call a java file to check the connectivity to other server and returns the o/p to snmp request.

Java file is in package --> a.b.foo.test.Test.java and sh file also resided in --> a.b.foo.test.testShFile.sh

Now how to run the java file from this shell script, as i am getting a NoClassDefFoundError.

Upvotes: 0

Views: 2071

Answers (2)

gma
gma

Reputation: 2563

java -classpath /location/of/parent/of/A/directory a.b.foo.test.Test

Upvotes: 0

Jemolah
Jemolah

Reputation: 2192

Extend your shell batch file to output or log the current setting of the classpath. Probably its not set at all.

Why don't you directly invoke the other Java method?

Upvotes: 1

Related Questions