Trying to make my own java library need help!

I have been trying to make a java library that will save data in cdf format.
Every time I try to implement code using this library i created i get the error shown below, I put the jar file in the jdk/jre/lib/ext file, so when I import it, it does work. But i dont know know what to do with this error any insight would be greatly appreciated,
Constructor
You are connected to the OSACBM sever...
new.xml has been recieved and unmarshalled
ELEMENT: DAInt:
DAInt value: 34
DAInt id: 2000
Exception in thread "main" java.lang.UnsatisfiedLinkError: no cdfNativeLibrary in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at gsfc.nssdc.cdf.CDFNativeLibrary.<clinit>(CDFNativeLibrary.java:47)
at gsfc.nssdc.cdf.CDF.create(CDF.java:221)
at osacbm_client_.CDFHandler.InitializeCDF_File(CDFHandler.java:45)
at osacbm_client_._Client.Unmarshaller(_Client.java:64)
at osacbm_client_._Client.<init>(_Client.java:25)
at osacbm_client_.Main.main(Main.java:19)
Java Result: 1

OK, I checked the javadoc myself, and although the text is clear and correct I acknowledge it doesn't help you a lot to investigate the problem, so I'll try to give out a clue:
-> your problem is that the JVM does find your jar, but doesn't file the native library it depends on (+"cdfNativeLibrary"+).
You should locate the shared library file (+cdfNativeLibrary.dll+ or cdfNativeLibrary.so depending on your OS), and make sure your PATH variable contains its folder, or add this folder to the java.library.path system property (specified as -D java.library.path=<path/to/folder/containing/libfile> in the launching command line).
Note that it's not clear from your message if you're writing the gsfc library or a client of it:
- It the former, and if you're new to Java, then be aware that integrating a native library is not the easiest way to learn Java; just in case, make sure you read and understand a JNI tutorial (for Java Native Interface; I was willing to push you a link, but I realize the [Java tutorial|http://java.sun.com/docs/books/tutorial/] has no such chapter, which reinforces that it is an advanced topic).
- If the latter, then how to install the library's components should be documented in its manual.

