Importing packages for PMS?

Discuss issues related to PS3 Media Server development (only for programmers)

Importing packages for PMS?

Postby eth0 » Wed Mar 24, 2010 2:29 pm

HI all, just wondering if somebody could help me out. I'm new to Java and coming from PHP so go easy on me :)

I'm creating a plugin but I want to utilize the httpclient from Apache Commons PMS already has (org/apache/commons/httpclient) instead of putting it my package separately, can I do this? I thought it was just a case of;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;

but it just doesn't work.If I extract the PMS.jar and then set my classpath to where I extracted, it works fine but is that the proper way to do it? If I move my compiled jar to another machine (without the extracted files) it won't work, right?

Thanks.
eth0
 
Posts: 3
Joined: Wed Mar 24, 2010 2:15 pm

Re: Importing packages for PMS?

Postby chocolateboy » Wed Mar 24, 2010 3:13 pm

If they're bundled with PMS, then yes, you can use them. You'll need pms.jar to be in your project's classpath when you compile your plugin. How you define it depends on your build tool. With Apache Buildr, for instance, I copy/link it to $PROJECT/lib/ and use something like the following:

Code: Select all
VERSION_NUMBER = "0.01" # Version number for this release
GROUP = "com.acme" # Group identifier for your projects
COPYRIGHT = "foo <foo@example.com>"
 
# Specify Maven 2.0 remote repositories here, like this:
repositories.remote << 'http://repo1.maven.org/maven2'
 
# Specify Maven 2.0 artifacts here:
PMS = 'lib/pms.jar'
 
desc 'PS3 Media Server plugin for blah blah blah'

define 'myplugin' do
    project.version = VERSION_NUMBER
    project.group = GROUP
    manifest['Implementation-Vendor'] = COPYRIGHT
    package(:jar).include('plugin')
    compile.with PMS
end


Alternatively, you can bundle dependencies within your plugin in various ways.
chocolateboy
Project Member
 
Posts: 2579
Joined: Wed Sep 16, 2009 10:05 am

Re: Importing packages for PMS?

Postby eth0 » Wed Mar 24, 2010 11:57 pm

Ah, thank you. I was setting my CLASSPATH to the directory of pms.jar and not the full path to the file - works a treat now :D
eth0
 
Posts: 3
Joined: Wed Mar 24, 2010 2:15 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests