Java Service Types sharing Classes between projects

Posted by sedge on 10-Mar-2011 17:44

This is definitely a Java, Eclipse and Sonic Newbee question and I could use some help.

My workspace is made up of several projects. One project is is a core services project and other projects perform message group specific handling. The core project has:

- several Java Service Types which are working OK.

- some Java Classes to provide common services to the Service Types.

I created a new Java Service Type in one of the  message handling services, which uses common Classes from the core project.

I added the core project to the project's Built Path and it all looked good.

When I uploaded the Service Type  it failed to load with the message "Unable to find service class ....."

I tried adding the custom-services-classes.jar from the core project into the Service Type classloading but that didn't help.

In the interim I have copied the common code into the project and removed the reference to core project from the build path and the Service Type now loads OK, but that isn't a good long-term solution.

Can someone help me out with what I need to do to have Service Type code refer to Classes in another project?

Thanks

Steve

All Replies

Posted by tsteinbo on 15-Mar-2011 05:34

Steve,

you should simply create a jar from you core project, e.g. myCorePrj.jar. Once you have that add it to the service type classpath and you should be all set.

Thomas

Posted by sedge on 16-Mar-2011 00:47

Thanks Thomas

That's about what I expected to do. The devil is in the "how". I've been a .net programmer for a few years so I don't have a problem with writing Java code, but I'm new to the Java environment and Eclipse. I've been struggling with getting it done.

I've created an Ant build but when it runs I get the error:

com.sun.tools.javac.Main is not on the classpath.

Perhaps JAVA_HOME does not point to the JDK.

It is currently set to "C:\Progress\Sonic\MQ8.0\jre"

but of course javac is in a JDK.

I have a JDK installed at C:\Program Files\Java\jdk1.6.0_21\

and have C:\Program Files\Java\jdk1.6.0_21\\bin in my Windows PATH.

I have an Ant File that runs xjc.exe (JAXB) which is in the same place as javac and it runs fine.

Any hints? I really don't want to screw up my workbench configuration by trial and error fiddling with things I don't fully understand.

Regards

Steve

Posted by tsteinbo on 18-Mar-2011 04:13

Well, if you don't want to fiddle with setting up the JDK and ANT you can also use Eclipse's export.

Go to File -> Export; Locate Java/Jar File and walk the wizard.

Thomas

This thread is closed