Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 12 of 12

Thread: JMS Example + netbeans = won't compile

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Location
    Whyalla, Australia
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default JMS Example + netbeans = won't compile

    Hi All,
    From within netbeans I can't compile the example code listed here:
    Writing Simple JMS Client Applications


    I get the error:
    D:\PhD\My Development\development\JMS Example\src\SimpleTopicPublisher.java:50: package javax.jms does not exist
    import javax.jms.*;

    I get that the compiler can't locate the JMS file, but to my understanding the JMS file should be part of the JDK that I downloaded.

    I get the high level stuff on how Pub/Sub works as I've written equivalent stuff in C++, I just can't figure out how to get JAVA to behave.

    Any help extremely welcome.

    Darryl


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JMS Example + netbeans = won't compile

    JMS is not a standard Java package. You will need to add it to your classpath.

  3. The Following User Says Thank You to Junky For This Useful Post:

    DJB79 (June 27th, 2011)

  4. #3
    Junior Member
    Join Date
    Jun 2011
    Location
    Whyalla, Australia
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: JMS Example + netbeans = won't compile

    Quote Originally Posted by Junky View Post
    JMS is not a standard Java package. You will need to add it to your classpath.
    Cool thanks for this.

    So my next questions are:
    1. Where is JMS located (part of swing)
    2. I'm on Win7 box, so does the above location go into Environment Variables -> classpath?

    Cheers
    Darryl

  5. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JMS Example + netbeans = won't compile

    It is located wherever you downloaded it. If you haven't downloaded it then you will need to.

    If you are using an IDE like Netbeans you should be able to right click on the project and add it to the properties somewhere.

  6. The Following User Says Thank You to Junky For This Useful Post:

    DJB79 (June 27th, 2011)

  7. #5
    Junior Member
    Join Date
    Jun 2011
    Location
    Whyalla, Australia
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: JMS Example + netbeans = won't compile

    Quote Originally Posted by Junky View Post
    It is located wherever you downloaded it. If you haven't downloaded it then you will need to.

    If you are using an IDE like Netbeans you should be able to right click on the project and add it to the properties somewhere.
    Cool,
    I've now grabbed the following:
    javax.jms.jar.zip
    jms-1_1-fr-apidocs.zip

    Is there a standard location that I should unzip these to so as to get started?

    Cheers
    Darryl

  8. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JMS Example + netbeans = won't compile

    You can put them anywhere you like. I strongly suggest NOT putting them in the bin directory of your Java installation.

  9. The Following User Says Thank You to Junky For This Useful Post:

    DJB79 (June 27th, 2011)

  10. #7
    Junior Member
    Join Date
    Jun 2011
    Location
    Whyalla, Australia
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: JMS Example + netbeans = won't compile

    Is there a convention as to where these normally go?

  11. #8
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JMS Example + netbeans = won't compile

    I just answered that question.

  12. The Following User Says Thank You to Junky For This Useful Post:

    DJB79 (June 27th, 2011)

  13. #9
    Junior Member
    Join Date
    Jun 2011
    Location
    Whyalla, Australia
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: JMS Example + netbeans = won't compile

    You said they can go anywhere so long as not in \bin.

    I'm asking if there is a convention (a common location most people use) as to where additional jars get parked.

    Also is there a location (or even a convention) that I should load the api docs so that I can easily integrate with the rest of the API?

    Regards
    Darryl

  14. #10
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JMS Example + netbeans = won't compile

    "anywhere you like" kinda implies there is no convention. However for tidyness you might want to include it somewhere inside your project.

  15. The Following User Says Thank You to Junky For This Useful Post:

    DJB79 (June 27th, 2011)

  16. #11
    Junior Member
    Join Date
    Jun 2011
    Location
    Whyalla, Australia
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: JMS Example + netbeans = won't compile

    Junky,
    Thanks for that files now donloaded, stored in /src-added/JMS

    Properties in NetBeans changed to point to javax.jms.jar

    Everything now compiling.

    Greatly Appreciated.

  17. #12
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JMS Example + netbeans = won't compile

    Cheers!

    ignore just making post long enough

Similar Threads

  1. [SOLVED] Netbeans 7.0 won't compile files.
    By Melawe in forum Java IDEs
    Replies: 3
    Last Post: June 14th, 2011, 04:38 AM
  2. Cannot get to compile
    By theoneyouenvy in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 19th, 2011, 10:17 PM
  3. [SOLVED] I CANT COMPILE
    By savvas in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 31st, 2011, 11:34 AM
  4. *why won't this compile?*
    By dcshoecousa in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 2nd, 2010, 07:18 PM
  5. need help to compile
    By hardwarewizard in forum Java Theory & Questions
    Replies: 0
    Last Post: February 14th, 2010, 10:03 AM