Skip to main content
1-Visitor
June 3, 2011
Question

Configuring java samples

  • June 3, 2011
  • 13 replies
  • 2401 views
I'm trying to use Java with Arbortext rather than my more typical ACL use.
So I'm trying to get the java samples compiled and running before I start
anything new.

So I've copied the java source files to my custom/classes folder and have
compiled them there with the aom.jar file. i try to run the Hello world
example as instructed in the readme file and it fails. So the instructions
say to use

eval java_static('Hello','sayHello')

I get an empty window and the message line indicates that it

"Cannot load class Hello because a dependent class was not found"

When I look at the javaclasspath setting I see this:

C:\work\custom\classes;C:\Program
Files\Arbortext\Editor53\custom\classes;C:\Program
Files\Arbortext\Editor53\adapters\com.ptc.prowt.arbortext\classes;C:\Program
Files\Arbortext\Editor53\adapters\com.ptc.prowt.arbortext\classes\wnc2ati.jar;C:\Program
Files\Arbortext\Editor53\adapters\com.ptc.prowt.arbortext\classes\atimport.jar;C:\Program
Files\Arbortext\Editor53\adapters\com.ptc.prowt.arbortext\classes\ape_wc.jar;C:\Program
Files\Inmedius\Horizon\classes\Horizon.jar;C:\Program
Files\Inmedius\Horizon\classes\Utils.jar;C:\Program
Files\Inmedius\Horizon\classes\commons-codec-1.3.jar;C:\Program
Files\Inmedius\Horizon\classes\commons-httpclient-3.1-beta1.jar

So I have placed my class files in both of these locations with no
difference: C:\work\custom\classes;C:\Program
Files\Arbortext\Editor53\custom\classes

I don't have a clean Arbortext only environment as you can see the
Inmedius files on the path, is there some standard Arbortext entry missing
for the AOM.jar or something else?

I've been trying to modify the path and I see that
append_javaclass_path("C:\work\custom\classes2") is supposed to add new
locations to the end of the class path, but when I run this and then check
the results I'm not seeing the javaclasspath value changing.

The Hello program is just this:

public class Hello {
/**
* Return "Hello!".
* @return The string "Hello!"
*/
public static String sayHello() {
return "Hello!";
}
}

I've been trying all this at the editor commend line without a document open.

Any ideas?

..dan

    13 replies

    18-Opal
    June 3, 2011
    Glad that got it working for you.

    For future reference, the JVM makes assumptions about source version and
    target version if you don't explicitly provide them. If you really
    needed 1.4-compatible class files, it looks like you would need to
    explicitly set the source version as well as the target. (Again, see the
    javac man page for details.)

    --Clay

    Clay Helberg
    Senior Consultant
    TerraXML

    1-Visitor
    June 3, 2011
    I went looking for an option like that, but when I saw -sourcepath and
    nothing else next to it, I didn't look further. I didn't pay attention to
    the fact the -help listing was not in alphabetical order.

    thanks


    > Glad that got it working for you.
    >
    > For future reference, the JVM makes assumptions about source version and
    > target version if you don't explicitly provide them. If you really
    > needed 1.4-compatible class files, it looks like you would need to
    > explicitly set the source version as well as the target. (Again, see the
    > javac man page for details.)
    >
    > --Clay
    >
    > Clay Helberg
    > Senior Consultant
    > TerraXML
    >
    >
    1-Visitor
    June 3, 2011
    While we're on the java topic... is anyone using Netbeans, or more
    specifically Maven to handle their Arbortext packages?

    I had been using Ant with a target to copy to my custom\classes dir,
    managing external jars manually. Now that I'm using Maven, I have
    dependencies setup in my POM to automatically pull jars in from the repo.
    So far I've still just been manually copying my main target jar (and any
    deps) since I haven't had time to play around with the assembly plugin, but
    it's starting to get tedious as I add more and more dependencies
    (transitioning from Axis to Wink/Spring/Jackson)

    keith