Similar Messages

  • Using a MacBookPro-trying to add my own captioning.  need help!

    I've been able to figure out how to add closed captioning - have enabled to see Closed captioning but it's not showing up on the preview screen.  It WAS but now it's not.  what have I done wrong?

    A screenshot might help diagnose the problem. Please make sure all of the following are visible:
    the caption track in the timeline, expanded to show the caption blocks.
    the Captions panel
    the Program Monitor, ideally with the Closed Captions button displayed.
    the Closed Captioning Display Settings dialog

  • HT3819 For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

    For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

    For home sharing do you have to use one apple ID? Im trying to make my own new account for all my devices (iphone, ipad, mac) , but i still want the music from my dads account.

  • Image size and mime type.. non-java guy needs help

    Image size, mime type.. non-java guy needs help
    Im not at all familiar with java so this is really weird for me to work out. I?ve been doing it all day (and half of yesterday).
    Im trying to write a custom clodFusion tag in java that gets the width, height, size and MIME types of a given file. I?ve been trying to get it to work on the command line first. I can get the width and height but cant get the size and the MIME type.
    Here is what I got
    /*import com.allaire.cfx.*;*/
    import java.awt.image.renderable.*;
    import javax.media.jai.*;
    import com.sun.media.jai.codec.*;
    import java.io.*;
    import java.util.*;
    public class ImageInfo {
    private RenderedOp image = null;
    private RenderedOp result = null;
    private int height = 0;
    private int width = 0;
    private String type = "";
    private String size = "";
    public void loadf(String file) throws IOException
    file = "80by80.jpg";
    FileSeekableStream fss = new FileSeekableStream(file);
    image = JAI.create("stream", fss);
    height = image.getHeight();
    width = image.getWidth();
    System.out.println(height + "\n");
    System.out.println(width);
    System.out.println(type);
    public static void main(String[] args) throws IOException {
    ImageInfo test = new ImageInfo();
    test.loadf(args[0]);
    can anyone please help me out to modify the above so I can also print the mime type and the file size to screen.
    thanks for any help

    any suggestions?

  • Rookie trying to make my own package

    Reading in a real good book - "Thinking in Java" by Bruce Eckel. Really helping me to understand better a lot of the stuff that I had in my Java course at school.
    Got to a section where he's showing how to make your own packages. I'll lift directly:
    Consider, for
    example, creating an alias for System.out.println(�) to reduce
    typing. This can be part of a package called tools:
    //P.java
    // The P.rint & P.rintln shorthand.
    package com.bruceeckel.tools;
    public class P {
    public static void rint(String s) {
    System.out.print(s);
    public static void rintln(String s) {
    System.out.println(s);
    You can use this shorthand to print a
    String either with a newline (P.rintln(�)) or without a
    newline (P.rint(�)).
    So, I cut and pasted right into the text editor I use to practice with, saved and compiled it in a subdirectory off of one of the directories in the CLASSPATH, followed with a little test program:
    //ToolTest.java
    import com.bruceeckel.tools.*;
    public class ToolTest {
    public static void main(String[] args) {
    P.rintln("Available from now on!");
    P.rintln("" + 100); // Force it to be a String
    P.rintln("" + 100L);
    P.rintln("" + 3.14159);
    Here's the result of the compile:
    C:\Thinking in Java\com\bruceeckel\tools>javac ToolTest.java
    ToolTest.java:3: Package com.bruceeckel.tools not found in import.
    import com.bruceeckel.tools.*;
    ^
    1 error
    C:\Thinking in Java\com\bruceeckel\tools>
    At first I tried doing it on my own, making up my own package name, creating my own little source files, but got the same error. So I cut and pasted directly from the book, thinking surely it would work if I used Eckel's own code. Nope.
    Any clue what's going wrong? I've checked the CLASSPATH carefully, it includes
    C:\Thinki~1
    Thanks
    Felecha

    Your classpath should include "C:\Thinking in Java", not C:\Thinki~1.
    Also, your ToolTest.java should be in some other folder than "C:\Thinking in Java\com\bruceeckel\tools" - javac may act weird when it can find the to-be-imported classes in both the current folder and the classpath.
    If ToolTest.java had been in the folder "C:\Thinking in Java" you wouldn't have needed to modify the classpath.

  • OK, now I tried to make my own spry photo album

    but when I tried to name my own images and substitute their
    names in the xml code in the following manner:
    <photo
    path = "travel_01.jpg" //changed to "buildings_01.jpg"
    width = "263"
    height = "350"
    thumbpath = "travel_01.jpg"
    thumbwidth = "56"
    thumbheight = "75">
    </photo>
    <photo
    path = "travel_02.jpg" //changed to "buildings_02.jpg"
    width = "350"
    height = "263"
    thumbpath = "travel_02.jpg"
    thumbwidth = "75"
    thumbheight = "56">
    </photo>
    the photo album didn't work... does anyone know why?
    thank you for your help in advance
    Betsy w.

    The other important thing is that the <img src path
    matches your folder structure.
    In our gallery samples, we are dynamically generating the img
    path with data references. I would start by hardcoding an image
    path that works, so you know your path is correct. Then replace the
    image name with the data reference.
    <img src="mypath/totheimage/travel_01.jpg">
    When that works, then change to:
    <img src="mypath/totheimage/{@path}">
    Let me know if that helps.
    Don

  • Java noob needing help - First applet won't compile

    I'm trying to make a simple audio player applet for a web page. The basic way it works is: There are four buttons Play 1, Play 2, Play 3 and Stop, as well as a label for applet credits, a label for music credits and a label for the applet's current status.
    This is the applet so far:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    public class wifflesaudio extends Applet implements MouseListener {
    add(new Label("(applet credits"));
    add(new Label("(music credits"));
    Label labelDoing = new Label("Stopped");
    Button buttonOne = new Button("Play 1");
    Button buttonTwo = new Button("Play 2");
    Button buttonThree = new Button("Play 3");
    Button buttonStop = new Button("Stop");
    add(buttonOne);
    add(buttonTwo);
    add(buttonThree);
    add(buttonStop);
    addMouseListener(this);
    String clipName[] = {getParameter("clipOne"),
    getParameter("clipTwo"),
    getParameter("clipThree")};
    AudioClip clipOne;
    AudioClip clipTwo;
    AudioClip clipThree;
    int whichIsPlaying = 0;
    public void loadClip(int clipNumber) {
    switch (clipNumber) {
    case 1:
    if (AudioClip.clipOne == null) {
    try {
    labelDoing = "Loading clip 1...";
    clipOne = Applet.newAudioClip(newURL(getCodeBase(), clipName[1]));
    catch (MalformedURLException e) {
    labelDoing = "WARNING: clip 1 didn't load";
    if (clipOne != null) {
    clipTwo.stop();
    clipThree.stop();
    clipOne.loop();
    whichIsPlaying = 1;
    break;
    case 2:
    if (clipTwo == null) {
    try {
    labelDoing = "Loading clip 2...";
    clipTwo = Applet.newAudioClip(newURL(getCodeBase(), clipName[2]));
    catch (MalformedURLException e) {
    labelDoing = "WARNING: clip 2 didn't load";
    if (clipTwo != null) {
    clipOne.stop();
    clipThree.stop();
    clipTwo.loop();
    whichIsPlaying = 2;
    break;
    case 3:
    if (clipThree == null) {
    try {
    labelDoing = "Loading clip 3...";
    clipThree = Applet.newAudioClip(newURL(getCodeBase(), clipName[3]));
    catch (MalformedURLException e) {
    labelDoing = "WARNING: clip 3 didn't load";
    if (clipTwo != null) {
    clipOne.stop();
    clipTwo.stop();
    clipThree.loop();
    whichIsPlaying = 3;
    break;
    public void actionPerformed(ActionEvent evt) {
    Button source = (Button)evt.getSource();
    if (source.getLabel().equals("Play 1")) {
    loadClip(1);
    if (source.getLabel().equals("Play 2")) {
    loadClip(2);
    if (source.getLabel().equals("Play 3")) {
    loadClip(3);
    if (source.getLabel().equals("Stop")) {
    clipOne.stop();
    clipTwo.stop();
    clipThree.stop();
    Naturally, it doesn't work. When I try to compile it with javac I get 21 errors thrown back at me. Being the noob that I am I have absolutely no idea why it isn't working, so I'm turning to all you clever people for some advice. :)

    Think anyone's going to copy your code into their own machine and compile it to see those messages for you? Well I did. Since there are a zillion error messages, I think it's fair to help a little bit:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    // no need to implement MouseListener
    // see below
    public class wifflesaudio extends Applet {
        Label labelDoing = new Label("Stopped");
        Button buttonOne = new Button("Play 1");
        Button buttonTwo = new Button("Play 2");
        Button buttonThree = new Button("Play 3");
        Button buttonStop = new Button("Stop");
        String[] clipName;
        AudioClip clipOne;
        AudioClip clipTwo;
        AudioClip clipThree;
        int whichIsPlaying = 0;
        // statements in JAVA must be located with methods or constructors
        // here is the default constructor (with no param)
        wifflesaudio() {
            add(new Label("(applet credits"));
            add(new Label("(music credits"));
            add(buttonOne);
            add(buttonTwo);
            add(buttonThree);
            add(buttonStop);
            clipName = new String[3];
            clipName[0] = getParameter("clipOne");
            clipName[1] = getParameter("clipTwo");
            clipName[2] = getParameter("clipThree");
            addMouseListener(new wifflesaudioMouseListener()); // instead of addMouseListener(this)
        public void loadClip(int clipNumber) {
            switch (clipNumber) {
            case 1:
                if (clipOne == null) {
                    try {
                        // To set the text of a label, you must use setText() method.
                        labelDoing.setText("Loading clip 1...");
                        clipOne = newAudioClip(new URL(getCodeBase(), clipName[1])); // 'new URL' instead of 'newURL'
                    } catch (MalformedURLException e) {
                        // To set the text of a label, you must use setText() method.
                        labelDoing.setText("WARNING: clip 1 didn't load");
                if (clipOne != null) {
                    clipTwo.stop();
                    clipThree.stop();
                    clipOne.loop();
                    whichIsPlaying = 1;
                break;
            case 2:
                if (clipTwo == null) {
                    try {
                        // To set the text of a label, you must use setText() method.
                        labelDoing.setText("Loading clip 2...");
                        clipTwo = newAudioClip(new URL(getCodeBase(), clipName[2])); // 'new URL' instead of 'newURL'
                    } catch (MalformedURLException e) {
                        // To set the text of a label, you must use setText() method.
                        labelDoing.setText("WARNING: clip 2 didn't load");
                if (clipTwo != null) {
                    clipOne.stop();
                    clipThree.stop();
                    clipTwo.loop();
                    whichIsPlaying = 2;
                break;
            case 3:
                if (clipThree == null) {
                    try {
                        // To set the text of a label, you must use setText() method.
                        labelDoing.setText("Loading clip 3...");
                        clipThree = newAudioClip(new URL(getCodeBase(), clipName[3])); // 'new URL' instead of 'newURL'
                    } catch (MalformedURLException e) {
                        // To set the text of a label, you must use setText() method.
                        labelDoing.setText("WARNING: clip 3 didn't load");
                if (clipTwo != null) {
                    clipOne.stop();
                    clipTwo.stop();
                    clipThree.loop();
                    whichIsPlaying = 3;
                break;
        public void actionPerformed(ActionEvent evt) {
            Button source = (Button)evt.getSource();
            if (source.getLabel().equals("Play 1")) {
                loadClip(1);
            if (source.getLabel().equals("Play 2")) {
                loadClip(2);
            if (source.getLabel().equals("Play 3")) {
                loadClip(3);
            if (source.getLabel().equals("Stop")) {
                clipOne.stop();
                clipTwo.stop();
                clipThree.stop();
        // Extending MouseAdapter instead of implementing MouseListener
        // allows NOT to code ALL the methods from MouseListener
        // MouseAdapter already implements MouseListener with empty methods
        // You then just code the method(s) that is (are) needed.
        class wifflesaudioMouseListener extends MouseAdapter {
    }Please next time paste your code between code tags exactly like this:
    &#91;code&#93;
    your code
    &#91;/code&#93;
    Thank you

  • IMac: Install Java 7 need help!

    Hello, I've an iMac with the newest software version, I want to install java 7 on it for a game server, but when I download it from java.com and I install it and start the server, it still says: Computer on java 6, update to 7 to run server. I already tryed to install with Terminal and direct acess to System Library, it shows that java 7 is installed, but I have to delete java 6. When I delete all java versions, apple says I have to install java SE6, what isn't java 7 but java 6! Help please!!!

    The Oracle JRE is only a web plugin. If you need server-side Java, you'll have to use the Apple-supplied Java 6 runtime, or else the Oracle JDK (which is not a drop-in replacement for Apple's Java.) If your server application depends on Java 7, you'll most likely have to run it on another operating system.

  • Newbie to Java who needs help..

    Hello all.
    I am having some troubles making a random walker/Drunkard. What I have to do is make it that the user inputs the starting X, Y coordinates and the amount of steps he has to walk. After that, it is post to print back the new coordinates he walked to and the distance of his new coordinates is to the starting one. I am new to java so I am confused.. This is what I have so far..
    import java.util.*;
    public class Drunkard {
        private int x;
        private int y;
        private int numSteps;
        private int Distance;
        private int moveDrunk;
        public Drunkard() {
            this.x = x;
            this.y = y;
            this.numSteps = 0;
        public int getX() {
            return x;
        public int getY() {
            return y;
         public int getSteps() {
            return this.numSteps;
        private void move(int numSteps);
        private void moveDrunk(){
        moveDrunk = (int) (Math.random() * 4);
        public int getmoveDrunk() {
            return moveDrunk;
    public boolean getDistance{
    (int)(Math.sqrt((getX()*getX()) + (getY()*getY())));{
    return Distance
    import java.util.Scanner;
    public class DrunkardSimulator
        public static void main (String[] args)
            Scanner scan = new Scanner(System.in);
            System.out.print ("Enter the number of steps: ");
            numSteps = scan.nextInt();
            System.out.print ("Enter the starting x coordinate: ");
            x = scan.nextInt();
            System.out.print ("Enter the starting y coordinate: ");
            y = scan.nextInt();
            Drunkard drunk = new Drunkard();
            System.out.println("The drunk moved to X" +drunk.getX() + ", y " + drunk.getY() && "a distance of " + drunk.getDistance());
    }Any help would be nice.
    Edited by: orlfman on Apr 9, 2008 5:26 PM

    Sorry. I should have stated what I need help with..
    I need help with making him move randomly when the user types in the x,y starting coords, and the amount of steps he has to walk from what the user inputs. I also need help printing out the new x,y coords he walked to randomly and the distance his new coords are from where he first started at (the coords the user the typed in.)
    I have two files:
    Drunkard.java
    import java.awt.*;
    import java.util.*;
    public class Drunkard {
        private int x;
        private int y;
        private int numSteps;
        private int Distance;
        private int moveDrunk;
        public Drunkard(int x, int y) {
            this.x = x;
            this.y = y;
            this.numSteps = 0;
        public int getX() {
            return x;
        public int getY() {
            return y;
         public int getSteps() {
            return this.numSteps;
        public void moveDrunk(int numSteps){
             for (int i=0;i<numSteps;i++) {
            if(rand.nextInt(2)==1) { x+=1; } else { y+=1; } }
        public int getDistance(){
    (int)(Math.sqrt((getX()*getX()) + (getY()*getY())));{
    return Distance
      }And DrunkardSimulator.java
    import java.util.Scanner;
    public class DrunkardSimulator
        public static void main (String[] args)
    int x;
    int y;
    int numSteps;
            Scanner scan = new Scanner(System.in);
            System.out.print ("Enter the number of steps: ");
            numSteps = scan.nextInt();
            System.out.print ("Enter the starting x coordinate: ");
            x = scan.nextInt();
            System.out.print ("Enter the starting y coordinate: ");
            y = scan.nextInt();
            Drunkard drunk = new Drunkard(x,y);
            drunk.moveDrunk(5); //5 steps
            System.out.println("The drunk moved to X,Y" + drunk.getX() + drunk.getY() + drunk.getDistance());
    }Edited by: orlfman on Apr 10, 2008 12:29 AM
    Edited by: orlfman on Apr 10, 2008 12:31 AM

  • I received an email saying that my shipping/billing address has been changed, but I didn't make any changes. I need help

    I received an email saying that my shipping/billing address has been changed, but I didn't make any changes. I need help

    Then it's likely a scam email. Just ignore it and delete it.

  • Still trying to make my own Tags

    Here's what I've done:
    1. Taken one of my own pictures and resized it in editor down to 20x20 (same size as tags)
    2. Saved it in C:\Pragram files\photoshop elements 3\shared_assets\caticons with the name C_GreetingCards_N.png.
    The saved name matches the way Adobe names their caticons.
    3. I can see it in the directory tree under caticons but it doesn't show up in the palette in Organizer.
    I'm so close. Anyone got the answer to what I'm not doing?
    Thanks in advance.

    Jack....
    I just tried it again on my PC and it works fine....
    1. Start the Editor and open one of the Cat Icon Images.
    2. Delete all the contents and add your own or just modify whats there already. (or just create a new 20x20 pixel image)
    3. Save As with a new name and keeping the PNG file format.
    4. Close the image in the Editor and Open the Organiser.
    5. Go to the Tags Palette and click on the drop down arrow on the New Tag tab.
    6. Select the New Category option
    7. In the pop up window move the slider along underneath Category Icon until you see your own. Click to select it.
    Colin

  • JAVA newby needs help - second try

    Sorry I goofed up the first post!!
    I am trying to learn JAVA on my own and am stuck on using random numbers. My grandson is having problems in math (he is 7) and I want to create a math quiz that will generate two numbers between 0 and 10 and ask him for the correct answer. I understand the JOptionPane and how to display what I wan it to say (easy) but I do not know how to make the result of the sum of the two randoms be the required user (my grandson) input.
    Here is what I have (don't laugh it's a mess):
    /* ROMAD, January 21, 2007
    * Trying to write a Java program for
    * my grandson so he can practice and
    * learn how to multiply using two integer numbers*/
    package mathTest;
    import javax.swing.JOptionPane;
    import java.util.*;
    public class MathTest_1 {
        public static void main(String[] args) {
            Random randomNumbers = new Random();
            // pick random number values between 0 and 10
            int number1 = 1 + randomNumbers.nextInt(10); // first random number
            int number2 = 1 + randomNumbers.nextInt(10); // second random number
            String response;
            response = JOptionPane.showInputDialog("Enter the maximum number");
         // place random number values here and ask for correct number
            System.out.printf("How much is %d times %d\n", number1, number2);
            // ask player what is the answer
            response = JOptionPane.showInputDialog(null,"How much is %d * %d");
            if (response == null)
                JOptionPane.showMessageDialog(null,
                                              "You must enter a value first");
            else if (response.equals(""))
                JOptionPane.showMessageDialog(null, "Please try again");
                JOptionPane.showMessageDialog(null,
                                              "Great! Would you like to play again?");
            System.exit(0);
    }

    The JOptionPane returns user input as a String. Use Integer.parseInt() to parse the string answer to an int value, which you can then compare as needed.
    Here's an example: Converting Strings to Numbers
    ~

  • New to Java and need help with this program..please!

    I'd really appreciate any helpful comments about this program assignment that I have to turn in a week from Friday. I'm taking a class one night a week and completely new to Java. I'd ask my professor for help, but we can't call him during the week and he never answers e-mails. He didn't tell us how to call from other classes yet, and I just can't get the darn thing to do what I want it to do!
    The assignment requirements are:
    1. Change a card game application that draws two cards
    and the higher card wins, to a Blackjack application
    2. Include a new class called Hand
    3. The Hand class should record the number of draws
    4. The application should prompt for a number of draws
    5. The game is played against the Dealer
    6. The dealer always draws a card if the dealer's hand total is <= 17
    7. Prompt the player after each hand if he wants to quit
    8. Display the total games won by the dealer and total and the total games wond by the player after each hand
    9. Display all of the dealer's and player's cards at the
    end of each hand
    10. Player has the option of drawing an additional card after the first two cards
    11. The Ace can have a value of 11 or 1
    (Even though it's not called for in the requirements, I would like to be able to let the Ace have a value of 1 or an 11)
    The following is my code with some comments about a few things that are driving me nuts:
    import java.util.*;
    import javax.swing.*;
    import java.text.*;
    public class CardDeck
    public CardDeck()
    deck = new Card[52];
    fill();
    shuffle();
    public void fill()
    int i;
    int j;
    for (i = 1; i <= 13; i++)
    for (j = 1; j <= 4; j++)
    deck[4 * (i - 1) + j - 1] = new Card(i, j);
    cards = 52;
    public void shuffle()
    int next;
    for (next = 0; next < cards - 1; next++)
    int rand = (int)(Math.random()*(next+1));
    Card temp = deck[next];
    deck[next] = deck[rand];
    deck[rand] = temp;
    public final Card draw()
    if (cards == 0)
    return null;
    cards--;
    return deck[cards];
    public int changeValue()
    int val = 0;
    boolean ace = false;
    int cds;
    for (int i = 0; i < cards; i++)
    if (cardValue > 10)
    cardValue = 10;
    if (cardValue ==1)     {
    ace = true;
    val = val + cardValue;
    if ( ace = true && val + 10 <= 21 )
    val = val + 10;
    return val;
    public static void main(String[] args)
    CardDeck d = new CardDeck();
    int x = 3;
    int i;
    int wins = 1;
    int playerTotal = 1;
    do {
    Card dealer = (d.draw());
    /**I've tried everything I can think of to call the ChangeValue() method after I draw the card, but nothing is working for me.**/
    System.out.println("Dealer draws: " + dealer);
    do {
    dealer = (d.draw());
    System.out.println(" " + dealer);
    }while (dealer.rank() <= 17);
    Card mine = d.draw();
    System.out.println("\t\t\t\t Player draws: "
    + mine);
    mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
    do{
    String input = JOptionPane.showInputDialog
    ("Would you like a card? ");
    if(input.equalsIgnoreCase("yes"))
         mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
         playerTotal++;
         else if(input.equalsIgnoreCase("no"))
    System.out.println("\t\t\t\t Player stands");
         else
    System.out.println("\t\tInvalid input.
    Please try again.");
    I don't know how to go about making and calling a method or class that will combine the total cards delt to the player and the total cards delt to the dealer. The rank() method only seems to give me the last cards drawn to compare with when I try to do the tests.**/
    if ((dealer.rank() > mine.rank())
    && (dealer.rank() <= 21)
    || (mine.rank() > 21)
    && (dealer.rank() < 22)
    || ((dealer.rank() == 21)
    && (mine.rank() == 21))
    || ((mine.rank() > 21)
    && (dealer.rank() <= 21)))
    System.out.println("Dealer wins");
    wins++;
         else
    System.out.println("I win!");
    break;
    } while (playerTotal <= 1);
    String stop = JOptionPane.showInputDialog
    ("Would you like to play again? ");
    if (stop.equalsIgnoreCase("no"))
    break;
    if (rounds == 5)
    System.out.println("Player wins " +
    (CardDeck.rounds - wins) + "rounds");
    } while (rounds <= 5);
    private Card[] deck;
    private int cards;
    public static int rounds = 1;
    public int cardValue;
    /**When I try to compile this nested class, I get an error message saying I need a brace here and at the end of the program. I don't know if any of this code would work because I've tried adding braces and still can't compile it.**/
    class Hand()
    static int r = 1;
    public Hand() { CardDeck.rounds = r; }
    public int getRounds() { return r++; }
    final class Card
    public static final int ACE = 1;
    public static final int JACK = 11;
    public static final int QUEEN = 12;
    public static final int KING = 13;
    public static final int CLUBS = 1;
    public static final int DIAMONDS = 2;
    public static final int HEARTS = 3;
    public static final int SPADES = 4;
    public Card(int v, int s)
    value = v;
    suit = s;
    public int getValue() { return value; }
    public int getSuit() { return suit;  }
    public int rank()
    if (value == 1)
    return 4 * 13 + suit;
    else
    return 4 * (value - 1) + suit;
    /**This works, but I'm confused. How is this method called? Does it call itself?**/
    public String toString()
    String v;
    String s;
    if (value == ACE)
    v = "Ace";
    else if (value == JACK)
    v = "Jack";
    else if (value == QUEEN)
    v = "Queen";
    else if (value == KING)
    v = "King";
    else
    v = String.valueOf(value);
    if (suit == DIAMONDS)
    s = "Diamonds";
    else if (suit == HEARTS)
    s = "Hearts";
    else if (suit == SPADES)
    s = "Spades";
    else
    s = "Clubs";
    return v + " of " + s;
    private int value; //Value is an integer, so how can a
    private int suit; //string be assigned to an integer?
    }

    Thank you so much for offering to help me with this Jamie! When I tried to call change value using:
    Card dealer = (d.changeValue());
    I get an error message saying:
    Incompatible types found: int
    required: Card
    I had my weekly class last night and the professor cleared up a few things for me, but I've not had time to make all of the necessary changes. I did find out how toString worked, so that's one question out of the way, and he gave us a lot of information for adding another class to generate random numbers.
    Again, thank you so much. I really want to learn this but I'm feeling so stupid right now. Any help you can give me about the above error message would be appreciated.

  • JAVA newby needs help

    I am trying to learn JAVA on my own and am stuck on using random numbers. My grandson is having problems in math (he is 7) and I want to create a math quiz that will generate two numbers between 0 and 10 and ask him for the correct answer. I understand the JOptionPane and how to display what I wan it to say (easy) but I do not know how to make the result of the sum of the two randoms be the required user (my grandson) input.
    Here is what I have (don't laugh it's a mess):
    /* ROMAD, January 21, 2007
    * Trying to write a Java program for
    * my grandson so he can practice and
    * learn how to multiply using two integer numbers*/
    package mathTest;
    import javax.swing.JOptionPane;
    import java.util.*;
    public class MathTest_1 {
        public static void main(String[] args) {
            Random randomNumbers = new Random();
            // pick random number values between 0 and 10
            int number1 = 1 + randomNumbers.nextInt(10); // first random number
            int number2 = 1 + randomNumbers.nextInt(10); // second random number
            String response;
            response = JOptionPane.showInputDialog("Enter the maximum number");
         // place random number values here and ask for correct number
            System.out.printf("How much is %d times %d\n", number1, number2);
            // ask player what is the answer
            response = JOptionPane.showInputDialog(null,"How much is %d * %d");
            if (response == null)
                JOptionPane.showMessageDialog(null,
                                              "You must enter a value first");
            else if (response.equals(""))
                JOptionPane.showMessageDialog(null, "Please try again");
                JOptionPane.showMessageDialog(null,
                                              "Great! Would you like to play again?");
            System.exit(0);
    }

    > Done! I goofed it up but sent out another formatted correctly
    It's typically considered good form to continue in the same thread rather than starting a new one. At the very least, you'll want to provide a link to the new thread (as in reply #3), so people aren't answering your question in two different threads.
    ~

  • J2me and java card, need help to communicate

    we are trying to put together a reader to read smartcards using j2me and we figure that it would be easiest if we could develop it to work with java cards rather than standard smart cards, the problem is we get garbage when we communicate to it, the chip sends us crap, any suggestions what might be wrong, any calls we might be missing, has anyone worked with j2me and java cards or smart cards, any help would be appreciated.
    einar

    .... reader app and the ME behind it .... smells like mobile ....
    First of all - if you want to have one mobile application running on this just make sure that whatever is written in ME can use drivers from the reader chip ....
    Workin on the PC is something completely different. There was one good example how to develop one host application in Java provided with the JCOP tools long ago ... I don't know if this is now in the new Eclipse tools.
    But - there was a small API provided that can give you good hints what to do - and - once you have it on the reader side - you can easily integrate ME methods with this ...

Maybe you are looking for

  • How many times can you reinstall Mountain Lion?

    Since I bought the Early 2013 15" MacBook Pro retina laptop used only 17 battery cycles on it now (2.7 with 16GB ram running Mt. Lion) computer I have not reset it. I spoke to Apple and it is registered in my name, I made a new Admin. account and pas

  • IMac G5 blinking power light / won't turn on

    When my iMac G5 is hooked up to power, the power light (front bottom right panel) faintly blinks once every 2 seconds or so. The monitor is not on at all, and the computer does not appear to be running (no sounds). All other devices hooked up to that

  • CS5 Stereo Audio clip - How do I edit R & L channels separately?

    If a clip has both R & L recorded, what is the easiest way to only hear one track.  I want to manipulate the song so when it plays it goes from right speaker to left speaker and back around again. I have CS5 Master Collection (S&T edition) HP pc

  • Lightroom 3.2-64 Bit. will not start -It said-opening Catalog:DSC0024.then shuts down

    I have downloaded Lightroom 3.2-64 Bit . When i start the software it gives me the message" Lightroom-opening Catalog:DSC0024.JPG.Ircat" Then a window opens and said " Adobe Photoshop lightroom 64-bit has stoped working. A problem caused this program

  • Converting pdf file in Hebrew to Word

    I tried to convert a pdf file in Hebrew to Word - when it came out in Word, the letters of each word were fine, but the order of the letters is backwards (Hebrew reads from left to right), making the whole document useless.  How can I convert the fil