Problems compiling C in XCODE using VISA / NI

Hi,
I'm developing a program in C to communicate with my Tektronix oscilloscope. I inherited this project from a friend (who is currently incommunicado), so I can't talk to him about it.
Basically, my problem is that my program will not build due to a linker problem. I am using functions from the NI-VISA 5.4 package for OS X 10.8. However, the linker cannot seem to find the correct functions for my system:
Undefined symbols for architecture x86_64:
  "_viClose", referenced from:
      _setupVI in oscilloscope.o
      _getData in oscilloscope.o
      _closeInstr in oscilloscope.o
  "_viOpen", referenced from:
      _setupVI in oscilloscope.o
  "_viOpenDefaultRM", referenced from:
      _setupVI in oscilloscope.o
  "_viRead", referenced from:
      _setupVI in oscilloscope.o
      _getData in oscilloscope.o
  "_viStatusDesc", referenced from:
      _setupVI in oscilloscope.o
      _getData in oscilloscope.o
  "_viWrite", referenced from:
      _setupVI in oscilloscope.o
      _getData in oscilloscope.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
These are all pretty basic VISA functions. I struggled in just including the correct header file, as
#include <visa.h>
didn't work. When I went to the verbose form, it worked:
#include "/Library/Frameworks/VISA.framework/Versions/A/Headers/visa.h"
However, then the problem started happening that I'm having now -- the object linker can't find the code for the VISA functions. I've tried changing build architctures from x86_64 to just x86, without avail. I'm currently building in i386 x86. I've also tried (under Build Phases -> Link Binary with Libraries) to link the VISA.framework to the project, but this simply gives the linker error "cannot find VISA".
I feel like I am missing something very obvious. I'm still operating under the notion that either NI-VISA did not install to the correct location, or that my build settings are incorrect.
Does anyone have any insight to lend? I've been searching through different forums for help for almost 2 days now, with no avail.

atucker-hs wrote:
That is a good point that I hadn't thought of--I didn't run any install operations before installing 5.4. I'll try uninstalling all of 5.4 (there's not an uninstaller; just a text file of files to delete) and then doing a clean install after a restart. I'll let you know how it goes.
As far as their included examples, I tried to compile them both when I had 5.3 and 5.4 installed. I used gcc from the command line, and there were tons of errors - far more than I have in my XCODE project.
Did you try the Instruments/NI-VISA/Examples/C/ExamplesProject.pbproj?

