Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
- Posts: 4
- Joined: Thu Oct 28, 2010 7:12 am
Does any body know if a java program be called from a project goanywhere director.
- Posts: 91
- Joined: Thu Mar 05, 2009 3:49 pm
- Location: Ashland, NE USA
It is possible to run Java programs that are native to the GoAnywhere host. Java class files are not executable. So, he would have to pass the class name as a parameter to the java executable. Since the host is System i (according to the case), there are actually a couple of ways he can do it. You can use Execute System i Command or Program (exec400) task or the generic Execute Native Command (exec) task.
Using the first approach, (iSeries specific), he would have to run something similar to the following command:
JAVA CLASS(HelloWorld) CLASSPATH('/MyDir')
In the above HelloWorld is the name of the Java class he wants to run. This class must have a main method. The class path tells where this class and any other classes/Jar files this class depends on. More paths can be added by separating each class path with a colon. For more information refer to the help panels on the command.
The second approach (generic and platform independent):
The executable to run would be /path/to/java. For example, /QOpenSys/QIBM/ProdData/JavaVM/jdk50/32bit/jre/bin/java.
Then he needs to have one or more parameters to specify the class path and the class to run. It is just similar to how one would run a Java program. Each token needs to be added as an argument under the exec task. For example the first argument should be -cp, then the second one should be the actual class path, then the third one should the name of the class without the ".class" extension.
Return to “Community Forum”