Similar Messages

  • Help with RS232 Communication without using VISA

    I'm a newcomer to LabVIEW, and am currently trying to interface with an instrument that communicates via an RS232 serial port.  This instrument is not compatible with the VISA tool, and since that (and the DAQ Assistant) is all I've used to interface with instruments, I'm at a loss as to where to head next.  I know the baud rate, data format, stop bit and parity bit, and am able to generate the ASCII commands that I want to send to the instrument; I just need a bit of help on knowing which function I can use to go the rest of the way.  Thanks for any help.

    Why is the "instrument is not compatible with the VISA tool"?
    VISA is a device driver interface that allows LabVIEW and other NI programs to communicate with the serial port on the PC.  It doesn't care about what instrument is on the other end of that serial connection.  Likewise, the instrument on the other end should have no idea whether it is being communicated to it by way of VISA, or any other device driver.
    If you are having problems, then it is probably in the way you are using VISA and not within VISA itself.  There may be some other ways that you could have your LabVIEW program access your PC's serial ports without VISA, but you are going to have more headaches and problems that way.
    Please provide more details on the problems you are having with using VISA.

  • HT204266 I tried to buy credits from a game I am playing but using visa card it was accepted once then all are rejected asking me to go to iTunes support but nothing there. How to solve this problem.

    I tried to buy credits from a game I am playing using visa card it was accepted once then all are rejected asking me to go to iTunes support but nothing there.
    How to solve this problem?

    You need to email iTunes Store Support. Click or tap  on Purchases, Billing and Redemption in here....
    https://expresslane.apple.com/Issues.action

  • Hey.. m frm india.. m jus advicing apple dat if dey give apple users to buy apps frm deir balance(money will b deducted..) rather by using visa, credit card n all...! its good if apple does dis.. its one kind of problem in india for apple users! i thnk

    m frm india... m jus advicing apple dat y not dey give apple users to buy apps wid d us of their balance( money will b deducted frm their balance) rather by using visa, credits cards n all..... its one kind of problem in india for apple users..I THINK...!!

    Nobody from Apple reads these forum, this a user forum. 
    Send your suggestion here http://www.apple.com/feedback/

  • Compile Ada in Xcode

    Hi.
    I have a problem with compiling Ada in Xcode. Does someone have a guide for installing an Ada compilator for Xcode? I thought that gcc 4.0 had an Ada compilator but I can't get it to work. I have the latest version of Xcode.
    I have followed this guide but it doesn't work (http://pyrite.truman.edu/~millerj/AdaonOSX/).
    I have to use Ada for a project in school so I would really appreciate some help.
    MacBook   Mac OS X (10.4.8)  
    MacBook   Mac OS X (10.4.8)  

    What problems, specifically, are you having?
    The website you linked to contained the following:
    If you experience problems getting your system patched and configured to compile Ada code, I strongly recommend the gnat-osx mailing list as a resource for getting your questions answered. The members of that community are knowledgeable and quick to respond to questions. (You'll also note that that community is deeply involved in the macada.org project.)
    The author of that site is clearly more knowledgeable about running Ada on MacOS X than probably anyone here. I wouldn't wait around for an answer on the Apple support forums. Post your question to the gnat-osx mailing list and be really, really specific.

  • Problem in Server side includes using Tomcat

    Problem in Server side includes using Tomcat:
    I am trying out small programs in servlet.
    I get one example program for server side includes from net.
    The code is:
    <HTML>
    <HEAD><TITLE>Times!</TITLE></HEAD>
    <BODY>
    <P>
    The current time in London is!!! :
    <SERVLET CODE="CurrentTime" codebase="../servlet">
    <PARAM NAME="zone" VALUE="GMT">
    </SERVLET>
    </P>
    </BODY>
    </HTML>
    I placed this test.shtml file in tomcat-home/webapps/ROOT folder and i kept the servlet in WEB-INF/classes folder.
    I renamed the servlets-ssi.jar and i removed the comments for SSI in web.xml file.
    When i run the servlet separately, i am getting the correct result. But if i run shtml file with the URL : http://localhost:8080/Test.shtml,
    i am getting the result as:
    The current time in London is!!! :
    It is not invoking servlet program.
    CAN ANYONE HELP ON THIS!
    Thanks.

    Thanks...as u said I tried putting dir & found that
    my file was saved as Ch1Servlet.java.txt instead for
    Ch1Servlet.java......So that was a problem.Now I'm
    able to compile.Oh, yeah. Notepad will do that to you. I think when you save in Notepad if you put quotes around the name "Whatever.java" then it won't add the .txt.
    But on compiling I'm getting the following error
    package java.servlet.* does not exist
    package java.servlet.http.* does not exist
    package java.io.* does not exist
    Do u the reason for this??? The servlet stuff is java[b]x.servlet. For the io stuff, I don't know, I'd have to see your code. Either you have a typo or a corrupt installation.

  • Having problems compiling *.java with import javax.servlet.jsp......

    I've been trying to do the tutorials in a book titled Apache Jakarta-Tomcat as part of my introduction to JSP. I'm new to Java but do know the basics. I have on my machine Java 1.3, Java 1.4, Java FrameWorks 2.1 and Jython 2.1 on Win2000 Pro. So enough about my configuration. I have never worked with packages also.
    I downloaded the files from the books site due to the fact I make a lot of typos when hand coding Java (I've become a pretty good debugger of my own code). But everytime I go to compile the *.java I get error messages. So below you will find HelloTag.java and beneath that the error messages that are thrown when I try and compile it. I tested other bits of *.java and have had no problem compiling them. Is there a JSP module I'm missing?
    Am I doing something wrong or am I missing something from my configuration.
    Marijan Madunic
    package chapter2;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.JspTagException;
    import javax.servlet.jsp.tagext.TagSupport;
    public class HelloTag extends TagSupport
    public void HelloTag() {
    // Method called when the closing hello tag is encountered
    public int doEndTag() throws JspException {
    try {
    // We use the pageContext to get a Writer
    // We then print the text string Hello
    pageContext.getOut().print("Hello");
    catch (Exception e) {
    throw new JspTagException(e.getMessage());
    // We want to return SKIP_BODY because this Tag does not support
    // a Tag Body
    return SKIP_BODY;
    public void release() {
    // Call the parent's release to release any resources
    // used by the parent tag.
    // This is just good practice for when you start creating
    // hierarchies of tags.
    super.release();
    D:\Java\JDK 1.3\bin>javac HelloTag.java
    HelloTag.java:3: cannot resolve symbol
    symbol : class JspException
    location: package jsp
    import javax.servlet.jsp.JspException;
    ^
    HelloTag.java:4: cannot resolve symbol
    symbol : class JspTagException
    location: package jsp
    import javax.servlet.jsp.JspTagException;
    ^
    HelloTag.java:5: cannot resolve symbol
    symbol : class TagSupport
    location: package tagext
    import javax.servlet.jsp.tagext.TagSupport;
    ^
    HelloTag.java:7: cannot resolve symbol
    symbol : class TagSupport
    location: class chapter2.HelloTag
    public class HelloTag extends TagSupport
    ^
    HelloTag.java:14: cannot resolve symbol
    symbol : class JspException
    location: class chapter2.HelloTag
    public int doEndTag() throws JspException {
    ^
    HelloTag.java:20: cannot resolve symbol
    symbol : variable pageContext
    location: class chapter2.HelloTag
    pageContext.getOut().print("Hello");
    ^
    HelloTag.java:24: cannot resolve symbol
    symbol : class JspTagException
    location: class chapter2.HelloTag
    throw new JspTagException(e.getMessage());
    ^
    HelloTag.java:28: cannot resolve symbol
    symbol : variable SKIP_BODY
    location: class chapter2.HelloTag
    return SKIP_BODY;
    ^
    HelloTag.java:37: cannot resolve symbol
    symbol : variable super
    location: class chapter2.HelloTag
    super.release();
    ^
    9 errors

    Well, it looks like you've not got the servlet development kit JAR on your classpath. I think it'll probably be called servlet.jar on your system. Add that to the classpath if it's not already there.
    Incidentally, you've bumped into one of the areas Java's slightly lenient - declaring a method that looks like a constructor:
    public HelloTag() { }
    public void HelloTag() { }The first is a constructor, the second is a normal method. I'm assuming you intended to have the former instead of the latter.
    Anyway, hope this helps.

  • Problem compilling a java file

    I've got problems using my jdk1.2 .
    When i try to compile a java file using ms-dos console or kawa program, appears this error text:
    Javaw.exe has generated an error it's gonna be closed by windows , you must restart the program.
    A error register is gonna be created.
    UI have to tell tha this is a free translation that the text appears in spanish.
    thanks a lot

    Maybe you should compile with javac.

  • Having problems compiling script

    I am rather new to java an started a couple of days ago and I ran into a problem compiling this script in the command line
    class VariableDemo {
    public static void main (String args[]) {
    int num = 1000;
    System.out.println (num + " is the value of num") ;
    At first I forgot to capitolize the 'S' in System (which is why I was getting errors) but after I had corrected it , I still could not get it to compile in a command prompt
    even after I corrected my mistakes, I still get this error:
    error: cannot read: VariableDemo.java
    1 error
    When I ran it through JCreator it compiled it just fine and found no errors. SO I just want to know if it is some thing that has to do with the command line or is there an error I am not seeing?
    I am running Windows XP Pro with service pack 2 and using JCreator 3.50.010

    Sorry, I am new to this I just called it script out of ignorance, but, yes it is in the same directory. I even Pathed it out again to be sure.

  • Compiling a Servlet that uses JavaBean

    I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
    --------------------Configuration: JDK version 1.3 <Default>--------------------
    Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
    Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean = (SimpleBean) session.getAttribute
    ^
    ("simpleBean");
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
    ^
    2 errors
    Process completed.
    Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

    Looks like an import Problem.
    The Compiler is not able to "see" the SimpleBean Class.
    Take care of the Classpath and your imports.
    Happy Coding. :-)

  • Is it possible to interface digital i/o modules using VISA serial?

    Hi,
          Iam using analog and digital modules from trycom for my project.I interface analog modules by modifying the sample code basic serial read and write given in LabVIEW examples.But i found difficulties in interfacing with the digital i/o modules.Is there any sample code forDigital I/O?Is it possible to interface the digital I/O using VISA serial?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    Also i found from the net that digital i/o modules can be communicate with Hyperterminal..Is it possible?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

  • Problem compiling with Swing

    I am new to java.
    I have recently installed jdk-1.3.1_01 and am able to compile and run basic java programs. However, when trying to compile HelloWorldSwing.java, I get the following error:
    HelloWorldSwing.java:6: error:Cannot find class "JFrame" [JLS 8]
    Is this a classpath problem? Please help!

    yes, I'm sure the code is right. What is strange is that when I first installed jdk, I was able to compile and run the swing program. Once I closed the terminal, though, and opened a new one, I was unable to compile. I'm using Linux Mandrake 8.1. Any ideas?

  • How to get LabVIEW to use library created in Xcode using a library node?

    I have written C++ code in the Xcode IDE on Mac OS X. This code controls a camera driver to tell it to take a picture and save it. I want to call this code in LabVIEW. I am trying to use a library node, but when I tell it the location of the Xcode project it doesn't recognize that anything is there. How can I get LabVIEW to recognize this? (Xcode used to be called Project Builder in earlier versions). In the documentation it says to link against libvlexports.a. I have included this file in my Xcode project, but does "link against" mean something more than that?

    To create a framework in XCode that you can reference in LabVIEW for Mac OS:
    Open XCode.
    Select File»New Project.
    Select Framework»Carbon Framework as the project type.
    Name the framework when prompted. Click Finish.
    The XCode browser will now appear. Click on main.c to open the file. This is where you will create your functions. For an example open the file main.c in the Call Library Function Node on Mac with XCode zip file.
    After adding your functions, compile the framework. The compiler settings should all be left at default.
    Access your functions via a Call Library Function Node in LabVIEW.
    To access the functions in a framework using the Call Library Function Node in LabVIEW:
    Place a Call Library Function Node on the block diagram by going to All Functions»Advanced»Call Library Function Node.
    Apple-Click on the Call Library Function Node and select "Configue..."
    Click on the Browse button and browse to your .framework file and click Select to select the framework.
    Type the name of the function you want to access in the Function Name field.
    NOTE: Unlike LabVIEW 7.x for Windows, once your framework is selected, the Function Name field DOES NOT autopopulate a list of functions in the framework.  You must type in the name of the function you want to access.
    Specify the return type of the function.
    Add the number of parameters in the function and specify their types.
    The function prototype will appear in the Function Prototype field according to how you have specified the function parameters.
    Click the OK button.
    Your Call Library Function Node will appear with the number of inputs you selected as well as the output. If LabVIEW cannot find the function you specified within the framework, it will show a broken Run arrow.
    The "Call Library Function Node on Mac with XCode.zip" file (attached) contains a simple framework created in XCode along with its source code in main.c.  main.c simply contains two functions both of which multiply two numbers. One function accepts integers and the other doubles. The zip file also contains a VI that references this framework using a Call Library Function Node.  This VI was created in LabVIEW 7.1 for Mac OS.
    Kind Regards,
    Message Edited by AESulzer on 07-08-2005 06:11 PM
    E. Sulzer
    Applications Engineer
    National Instruments
    Attachments:
    Call Library Function Node on Mac with XCode.zip ‏33 KB

  • I live in vietnam and i use visa viet nam,i can buy app on appstore but i can't purchase in app, please help me! thank you

    i live in vietnam and i use visa viet nam,i can buy app on appstore but i can't purchase in app, please help me! thank you

    What happens when you try to do the in-app purchase, if you are getting an error message then what does it say ?
    If you are getting a message to contact iTunes Support then you can do so via this link and ask them why the message is appearing (we are fellow users, we won't know why) : https://www.apple.com/asia/support/itunes/contact.html
    If it's a different problem ... ?

  • Problems compiling program

    hello.
    this is james mcfadden. i'm having problems compiling the Demo.java program. the Demo.java program is shown below along with the MediaPanel.java and MediaTest.java programs. when i compile the Demo.java program i get the following errors. i really need help in getting rid of these errors.
    ----jGRASP exec: javac -g X:\CP4B Project\Demo.java
    Demo.java:297: cannot find symbol
    symbol : class Media
    location: class Demo
    MediaTest media=new Media();
    ^
    Demo.java:301: cannot find symbol
    symbol : class Media
    location: class Demo
    MediaTest media=new Media();
    ^
    Demo.java:305: cannot find symbol
    symbol : class Media
    location: class Demo
    MediaTest media=new Media();
    ^
    3 errors
    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.
    //Written by:Seamus McFadden
    //Class:CP4B
    //Program Number:1
    //Program Name:Demo.java
    //Description:
    //Supervisor:Gerard McCloskey
    import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
    import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
    import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
    public class Demo extends JFrame{
        public static void main(String[] args){
            int choice=-1;//a variable of type int that is set to -1
            choice=getChoice();//invokes the method getChoice()
            if(choice!=0){
               getSelected(choice);//invokes the method getSelected(choice)
            }//end if
        }//end main
        public static int getChoice(){
            String choice;//a variable of type string
            int ch;//a variable of type int
            choice=JOptionPane.showInputDialog(null,
                    "1. Product Menu\n" +
                    "2. Member Menu\n" +
                    "3. Rental Menu\n" +
                          "4. Media Menu\n" +
                    "5. Log Off\n\n" +
                    "Enter your choice");//asks the user for some input
            ch=Integer.parseInt(choice);//a class that wraps a value of the primitive type int in an object
            return ch;//a method that returns an integer value
        }//end getChoice
        public static void getSelected(int choice){
            if(choice == 1) {
                   product();
            }//end if
            if(choice==2){
               member();
            }//end if
            if(choice==3){
               rental();
            }//end if
                if(choice==4){
               media();
            }//end if
                if(choice==5){
                   LogOff logoff=new LogOff();
                }//end if
                else{
                   ErrorMessage error=new ErrorMessage();
        }//end getSelected
        public static void product(){
             int productChoice=-1;//a variable of type int that is set to -1
           productChoice=getProductChoice();//invokes the method getChoice()
           if(productChoice!=0){
              getProductSelected(productChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice(); 
        public static void member(){
           int memberChoice=-1;//a variable of type int that is set to -1
           memberChoice=getMemberChoice();//invokes the method getChoice()
           if(memberChoice!=0){
              getMemberSelected(memberChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice(); 
        public static void rental(){
           int rentalChoice=-1;//a variable of type int that is set to -1
           rentalChoice=getRentalChoice();//invokes the method getChoice()
           if(rentalChoice!=0){
              getRentalSelected(rentalChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice();
          public static void media(){
           int mediaChoice=-1;//a variable of type int that is set to -1
           mediaChoice=getMediaChoice();//invokes the method getChoice()
           if(mediaChoice!=0){
              getMediaSelected(mediaChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice(); 
          public static int getProductChoice(){
           String productChoice;//a variable of type string
           int pch;//a variable of type int
           productChoice=JOptionPane.showInputDialog(null,
                   "1. Add product details\n" +
                   "2. View product details\n" +
                   "3. Edit product details\n" +
                         "4. Delete product details\n" +
                   "5. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           pch=Integer.parseInt(productChoice);//a class that wraps a value of the primitive type int in an object
           return pch;//a method that returns an integer value
        }//end getProductChoice
          public static int getMemberChoice(){
           String memberChoice;//a variable of type string
           int mch;//a variable of type int
           memberChoice=JOptionPane.showInputDialog(null,
                   "1. Add member details\n" +
                   "2. View member details\n" +
                   "3. Edit member details\n" +
                             "4. Delete member details\n" +
                   "5. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           mch=Integer.parseInt(memberChoice);//a class that wraps a value of the primitive type int in an object
           return mch;//a method that returns an integer value
        }//end getMemberChoice
          public static int getRentalChoice(){
           String rentalChoice;//a variable of type string
           int rch;//a variable of type int
           rentalChoice=JOptionPane.showInputDialog(null,
                   "1. Add rental details\n" +
                   "2. View rental details\n" +
                   "3. Edit rental details\n" +
                             "4. Delete rental details\n" +
                   "5. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           rch=Integer.parseInt(rentalChoice);//a class that wraps a value of the primitive type int in an object
           return rch;//a method that returns an integer value
        }//end getRentalChoice
          public static int getMediaChoice(){
           String mediaChoice;//a variable of type string
           int mtch;//a variable of type int
           mediaChoice=JOptionPane.showInputDialog(null,
                   "1. Listen to songs\n" +
                             "2. View movie previews\n" +
                             "3. View game previews\n" +
                   "4. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           mtch=Integer.parseInt(mediaChoice);//a class that wraps a value of the primitive type int in an object
           return mtch;//a method that returns an integer value
        }//end getMediaChoice
          public static void getProductSelected(int productChoice){
           if(productChoice==1){
                  addProducts();
           }//end if
           if(productChoice==2){
              viewProducts();
           }//end if
           if(productChoice==3){
              editProducts();
           }//end if
               if(productChoice==4){
              deleteProducts();
           }//end if
               else{
                   ErrorMessage error=new ErrorMessage();
        }//end getProductSelected
          public static void getMemberSelected(int memberChoice){
           if(memberChoice==1){
                  addMembers();
           }//end if
           if(memberChoice==2){
              viewMembers();
           }//end if
           if(memberChoice==3){
              editMembers();
           }//end if
               if(memberChoice==4){
              deleteMembers();
           }//end if
               else{
                   ErrorMessage error=new ErrorMessage();
        }//end getMemberSelected
          public static void getRentalSelected(int rentalChoice){
           if(rentalChoice==1){
                  addRentals();
           }//end if
           if(rentalChoice==2){
              viewRentals();
           }//end if
           if(rentalChoice==3){
              editRentals();
           }//end if
               if(rentalChoice==4){
              deleteRentals();
           }//end if
               else{
                   ErrorMessage error=new ErrorMessage();
        }//end getRentalSelected
          public static void getMediaSelected(int mediaChoice){
           if(mediaChoice==1){
                  hearSongs();
           }//end if
           if(mediaChoice==2){
              viewMovies();
           }//end if
           if(mediaChoice==3){
              viewGames();
           }//end if
               else{
                   ErrorMessage error=new ErrorMessage();
        }//end getMediaSelected
          public static void addProducts(){
           ProductForm product=new ProductForm();
           product.getInput();
               product.setVisible(true);
          public static void viewProducts(){
           DatabaseTest tt=new DatabaseTest();
               tt.setVisible(true);
          public static void editProducts(){
           ProductForm product=new ProductForm();
               product.getInput();
               product.setVisible(true);
          public static void deleteProducts(){
           ProductForm product=new ProductForm();
               product.setVisible(true);
          public static void addMembers(){
           MemberForm member=new MemberForm();
               member.getInput();
               member.setVisible(true);
          public static void viewMembers(){
           DatabaseTest tt=new DatabaseTest();
               tt.setVisible(true);
          public static void editMembers(){
           MemberForm member=new MemberForm();
               member.getInput();
               member.setVisible(true);
          public static void deleteMembers(){
           MemberForm member=new MemberForm();
               member.setVisible(true);
          public static void addRentals(){
           RentalForm rental=new RentalForm();
               rental.getInput();
               rental.setVisible(true);
          public static void viewRentals(){
           DatabaseTest tt=new DatabaseTest();
               tt.setVisible(true);
          public static void editRentals(){
           RentalForm rental=new RentalForm();
               rental.getInput();
               rental.setVisible(true);
          public static void deleteRentals(){
           RentalForm rental=new RentalForm();
               rental.setVisible(true);
        public static void hearSongs(){
           MediaTest media=new Media(); 
        public static void viewMovies(){
           MediaTest media=new Media();   
        public static void viewGames(){
           MediaTest media=new Media();   
    }//end class Demo
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.io.IOException;
    import java.net.URL;
    import javax.media.CannotRealizeException;
    import javax.media.Manager;
    import javax.media.NoPlayerException;
    import javax.media.Player;
    import javax.swing.JPanel;
    public class MediaPanel extends JPanel{
       public MediaPanel(URL mediaURL){
          setLayout(new BorderLayout());//use a BorderLayout
          //Use lightweight components for Swing compatibility
          Manager.setHint(Manager.LIGHTWEIGHT_RENDERER,true);
          try{
             //create a player to play the media specified in the URL
             Player mediaPlayer=Manager.createRealizedPlayer(mediaURL);
             //get the components for the video and the playback controls
             Component video=mediaPlayer.getVisualComponent();
             Component controls=mediaPlayer.getControlPanelComponent();
             if(video!=null)
                add(video,BorderLayout.CENTER);//add video component
             if(controls!=null)
                add(controls,BorderLayout.SOUTH);//add controls
             mediaPlayer.start();//start playing the media clip
          }//end try
          catch(NoPlayerException noPlayerException){
             System.err.println("No media player found");
          }//end catch
          catch(CannotRealizeException cannotRealizeException){
             System.err.println("Could not realize media player");
          }//end catch
          catch(IOException iOException){
             System.err.println("Error reading from the source");
          }//end catch
       }//end MediaPanel constructor
    }//end class MediaPanel
    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    public class MediaTest{
       //launch the application
       public static void main(String args[]){
          //create a file chooser
          JFileChooser fileChooser=new JFileChooser();
          //show open file dialog
          int result=fileChooser.showOpenDialog(null);
          if(result==JFileChooser.APPROVE_OPTION){//user chose a file
             URL mediaURL=null;
             try{
                //get the file as URL
                mediaURL=fileChooser.getSelectedFile().toURL();
             }//end try
             catch(MalformedURLException malformedURLException){
                System.err.println("Could not create URL for the file");
             }//end catch
             if(mediaURL!=null) {//only display if there is a valid URL
                JFrame mediaTest=new JFrame("Media Tester");
                mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                MediaPanel mediaPanel=new MediaPanel(mediaURL);
                mediaTest.add(mediaPanel);
                mediaTest.setSize(300,300);
                mediaTest.setVisible(true);
             }//end inner if
          }//end outer if
       }//end main
    }//end class MediaTest

    hello.
    this is james mcfadden. thanks for the reply. i did what you told me to do, but i am still having trouble trying to use the 2 JMF programs (MediaPanel.java and MediaTest.java) with the Demo.java program. the Demo.java program compiles and runs ok, but when i press 1 (for listening to songs) in the media menu i get a JOptionPane (An Error Message) displayed on screen. how can i fix this problem?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Demo extends JFrame{
        public static void main(String[] args){
            int choice=-1;//a variable of type int that is set to -1
            choice=getChoice();//invokes the method getChoice()
            if(choice!=0){
               getSelected(choice);//invokes the method getSelected(choice)
            }//end if
        }//end main
        public static int getChoice(){
            String choice;//a variable of type string
            int ch;//a variable of type int
            choice=JOptionPane.showInputDialog(null,
                    "1. Product Menu\n" +
                    "2. Member Menu\n" +
                    "3. Rental Menu\n" +
                          "4. Media Menu\n" +
                    "5. Log Off\n\n" +
                    "Enter your choice");//asks the user for some input
            ch=Integer.parseInt(choice);//a class that wraps a value of the primitive type int in an object
            return ch;//a method that returns an integer value
        }//end getChoice
        public static void getSelected(int choice){
            if(choice == 1) {
                   product();
            }//end if
            if(choice==2){
               member();
            }//end if
            if(choice==3){
               rental();
            }//end if
                if(choice==4){
               media();
            }//end if
                if(choice==5){
                   LogOff logoff=new LogOff();
                }//end if
                else{
                   JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
                   System.exit(0);
        }//end getSelected
        public static void product(){
             int productChoice=-1;//a variable of type int that is set to -1
           productChoice=getProductChoice();//invokes the method getChoice()
           if(productChoice!=0){
              getProductSelected(productChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice(); 
        public static void member(){
           int memberChoice=-1;//a variable of type int that is set to -1
           memberChoice=getMemberChoice();//invokes the method getChoice()
           if(memberChoice!=0){
              getMemberSelected(memberChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice(); 
        public static void rental(){
           int rentalChoice=-1;//a variable of type int that is set to -1
           rentalChoice=getRentalChoice();//invokes the method getChoice()
           if(rentalChoice!=0){
              getRentalSelected(rentalChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice();
          public static void media(){
           int mediaChoice=-1;//a variable of type int that is set to -1
           mediaChoice=getMediaChoice();//invokes the method getChoice()
           if(mediaChoice!=0){
              getMediaSelected(mediaChoice);//invokes the method getSelected(choice)
           }//end if
           getChoice(); 
          public static int getProductChoice(){
           String productChoice;//a variable of type string
           int pch;//a variable of type int
           productChoice=JOptionPane.showInputDialog(null,
                   "1. Add product details\n" +
                   "2. View product details\n" +
                   "3. Edit product details\n" +
                         "4. Delete product details\n" +
                   "5. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           pch=Integer.parseInt(productChoice);//a class that wraps a value of the primitive type int in an object
           return pch;//a method that returns an integer value
        }//end getProductChoice
          public static int getMemberChoice(){
           String memberChoice;//a variable of type string
           int mch;//a variable of type int
           memberChoice=JOptionPane.showInputDialog(null,
                   "1. Add member details\n" +
                   "2. View member details\n" +
                   "3. Edit member details\n" +
                             "4. Delete member details\n" +
                   "5. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           mch=Integer.parseInt(memberChoice);//a class that wraps a value of the primitive type int in an object
           return mch;//a method that returns an integer value
        }//end getMemberChoice
          public static int getRentalChoice(){
           String rentalChoice;//a variable of type string
           int rch;//a variable of type int
           rentalChoice=JOptionPane.showInputDialog(null,
                   "1. Add rental details\n" +
                   "2. View rental details\n" +
                   "3. Edit rental details\n" +
                             "4. Delete rental details\n" +
                   "5. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           rch=Integer.parseInt(rentalChoice);//a class that wraps a value of the primitive type int in an object
           return rch;//a method that returns an integer value
        }//end getRentalChoice
          public static int getMediaChoice(){
           String mediaChoice;//a variable of type string
           int mtch;//a variable of type int
           mediaChoice=JOptionPane.showInputDialog(null,
                   "1. Listen to songs\n" +
                             "2. View movie previews\n" +
                             "3. View game previews\n" +
                   "4. Return to main menu\n\n" +
                   "Enter your choice");//asks the user for some input
           mtch=Integer.parseInt(mediaChoice);//a class that wraps a value of the primitive type int in an object
           return mtch;//a method that returns an integer value
        }//end getMediaChoice
          public static void getProductSelected(int productChoice){
           if(productChoice==1){
                  addProducts();
           }//end if
           if(productChoice==2){
              viewProducts();
           }//end if
           if(productChoice==3){
              editProducts();
           }//end if
               if(productChoice==4){
              deleteProducts();
           }//end if
               else{
                   JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
                   System.exit(0);
        }//end getProductSelected
          public static void getMemberSelected(int memberChoice){
           if(memberChoice==1){
                  addMembers();
           }//end if
           if(memberChoice==2){
              viewMembers();
           }//end if
           if(memberChoice==3){
              editMembers();
           }//end if
               if(memberChoice==4){
              deleteMembers();
           }//end if
               else{
                   JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
                   System.exit(0);
        }//end getMemberSelected
          public static void getRentalSelected(int rentalChoice){
           if(rentalChoice==1){
                  addRentals();
           }//end if
           if(rentalChoice==2){
              viewRentals();
           }//end if
           if(rentalChoice==3){
              editRentals();
           }//end if
               if(rentalChoice==4){
              deleteRentals();
           }//end if
               else{
                   JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
                   System.exit(0);
        }//end getRentalSelected
          public static void getMediaSelected(int mediaChoice){
           if(mediaChoice==1){
                  hearSongs();
           }//end if
           if(mediaChoice==2){
              viewMovies();
           }//end if
           if(mediaChoice==3){
              viewGames();
           }//end if
               else{
                   JOptionPane.showMessageDialog(null,"Error\n\nInvalid options\nPlease choose 1, 2, 3, 4 or 5 on the main menu\nPlease choose 1, 2, 3, 4 or 5 on the product menu\nPlease choose 1, 2, 3, 4 or 5 on the member menu\nPlease choose 1, 2, 3, 4 or 5 on the rental menu\nPlease choose 1, 2, 3 or 4 on the media menu");
                   System.exit(0);
        }//end getMediaSelected
          public static void addProducts(){
           ProductForm product=new ProductForm();
           product.getInput();
               product.setVisible(true);
          public static void viewProducts(){
           DatabaseTest tt=new DatabaseTest();
               tt.setVisible(true);
          public static void editProducts(){
           ProductForm product=new ProductForm();
               product.getInput();
               product.setVisible(true);
          public static void deleteProducts(){
           ProductForm product=new ProductForm();
               product.setVisible(true);
          public static void addMembers(){
           MemberForm member=new MemberForm();
               member.getInput();
               member.setVisible(true);
          public static void viewMembers(){
           DatabaseTest tt=new DatabaseTest();
               tt.setVisible(true);
          public static void editMembers(){
           MemberForm member=new MemberForm();
               member.getInput();
               member.setVisible(true);
          public static void deleteMembers(){
           MemberForm member=new MemberForm();
               member.setVisible(true);
          public static void addRentals(){
           RentalForm rental=new RentalForm();
               rental.getInput();
               rental.setVisible(true);
          public static void viewRentals(){
           DatabaseTest tt=new DatabaseTest();
               tt.setVisible(true);
          public static void editRentals(){
           RentalForm rental=new RentalForm();
               rental.getInput();
               rental.setVisible(true);
          public static void deleteRentals(){
           RentalForm rental=new RentalForm();
               rental.setVisible(true);
        public static void hearSongs(){
           MediaTest media=new MediaTest(); 
        public static void viewMovies(){
           MediaTest media=new MediaTest();   
        public static void viewGames(){
           MediaTest media=new MediaTest();   
    }//end class Demo
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.io.IOException;
    import java.net.URL;
    import javax.media.CannotRealizeException;
    import javax.media.Manager;
    import javax.media.NoPlayerException;
    import javax.media.Player;
    import javax.swing.JPanel;
    public class MediaPanel extends JPanel{
       public MediaPanel(URL mediaURL){
          setLayout(new BorderLayout());//use a BorderLayout
          //Use lightweight components for Swing compatibility
          Manager.setHint(Manager.LIGHTWEIGHT_RENDERER,true);
          try{
             //create a player to play the media specified in the URL
             Player mediaPlayer=Manager.createRealizedPlayer(mediaURL);
             //get the components for the video and the playback controls
             Component video=mediaPlayer.getVisualComponent();
             Component controls=mediaPlayer.getControlPanelComponent();
             if(video!=null)
                add(video,BorderLayout.CENTER);//add video component
             if(controls!=null)
                add(controls,BorderLayout.SOUTH);//add controls
             mediaPlayer.start();//start playing the media clip
          }//end try
          catch(NoPlayerException noPlayerException){
             System.err.println("No media player found");
          }//end catch
          catch(CannotRealizeException cannotRealizeException){
             System.err.println("Could not realize media player");
          }//end catch
          catch(IOException iOException){
             System.err.println("Error reading from the source");
          }//end catch
       }//end MediaPanel constructor
    }//end class MediaPanel
    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    public class MediaTest{
       //launch the application
       public static void main(String args[]){
          //create a file chooser
          JFileChooser fileChooser=new JFileChooser();
          //show open file dialog
          int result=fileChooser.showOpenDialog(null);
          if(result==JFileChooser.APPROVE_OPTION){//user chose a file
             URL mediaURL=null;
             try{
                //get the file as URL
                mediaURL=fileChooser.getSelectedFile().toURL();
             }//end try
             catch(MalformedURLException malformedURLException){
                System.err.println("Could not create URL for the file");
             }//end catch
             if(mediaURL!=null) {//only display if there is a valid URL
                JFrame mediaTest=new JFrame("Media Tester");
                mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                MediaPanel mediaPanel=new MediaPanel(mediaURL);
                mediaTest.add(mediaPanel);
                mediaTest.setSize(300,300);
                mediaTest.setVisible(true);
             }//end inner if
          }//end outer if
       }//end main
    }//end class MediaTest

Maybe you are looking for

  • Spry Menu Bar issue, NEED HELP...???

    Here is the coding for a menu bar that i created with CS3, for some reason i am having an issue when i open the web page in IE, on firefox and safari it looks fine, the menu drops down to sub menu's fine, but for some reason when i open it in IE, the

  • Is there a MAC Book to Component video adapter

    I have a club customer who wants to play music videos off of the DJ's MAC. There will be different MAC's coming in. Is there a MAC to component adapter available?

  • Female to female mini-displayport cable or adapter anyone?

    All that fuss about mini displayport to mini dvi adapter and even to micro dvi for the MBAs - let's face it, its not gonna happen people. Jobs has made it pretty clear about that, so lets stop hoping. Instead lets look forward, and now since mini dis

  • Icons in the favorites bar and the folder icons do not appear

    Hi , I have installed the public beta of OS X Yosemite , but when I look in Finder there is only text in the favorites bar and not the icons , but when I click on one of the text there is a icon but it doesn't stay there and I can't see the folder ic

  • Some Intune users cannot enrol from Windows Phone

    I have 16 defined users for my Windows Intune account but only about 5 of them can enrol using Windows Phone 8 and Windows Phone 8.1. I have checked that all the users are enabled. Using the same phone the first 5 users can enrol and all the others c