Java 3D help

Hey!
this may sound like a newbish kinda question but i searched the forum and nothing has helped me.
I want to learn java 3d, but i dont know how to do it.
What code do i need to use java 3d and create 3d objects? I heard alot about some kind of plug in, do i need to get somthing to use java3d? i just want somthing that can start me off. code, websites, topics, etc.
Many thanks.

There's more here than the Forums. Searching the Developers' Site (upper right corner of screed) with "3d" yielded a list with http://java.sun.com/products/java-media/3D/ as the first entry.
Start there.

Similar Messages

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • Java Access Helper problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    sorry ab the multiple post, it was urgent for me to
    know the answer.
    I've JDK 1.4.2 and JAccessHelper should work with 1.3
    or later
    Can there be some kind of path problems?No, I doubt it. It's just some internal app failure - looks like it's trying to determine the running Java version, and is not doing a good job at it. But the failure has nothing per se to Java, it's that specific app - what are we supposed to know about that app though?

  • New to java(need help on access specifier)

    hi! i am new to java.plzzzzz help me i have to make a project on access specifier's i know all theroy.but
    i am unable to understand how i can define all specifiers practicly.i mean in a program.
    thanks.plzzzzzzzz help me

    the most common project i can think of is a payroll system..
    you can have real implementation of all the access specifiers
    good luck

  • Pascal to Java Please help me!

    I am truobled in creating a validation method for the user loging in....
    As I am perfect at Pascal can anyone translate the following pascla code to Java Please help me with this.
    PROGRAM USERLOGIN;
    TYPE
      USER_TYPE = RECORD
        USERNAME : STRING[15];
        PASSWORD : STRING[15];
    END;
        USFILE = FILE OF USER_TYPE;
    VAR
       USER: USER_TYPE;
       CKUSER: USER_TYPE;
       RECFILE : USFILE;
       I,J     : INTEGER;
    BEGIN
    WRITE('ENTER USERNAME:');READLN(CKUSER.USERNAME);
    WRITE('ENTER PASSWORD:');READLN(CKUSER.PASSWORD);
    FILESPEC :='USERFILE.USR';
    ASSIGN(RECFILE, FILESPEC);
    RESET(RECFILE);
      WHILE NOT EOF(RECFILE) DO
       BEGIN
         READ(RECFILE, USER);
         IF CKUSER.USERNAME = USER.USERNAME AND CKUSER.PASSWORD = USER.PASSWORD THEN
              LOGIN
        ELSE
              WRITE('USER NOT FOUND');
       END;
    END.Thank you

    Don't bother:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=539277

  • How I can enable Java ssv helper plugin silently for win7 users with IE9

    here is what happens:
    when I deploy java 7.21 on win7 users, after deployment when users try to Open their IE they get a login screen and apparently it is related to Java ssv helper plugin. it is trying to enable it and needs admin account/password. I am trying to deploy this to about 3000 computers and I dont want all of them start calling helpdesk for this.
    your help is appreciated.

    The following article describes how to create a shared preference file. You can either create preferences that individual users can override, or create locked preferences that individual users cannot override.
    http://kb.mozillazine.org/Lock_Prefs
    (Note: I don't have any personal experience with these files, but another volunteer might post some additional tips and tricks.)

  • MS Access and Java JDBC help!

    Hello, I having trouble with a java GUI.
    I have a MS Access named Database.mdb with a table named Customer which I want my GUI to access.
    I want my GUI to be able to flick through the records using the field I have made for them.
    I already have connected the database using windows xp's "System DSN" and have no problem creating tables using sql statements in my code
    Who can help me? any information would be great.
    Thanks

    I'm doing an inventory software application too...but my application is an automatic software inventory, is automatic your application??
    My result is the software that are intalled in a machine..is your project too?
    Sorry, my english is not very good...

  • Why the same name of process comes out in AIX , in java. please help me.

    Hello.
    I have two questions related to Jvm.
    I've developed Job scheduler program which is doing somthing as the DB schedule is set in the way of Multi
    thread. Currently , I'm in the process of testing this one. It is good , if in the normal case. However, When
    doing Shell, if the application have so a lot to do the Shell, it has a little problem.
    My developing environment is
    OS : AIX 5.3
    JRE : IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr7-20091214_49398
    (JIT enabled, AOT enabled)
    nofiles(descriptors) 2000
    maxuproc 4096 Maximum number of PROCESSES allowed
    per user True
    In order to execute Shell in My Scheduler program , I tested Runtimeexec() or ProcessBuilder.
    The result of mine in the test , when the executed Shell got over 300 is
         1. The jvm processes that I execute at the first time are shown up , after Shell go to the finish, the
    processes are all in the disappearance again , and at last The processes that I executed at the first time are
    remaining. It's like the process is duplicated process in the maximum of 70.
    When I do shell about 200 to be executed simultaneously, Duplicated jvm about 3 appeared momentarily, then
    disappeared, and also under 120, No duplicated case is found when under 120.
    ps -ef result is below , when shell is excuted
    UID PID PPID C STIME TTY TIME CMD
    jslee 626906 1 0 11, May - 2:20 java -
    DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
    jslee 1421522 626906 0
    19:36:16 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
    ....Skip.....
    jslee 4374620 626906 0 19:34:06 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -
    Dfile.encoding=euc-kr jobserver.JobServerMain
    (the process list about 60)
    *the first question : Why a lot of duplicated jvm are shown up when in alot of shell to be executed ?
    *the second question : As you can see above , How can I solve out the problem.
    *Is there some option that I can set up when starting Jvm?
    ---Next question---
    My developing environment is
    OS : SunOS 5.8
    JRE : Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
    Java HotSpot(TM) Server
    VM (build 16.0-b13, mixed mode)
    nofiles(descriptors) 256
    As shown obove , the value of descriptors is 256 .
         My scheduler program executed 300 shell at the same time, in result my program was abnormalily
    terminated after doing shell about 180.
    the Exception info is
    java.io.IOException: Cannot run program "sh": error=24, exceeding the number of opened files
         at
    java.lang.ProcessBuilder.start(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at
    java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
    or
    java.net.SocketException: exceeding the number of opened files     at java.net.PlainSocketImpl.socketAccept
    (Native Method)
    또는
    java.io.IOException: exceeding the number of opened files     at
    java.io.UnixFileSystem.createFileExclusively(Native Method)
         at java.io.File.checkAndCreate(Unknown
    Source)
         at java.io.File.createTempFile(Unknown Source)
    *question : If I continuously request to open a file that go over system limit, is it possible for JVM to be
    terminated?
    *question : Is there a method that obtains state of System limit in the java library.
    *question : what is the best solution to cope with ?
    Please help me
    =

    struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
      <form-beans>
           <form-bean name="registrationForm" type="ndlinh.struts.lab.RegistrationForm" />
      </form-beans>
      <action-mappings>
           <action path="/register"
                   type="ndlinh.struts.lab.RegistrationAction" // action class
                   name="registrationForm" // form bean name
                   validate="false"
                   scope="request"
                   input="registration.jsp" >
                <forward name="success" path="/jsp/success.jsp"  />
                <forward name="failure" path="/jsp/failure.jsp"  />
           </action>
      </action-mappings>
    </struts-config>HTH

  • Pricing : ABAP to Java conversion help needed

    Hi all.
    I am basically an ABAP developer. My recent assignment needs some java coding.
    It will be very helpful if we anybody helps me in finding the corresponding pricing fields in java.
    The abap code is as follows
    check : xkomv - kgrpe  = '  '.
    check: xkomv - xkbetr ne 0.
    check : komp - kpein ne 0.
    if komp - netwr < 0.
      komp - netpr = 0 - komp - netpr.
    endif.
    xkwert  = (        (  ( komp - netpr * ( 100000 + xkomv - xkbetr))     / 100000)
    komp-mglme / komp-kumza * komp - kumne / 1000 / komp - kpein )
      - komp-netwr.
    Please help in converting this abap code to its corresponding java code.
    Thanks and Regards
    Deepika

    Here is the code I have developed: Please check and let me know if there are any changes
    import java.math.BigDecimal;
    import com.sap.spe.pricing.customizing.PricingCustomizingConstants;
    import com.sap.spe.pricing.transactiondata.PricingTransactiondataConstants;
    import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
    import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
    import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;
    public class ZS2S_IPC_ZDCP extends ValueFormulaAdapter {
          public BigDecimal overwriteConditionValue(
                IPricingItemUserExit item,
                IPricingConditionUserExit condition) {
                BigDecimal kompKumza = new BigDecimal(String.valueOf(condition.getFraction().getNumerator()));
                BigDecimal kompKumne = new BigDecimal(String.valueOf(condition.getFraction().getDenominator()));
                boolean xkomvKgrpe = condition.isGroupCondition();
                BigDecimal kompKpein = condition.getPricingUnit().getValue();    
                BigDecimal kompNetwr  = item.getNetValue().getValue();
                BigDecimal kompNetpr  = item.getNetPrice().getValue();
                BigDecimal xkomvKbetr = condition.getConditionRate().getValue();
                BigDecimal kompMglme = item.getBaseQuantity().getValue();
                  if ( xkomvKgrpe = true )
                      return PricingTransactiondataConstants.ZERO;
                  if ( kompKumza != PricingTransactiondataConstants.ZERO )
                    return PricingTransactiondataConstants.ZERO;
                if ( kompKumne != PricingTransactiondataConstants.ZERO )
                      return PricingTransactiondataConstants.ZERO;   
                if ( kompKpein != PricingTransactiondataConstants.ZERO )
                        return PricingTransactiondataConstants.ZERO;
                if (kompNetwr.compareTo(PricingTransactiondataConstants.ZERO) < 0 )
                      kompNetpr = (PricingTransactiondataConstants.ZERO).subtract(kompNetwr);
                 BigDecimal y = new BigDecimal("100000");
                BigDecimal a = y.add(xkomvKbetr);
                BigDecimal temp = kompNetpr.multiply(a);
                BigDecimal result1 = temp.divide(y, 2, BigDecimal.ROUND_HALF_UP);
                BigDecimal result2 = result1.multiply(kompMglme)
                                         .divide(kompKumza, 2 BigDecimal.ROUND_HALF_UP).multiply(kompKumne).divide(kompKpein, 2,  BigDecimal.ROUND_HALF_UP);
                BigDecimal Result = result2.subtract(kompNetwr);
              return Result;
    Edited by: Deepika Mallya on Aug 6, 2009 9:08 AM

  • Do week-long java courses help to understand java &  get a job?

    i tried searching for this topic before posting, but "courses" "classes" & "instruction" come up with a lot that has nothing to do with the topic at hand. :)
    like many others, i'm teaching myself out of a book (Deitel). so far i've been able to understand the material and create programs based on the exercises. however, i'm now into the meat of OOP with superclass, subclasses, how they interact and the like and i'm having a rough go of it. i can diagram and understand the abstract concept, but when i'm faced with an actual program example i have a difficult time following the interactions between classes.
    i'm considering taking one of those 5 day classes, but am wary of how much they will actually be able to cover in detail (not to mention the $$). has anyone here taken one of those classes and found them to be of great benefit to learning the OOP portion of Java? did it give you enough understanding to obtain an entry-level job?
    btw, i'm doing a pro bono project for a small company to get some real world experience. (i've heard that suggestion many times in regards to obtaining one's "experience" w/o a job)
    thank you all very much for your help.

    I took a week long course to learn Java. It worked I did learn the basics of Java but I did already know how to program in C and VB at the time. I found the AWT section of the class to be very valuable,cosidering I mostly write GUI. And the concepts of AWT mostly all apply to swing so that didn't set me back at all. Depending on the school it may help you to understand OOP. But be careful because most schools progress the class at the skill level of the majorty. So if you have 15 people in the class and 9 of them know nothing about programing your probably going to spend the week learning what a variable and a while loop do, you all pay the same tuition and they would rather 6 of you leave then 9 of you leave. If you have some prior programming knowledge I would recomend finding a class that caters to that.

  • Simple java question, help please

    please help
    -i am just starting out in java and im havin an early problem. Im trying to run a small java script from a commant prompt but im getting the following error after i enter this command at my prompt
    c:\javatest>javac HelloARP.java
    javac is not as an internal or external command, operable program or batch file.
    when i enter
    c:\java -version
    i get the following message: registry key software\javasoft\java runtime enviornment\current version has value of 1.1 but 1.4 is requiured
    error: could not find java.dll
    error: could not find java 2 runtime enviornment
    -im sure this is a simple error on my part. all im trying to do is run my first lil program that i saved in notepad, its only 5 lines long. here is the lil test program im trying to execute
    class HelloARP {
    public static void main (String[] arguments) {
    System.out.println("What's good ARP?");
    - all responses and help are welcomed. Thank you ahead of time for anyone that can help me get started.

    Hi
    First of all uninstall your current JDK installation, if you can get to the registry delete the registry entries for the old version of java which was there on your machine.
    Now do a fresh install of your j2sdk1.4.1, make sure that you will install the JRE with the J2SDK1.4.1.
    Once you are done, set your classpath in autoexec.bat if you are using Windows 95/98
    or set your environment variables if you are using Win NT/2000/XP.
    If using solaris or other unix flavors see the included installation instructions provided.
    Let me if you face the same problem.
    Thanks
    Swaraj

  • Java Progrramming HELP, Needed Urgently, T hanks

    hey guys,
    I have this lab I need to be done tomorrow, its been weeks lol of thinking and figuring things out can someone make it work ? Pleaseeeee !
    I feel like going out and yelling for help lol I have been trying to figure this out for weeks now.
    I am pasting my Lab and My Codes I did so far, And Please I really need this done today at any rate, all help would be kindly appreciated.
    A Java program is required that will produce a number of reports based on the data from the Product file. This file contains the product name, cost, quantity and UPC. The file name must be input. Valid data from the file will be loaded into an array.
    A menu will provide the following options: (Note there are changes from previous assignment.)
    1     Display of all valid product information including extended price and GST including totals sorted by name.
    2     Display of all invalid records sorted by name.
    3     Search and display a certain product by name.
    4     Sort by UPC and use a binary search and display a certain product by UPC. (valid records)
    9 Exit.
    Processing requirements:
    Input the data from a file and load the records into an object array. Use this object array to produce the above reports.
    Code a class definition exactly as given in the following UML.
    (For specific students: you may code the UPC as an integer but if not numeric throw an exception that is handled in main. Document your choice in your submission).
    Product
    ? Name : String
    ? UPC : String
    ? Cost : Real
    ? Quantity : Integer
    + Product (Name : String, UPC : String, Cost : Real, Quantity : Integer)
    + Calculate Extended Cost() : Real
    + Calculate GST(): Real
    Input Record:
    Product name: String
    UPC: String
    Cost: real
    Quantity: integer
    Output Reports
    1. Display of all product information including extended cost and GST including totals of these 3 fields.
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 10,723,160.83
    Tissues 98989898989x 1.99 2 3.98      0.20     4.18
    TOTALS                         10,212,538.10 510,626.91 10,723,165.01
    2. Display of all invalid records and the count.
    Following is a sample of the output required:
    Invalid UPC Records = 1
    Count Record
    1          Tiara Diamond, 12345678901x, 36020.00, 2
    3. Search and display a certain product by name. Display appropriate message if not found.
    Following is a sample of the output required:
    Enter product name: CrownJewels
    CrownJewels 99999999991x     100,000.00 1 100,000.00 5,000.00 $105,000.00
    6. Display the product information sorted by name
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    CrownJewels 99999999991x 100,000.00 1 100,000.00 5,000.00 $105,000.00
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 $10,723,160.83
    Pearls      88888888881x 10,000.00 1 10,000.00 500.00 $10,500.00
    RubyRing      77777777771x 10,000.00 1 10,000.00 500.00 $10,500.00
    Tissues      98989898989x 1.99 2 3.98 0.20     $4.18
    TOTALS          (complete these values)           xxx           xxx      xxx
    Java coding requirements for this assignment
    Main methods required
    1.     Load array with all records. Display exception messages only for records that have invalid data in any of the fields. Return array of valid records and logical size.
    2.     Validate the UPC. Display each report when requested from the menu.
    3.     Justify the data in the columns. Right justify numeric fields; left justify the alpha fields.
    4.     A method for each report required in the menu.
    Class methods
    5.     Use the object method for the extended cost.
    6.     Use the object method for the GST.
    You may use additional methods in the main program but do not add any methods in the class definition.
    Use DecimalFormat for rounding.
    Create an array to hold the objects. Assume that we only need to process a file of a maximum of 500 records but the file may be larger than 500 records.
    A Universal Product Code consists of 12 digits. The first digit (from the left) is the UPC type. The next five digits are the Manufacturer code. The next five digits are the product code which is assigned by the manufacturer. The final digit is the check digit. A person can determine the check digit of a Universal Product Code by doing the following:
    Step 1: Sum all of the digits in the odd positions together.
    0+4+0+1+5+9 = 19
    Step 2: Multiply the sum from Step 1 by 3.
    3 * 19 = 57
    Step 3: Sum all of the digits in the even positions together.
    6+2+0+1+8 = 17
    Step 4: Sum together the results from Step 2 and Step 3.
    17 + 57 = 74
    Step 5: Subtract the sum from the next highest multiple of 10.
    80 - 74 = 6 [check digit]
    TEST DATA:
    Step 1: Create 5 or MORE additional records that will test all conditions. Include these in your documentation. Identify what field is tested in your test data. (Example: error in each field of the record, rounding up, rounding down, valid UPC, invalid UPC, formatting of report, file too large
    Step 2: Use the file attached.
    GODDDDDDDDDDDDDD lol pasting it made me go crazy,
    these are my codes so far, HOwever the problem is ONLY DISPLAY MENU SHOWS, nothing else even though i have enough codes that it can show something,
    My codes are as follows:
    I am working on Eclipse.
    import java.util.Arrays;
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.io.IOException;
    * Name : Sana Ghani
    * Date : July 10
    public class lab56
         public static Scanner file;
         public static Scanner parse;
         public static Scanner input = new Scanner(System.in);
         public static Scanner searchInput = new Scanner(System.in);
         public static void main(String[] args) throws Exception
              Product1[] validProduct = new Product1[500];
              int logicalSize = 0;
              int menuChoice=0;
              String FileName = getFileName();
              displayMenu();
              switch(menuChoice)
              case 1:
                   displayAllValidRecords(validProduct, logicalSize);
                   try
                   // Open an output stream
                   OutputStream fout = new FileOutputStream ("myfile.txt");
                   // Print a line of text
                   new PrintStream(fout).println ("hello world!");
                   // Close our output stream
                   fout.close();          
                   // Catches any error conditions
                   catch (IOException e)
                        System.err.println ("Unable to write to file");
                        System.exit(-1);
                   break;
              case 2:
                   break;
              case 3:
                   binarySearchByName( validProduct,logicalSize);
                   break;
              case 4:
                   break;
              case 5:
                   break;
              menuChoice = displayMenu();
         public static void display(Product1[]validProduct, int logicalSize)throws Exception
              String Product, UPC;
              double Cost;
              int Quantity;
              for(int index =0; index<logicalSize; index++)
                   Product = validProduct[index].GetName();
                   UPC = validProduct[index].GetUPC();
                   Cost=validProduct[index].GetCost();
                   Quantity=validProduct[index].GetQuantity();
                   System.out.println(Product+"\t\t"+UPC+"\t\t"+Cost+"\t\t"+Quantity);
         public static String getFileName()
              String fileName;
              Scanner input = new Scanner(System.in);
              System.out.print("Please enter a file name: ");
              fileName = input.next();
              return fileName;
         public static int displayMenu()
              int menuChoice;
              boolean validFlag = false;
              do
                   System.out.println("\n\n*************************************");
                   System.out.println(" Product Display Menu ");
                   System.out.println("*************************************");
                   System.out.println("(1)Display All Records");
                   System.out.println("(2)Display All Invalid Records");
                   System.out.println("(3)Search by Product Name");
                   System.out.println("(4)Sort by Product Name");
                   System.out.println("(5)Exit");
                   System.out.println("*************************************");
                   System.out.print("Enter your choice(1-5): ");
                   menuChoice = input.nextInt();
                   if ((menuChoice >= 1) && (menuChoice <= 5))
                        validFlag = true;
                   if (!validFlag)
                        System.out.println("You have chosen " + menuChoice + ", " + menuChoice +
                        " is not valid. Please try again");
              }while(!validFlag);
              return menuChoice;
         public static String loadArray(Product1 [] ValidProduct, String fileName)throws Exception
              int logicalSize=0;//will always have to declare
              String record;//will always have to declare
              String Product, UPC;//variable names from
              double Quantity;
              double Cost;
              Scanner file = new Scanner(new File(fileName));//open
              record = file.nextLine();//read a line
              record = file.nextLine();//read a line
              for(int index = 0; index < ValidProduct.length && file.hasNext(); index++)//check to see if the file has data
                   record = file.nextLine();
                   parse = new Scanner(record).useDelimiter(",");
                   String Name = parse.next();
                   UPC = parse.next();
                   Cost = parse.nextDouble();
                   Quantity=parse.nextDouble();
                   ValidProduct[index] = new Product1 ( Name, UPC, Cost, (int) Quantity);
    //               create the object-- call the constructor and pass info
                   logicalSize++;
              return logicalSize+".txt";
         public static double roundDouble(double value, int position)
              java.math.BigDecimal bd = new java.math.BigDecimal(value);
              bd = bd.setScale(position,java.math.BigDecimal.ROUND_UP);
              return bd.doubleValue();
         * This method will print report about valid records
         public static void displayAllRecords( Product1[]valid, int ValidProduct,
                   Product1[] invalid, int InvalidProduct)
    //          Print valid records
              displayAllValidRecords(valid, ValidProduct);
    //          Print invalid UPC records
              displayAllValidRecords(invalid, InvalidProduct);
         public static void displayOneRecord(Product1[]valid, int index)
              double extendedCost, GST, SumofGST = 0, // Total Extended Cost
              totalCost, SumOfTotalCost = 0; // Total Extended Cost + GST
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Quantity", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
              extendedCost = valid[index].CalculateExtendedCost();
              extendedCost = roundDouble(extendedCost, 2);
              GST = valid[index].CalculateGST();
              GST = roundDouble(GST, 2);
              totalCost = extendedCost + GST;
              totalCost = roundDouble(totalCost, 2);
    //          justify method ensures all values are of the same size
              System.out.println(//leftJustify(i+"",3) + ": " +
                        leftJustify(valid[index].GetName(), 50) +
                        leftJustify(valid[index].GetUPC(), 15) +
                        rightJustify(valid[index].GetCost()+"", 10) +
                        rightJustify(valid[index].GetQuantity()+"", 5) +
                        rightJustify(extendedCost+"", 10) +
                        rightJustify(GST+"", 10) +
                        rightJustify(totalCost+"", 10));
         * This method will print report about valid records
         public static void displayAllValidRecords( Product1[]valid, int validCounter)
              double extendedCost, sumOfExtendedCost = 0, // Total Extended Cost
              GST, sumOfGST = 0, // Total GST
              totalCost, sumOfTotalCost = 0; // Total Extended Cost + GST
              System.out.println("************************ XYZ Product " +
                        "Cost REPORT ****************************" +
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Qty", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
    //          Print Records
              for(int i=0; i<validCounter; i++)
                   extendedCost = valid.CalculateExtendedCost();
                   extendedCost = roundDouble(extendedCost, 2);
                   GST = valid[i].CalculateGST();
                   GST = roundDouble(GST, 2);
                   totalCost = extendedCost + GST;
                   totalCost = roundDouble(totalCost, 2);
    //               justify method ensures all values are of the same size
                   System.out.println(//leftJustify(i+"",3) + ": " +
                             leftJustify(valid[i].GetName(), 50) +
                             leftJustify(valid[i].GetUPC(), 15) +
                             rightJustify(valid[i].getClass()+"", 10) +
                             rightJustify(valid[i].GetQuantity()+"", 5) +
                             rightJustify(extendedCost+"", 10) +
                             rightJustify(GST+"", 10) +
                             rightJustify(totalCost+"", 10));
                   sumOfExtendedCost += extendedCost;
                   sumOfGST += GST;
                   sumOfTotalCost += totalCost;
         private static void sortByName(Product1 [] ValidProduct, int logicalSize) throws Exception
              Product1 temp;
              for (int outer = logicalSize-1; outer > 1; outer --)
                   for (int inner = 0; inner < outer; inner ++)
                        if (ValidProduct[inner].GetName().compareToIgnoreCase(ValidProduct[inner+1].GetName())>0)
                             temp = ValidProduct[inner];
                             ValidProduct[inner] = ValidProduct[inner + 1];
                             ValidProduct [+ 1] = temp;
         public static void binarySearchByName(Product1 [] ValidProduct, int logicalSize)
              int high = logicalSize - 1;
              int low = 0;
              int mid = 0;
              int count = 0;
              int compare = 0;
              boolean found = false;
              System.out.print("Enter a product name");
              String product = input.nextLine();
              while (high >= low && !found)
                   count += 1;
                   mid = (high + low) / 2;
                   compare = ValidProduct[mid].GetName().compareToIgnoreCase(product);
                   if (compare == 0)
                        System.out.println("Found: " + ValidProduct[mid].GetName());
                        found = true;
                   else if (compare < 0)
                        low = mid + 1;
                   else
                        high = mid - 1;
              if (!found)
                   System.out.println(product + " not found.");
              System.out.println(count + " steps");
              System.out.println();
         public static String leftJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static String rightJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static void displayValidRecords(Product1 [] ValidProduct, int logicalSize) throws Exception {
              long longMAX_POSSIBLE_UPC_CODE = 999999999999L;
              // set input stream and get number
              Scanner stdin = new Scanner(System.in);
              System.out.print("Enter a 12-digit UPC number: ");
              long input =stdin.nextLong();
              long number = input;
              // determine whether number is a possible UPC code
              if ((input < 0)|| (input > longMAX_POSSIBLE_UPC_CODE)) {
                   // not a UPC code
                   System.out.println(input +"is an invalid UPC code");
              else {   
                   // might be a UPC code
                   // determine digits
                   int d12 = (int) (number % 10);
                   number /= 10;
                   int d11 = (int) (number % 10);
                   number /= 10;
                   int d10 = (int) (number % 10);
                   number /= 10;
                   int d9 = (int) (number % 10);
                   number /= 10;
                   int d8 = (int) (number % 10);
                   number /= 10;
                   int d7 = (int) (number % 10);
                   number /= 10;
                   int d6 = (int) (number % 10);
                   number /= 10;
                   int d5 = (int) (number % 10);
                   number /= 10;
                   int d4 = (int) (number % 10);
                   number /= 10;
                   int d3 = (int) (number % 10);
                   number /= 10;
                   int d2 = (int) (number % 10);
                   number /= 10;
                   int d1 = (int) (number % 10);
                   number /= 10;
                   // compute sums of first 5 even digits and the odd digits
                   int m = d2 + d4 d6 d8 + d10;
                   int n = d1 + d3 d5 d7 + d9 + d11;
                   // use UPC formula to determine required value for d12
                   int r = 10 - ((m +3*n) % 10);
                   // based on r, can test whether number is a UPC code
                   if (r == d12) {
                        // is a UPCcode
                        System.out.println(input+" is a valid UPC code");
                   else {   
                        // not a UPCcode
                        System.out.println(input+" is not valid UPC code");
    Any help would be great thanks !!
    Take care,

    1) It's your problem that you waited until the last minute before you went for help...not ours. We'll give your problem the same attention as anyone elses...therefore your problem isn't any more urgent than any other problem here.
    2) I don't intend on doing your entire assignment. Nor do I intend on reading all of it. If you need help with a specific requirement, then post the information/code relevant to that requirement. I don't know how to help you when you bury the problem inside a 9 mile long essay.
    3) Post code in tags so it's formatted and readable. (there's a *code* button up above that makes the tags for you).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • About to fail Java..HELP

    Here's the story..I am horrable at Java. I took this class..I am having a lot of trouble and the teacher will not help me.. Here's my assignment..
    Write a program to compute mileage statistics for an automobile. Mr. Magoo has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. Develop a Java application that will let Mr. Magoo input miles driven and gallons used (both ints) for each tankful and then display the miles per gallon obtained (a double). When Mr. Magoo enters -1 for miles, the program will display the total miles, total gallons, (both ints) and overall miles per gallon (a double, display rounded to 2 decimal places).Use a priming read similar to that found on page 4 of the Chap 4 handout. Continue processing input values until Mr. Magoo enters the sentinel value of -1. Use a message dialog at the start of the program that tells him what the valid input values are and what sentinel value to use to end processing. When Mr. Magoo enters an invalid amount (<= 0) for either value, there should be an error dialog box. Mr. Magoo might possibly enter two (or more) invalid amounts in a row! Make sure the program catches all invalid data.After Mr. Magoo enters the sentinel value, print out the totals. Invalid values are not included in the totals. There should be 1 information message which says "Valid miles and gallons are >0 and on the next line.."Enter -1 for miles to end processing" and then 1 box to enter mmiles, 1 to enter gallons, and an information message to say "MPG this tankful is: " TEST DATA:
         MILES     GALLONS
         155     6
         -300
         375     11
         284     8
         145     -5
         309     10
         -1
    heres my code which is very wrong, not complete and generated many errors:
    import javax.swing.JOptionPane;
    public class Mpg
    public static void main(String args[])
              String getMpg;
              double Mpg, gallons, miles;
              JOptionPane.INFORMATION_MESSAGE (null, "Valid miles and gallons are >0
              "\nEnter -1 for miles to end processing.");
              Mpg = Double.parseDouble(getMpg);
              Mpg = miles / gallons;
              JOptionPane.showInputDialog (null, "Number of miles: " + miles +","Results", JOptionPane.QUESTION_MESSAGE );
              JOptionPane.showInputDialog (null, "Number of gallons: " + gallons +", "Results", JOptionPane.QUESTION_MESSAGE );
              JOptionPane.showInputDialog (null, "MPG this tankful: " + Mpg +", "Results", JOptionPane.INFORMATION_MESSAGE );
              System.exit(0);
    I would be thankful for any help I can recieve. I have no idea how to make this program work. I am banging my head against walls!!!! Thanks Everyone!

    Hi,
    Whilst not agreeing with the tone of some of the messages the principle is correct up to a point.
    Anyway a little help is needed here :)
    Your program could be done in any language as its basically a procedural task. Lets look at that first.
    Your input screen - be it the command line or a JOptionPane must have a "switch" behind it that filters out unwanted input and only calls the mpg formula if the input is correct.
    To make the calculation you need to temporarily store two values "milestravelled" and "gallonsused"
    The input reciever should look for "milestravelled" first and when that has been correctly input ( > 0 ) it will treat the next input as "gallonsused".
    Once the two values are stores it should automatically - or by request - calculate the MPG figure and display it.
    Secondly, your code had some syntax errors I've corrected - there was an extra +" after the miles, gallons and Mpg variables
    JOptionPane.showInputDialog (null, "Number of miles: " + miles ,"Results", JOptionPane.QUESTION_MESSAGE );
    JOptionPane.showInputDialog (null, "Number of gallons: " + gallons , "Results", JOptionPane.QUESTION_MESSAGE );
    JOptionPane.showInputDialog (null, "MPG this tankful: " + Mpg , "Results", JOptionPane.INFORMATION_MESSAGE );
    Your information message declaration is not correct either. I suggest you check your syntax using the JDK documentation or your book.
    I hope that helps a little and will encourage you to work out the rest on your own.
    PS: Why are you using swing? A simple command line application would do fine for this task. Is it a course requirement or are you using a java development program to learn java. If its the second reason I think I can see why you're a bit lost. The IDE programs stick in a load of code that may not be necessary at all. The best way to learn is using the trusty JDK and notepad :)
    Bye

  • I grab a null frame.  Can a Java genious help, please?

    Hello. I am a high school student working on a science fair project. Right now I am using JMF to grab a frame from my ATI TV Wonder USB. The code below accesses the TV Wonder but it seems like I get a null frame because I have put a if statement in the code and it says I have a null image there. Can someone please help me. Thank you in advance
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.control.FormatControl;
    public class Cell extends JApplet implements ActionListener{
         JLabel welcomeLabel;
         JTextArea output;
         JButton close;
         String display = "";
         String exit = "The video capture buffer has been terminated.";
         String problem = "";
         String videoDevice = "vfw:Microsoft WDM Image Capture (Win32):0";
         public static Player player = null;
         public Buffer buf = null;
         public Image img = null;
         public VideoFormat vf = null;
         public BufferToImage btoi = null;
         public MediaLocator ml = null;
         public CaptureDeviceInfo di = null;
         public void init()
              Container c = getContentPane();
              c.setLayout( new FlowLayout() );
              welcomeLabel = new JLabel("Welcome to Adam's Cell Analyzer");
              c.add(welcomeLabel);
              output = new JTextArea(6, 60);
              output.setFont( new Font("Courier", Font.PLAIN, 12) );
              c.add(output);
              close = new JButton("End Analyze Program");
              close.addActionListener(this);
              c.add(close);
              display = "Starting...\n\n";
              output.setText(display);
              di = CaptureDeviceManager.getDevice(videoDevice);
              ml = di.getLocator();
              try {
                   player = Manager.createRealizedPlayer(ml);
                   player.start();
                   Component comp;
              catch (Exception e) {
                   problem += "An Exception has occured.";
                   output.setText(problem);
              FrameGrabbingControl fgc = (FrameGrabbingControl)
                   player.getControl("javax.media.control.FrameGrabbingControl");
              buf = fgc.grabFrame();
              btoi = new BufferToImage((VideoFormat)buf.getFormat());
              img = btoi.createImage(buf);
              display += "The video capture card is currently working properly\n";
              display += "and is sending a video feed to the image buffer.\n\n";
              output.setText(display);
              if(img==null){
                   problem += "The frame is null.";
                   output.setText(problem);
              else
                   imageEnhancement(img);
         public void actionPerformed(ActionEvent e)
              output.setText(exit);
              player.close();
              player.deallocate();
         private void imageEnhancement(Image img)
         //Nothing now     
    }

    I decided to post my program on here because I remember how hard it was to get it to work, and I don't want people to go through the same problems... just don't use it to compete against me in the Intel Science and Engineering Fair and/or the Intel Science Talent Search ;-) then I'll be mad. Other than that, have fun!
    ~Adam Georgas
    import java.awt.*;
    import java.awt.Dimension;
    import java.awt.event.*;
    import java.awt.Image.*;
    import java.awt.image.renderable.*;
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.format.VideoFormat;
    import javax.media.util.*;
    import javax.media.util.BufferToImage;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.control.FormatControl;
    public class Cell extends JApplet implements ActionListener{
         JLabel welcomeLabel;
         JTextArea output;
         JButton begin;
         JButton end;
         String display = "";
         String problem = "";
         String exit = "The video capture buffer has been terminated.";
         String videoDevice = "vfw:Microsoft WDM Image Capture (Win32):0";
         public static Player player = null;
         public Buffer buf = null;
         public MediaLocator ml = null;
         public CaptureDeviceInfo di = null;
         public BufferToImage btoi = null;
         public Image frameImage = null;
         public VideoFormat vf = null;
         public PlanarImage src = null;
         private ImageEncoder encoder = null;
    private JPEGEncodeParam encodeParam = null;
         int error = 0;
         public void init()
              Container c = getContentPane();
              c.setLayout( new FlowLayout() );
              welcomeLabel = new JLabel("Welcome to Adam's Cell Analyzer");
              c.add(welcomeLabel);
              output = new JTextArea(6, 60);
              output.setFont( new Font("Courier", Font.PLAIN, 12) );
              c.add(output);
              begin = new JButton("Begin Analyze Program");
              begin.addActionListener(this);
              c.add(begin);
              end = new JButton("End Analyze Program");
              end.addActionListener(this);
              c.add(end);
              di = CaptureDeviceManager.getDevice(videoDevice);
              ml = di.getLocator();
              try {
                   player = Manager.createRealizedPlayer(ml);
                   player.start();
              catch (Exception b) {
                   JOptionPane.showMessageDialog(this, b.toString(),
                        "An Exception has occured", JOptionPane.ERROR_MESSAGE);
              display = "Welcome\n\n";
              output.setText(display);
         public void actionPerformed(ActionEvent e)
              JComponent j = (JComponent) e.getSource();
              if (j == end){
                   player.close();
                   player.deallocate();
                   output.setText(exit);     
              if (j == begin){
                   display += "Starting...\n\n";
                   output.setText(display);
                   Control[] controls = player.getControls();
                   FrameGrabbingControl fgc = (FrameGrabbingControl)
                        player.getControl("javax.media.control.FrameGrabbingControl");
                   if (fgc == null) {
                        error = 1;
                        problem(error);
                   buf = fgc.grabFrame();
                   btoi = new BufferToImage((VideoFormat)buf.getFormat());
                   if (btoi == null){
                        error = 2;
                        problem(error);
                   VideoFormat format = (VideoFormat)buf.getFormat();
                   Dimension size = format.getSize();
                   if(format == null) {
                        error = 3;
                        problem(error);
                   frameImage = btoi.createImage(buf);               
                   if(frameImage == null) {
                        error = 4;
                        problem(error);
                   else{
                        display = "";
                        display = "The video system is working correctly and grabbing frames.\n\n";
                        output.setText(display);     
         public void imageEnhancement()
    //Top Secret :-)
         public void problem(int error)
              switch(error) {
              case 1:
                   JOptionPane.showMessageDialog(this, "The frame grabbing control is null.",
                        "A problem has occured", JOptionPane.ERROR_MESSAGE);
                   break;
              case 2:
                   JOptionPane.showMessageDialog(this, "The buffer to image conversion did not occur properly.",
                        "A problem has occured", JOptionPane.ERROR_MESSAGE);
                   break;
              case 3:
                   JOptionPane.showMessageDialog(this, "The image format queries did not occur properly.",
                        "A problem has occured", JOptionPane.ERROR_MESSAGE);
                   break;
              case 4:
                   JOptionPane.showMessageDialog(this, "The buffer to image did not occur properly.",
                        "A problem has occured", JOptionPane.ERROR_MESSAGE);
                   break;
              case 5:
                   JOptionPane.showMessageDialog(this, "Java AWT Image to JAI Image did not occur properly.",
                        "A problem has occured", JOptionPane.ERROR_MESSAGE);
                   break;
              default:
                   JOptionPane.showMessageDialog(this, "An unknown problem has occured.",
                        "A problem has occured", JOptionPane.ERROR_MESSAGE);
    }

  • How to use padding scheme FIPS81 in java plz help?

    Plz refer the below code using this code I m trying to decrypt XLS file using pass phrase.
    I m using the same pass phrase which was used @ the time of encryption.
    But the problem I m facing is that the file was encrypted in DOT NET_ using padding scheme FIPS81 and there impelmentation of FIPS81 is not available in JAVA so that it gives exception at the time of decryption which is given below
    Exception : javax.crypto.BadPaddingException: Given final block not properly padded
    I urgently need the solution of this problem so somebody plz help me to find the solution of this problem.....Ur reply would be appriciated.....!!
    The File is Encrypted using below mechanism
    ALGORITHM : AES
    MODE : ECB
    PADDING SCHEME : FIPS81
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.UnsupportedEncodingException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    public class DecryptTest {
         public static void main(String[] s){
              String passPhrase = "passphrase";
              String encFileName = "encsample.xls";
              String decFileName = "decsample.xls";
              FileInputStream encFileIn = null;
              FileOutputStream decFileOut = null;
              File f = null;
              byte[] message;
              try {
                   f = new File(encFileName);
                   encFileIn = new FileInputStream(f);
                   decFileOut = new FileOutputStream(decFileName);
                   message = new byte[encFileIn.available()]; //Read the encrypted file in from disk
                   encFileIn.read(message);
                   SecretKeySpec spec = new SecretKeySpec(passwordToKey (passPhrase), "AES");
                   //decrypt it
                   Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
                   c.init(Cipher.DECRYPT_MODE, spec);
                   System.out.println("Block Size is >-->" + c.getBlockSize());
                   String decryptedString = new String(c.doFinal(message));
                   System.out.println("Decrypted message: " + decryptedString);
                   //To write into another files
                   decFileOut.write(decryptedString.getBytes());
              }catch (Exception e) {
                   System.out.println(e);
              }finally {
                   try {
                        encFileIn.close();
                        decFileOut.close();     
                   } catch (IOException ioe) {
         }Is there any mechanism is available for FIPS81 or Is there any third party Provider available for it plz reply........????????

    I suggest you look in google http://www.google.co.uk/search?q=SWF+java

  • Java mapping help please

    Hi all,
    I need help with java code please.
    My source is a csv file and target is multiple idocs.
    Source file structure is as follows:
    Header (field 1, field 2, ........ field 10)
    Item 1a (field 1, field 2, field 3, .........    field 180)
    Item 1b (field 1, field 2, field 3, .........    field 180)
    Item 2a (field 1, field 2, field 3, .........    field 180)
    Item 2b (field 1, field 2, field 3, .........    field 180)
    Item na (field 1, field 2, field 3, .........    field 180)
    Item nb (field 1, field 2, field 3, .........    field 180)
    First line is header. Second is VAT line. Third is Price line for that VAT. Now VAT and Price lines repeat. There need not be VAT line for non-European countries. So a VAT line may or may not preceed a Price line.
    For example: the lines can be like:
    Header
    VAT1
    Price1
    VAT2
    Price2
    Price3
    1) Now, it should produce 3 idocs like:
    Header, VAT1, Price1
    Header, VAT2, Price2
    Header, Price3
    2) One idoc should be created per a pair of VAT and Price lines and they will be identified by a co-relation of a particular field. So first I have to sort all the lines based on this field value. Then I have to read the lines in pairs. If no Vat line, I should just read the Price item and produce an idoc.
    Can you please help me with the java code for this?
    Many thanks in advance.
    Ramesh.

    Many thanks Ram.
    The reason for thinking to go for java mapping is that there is no keyfield for price line. The source file is a pipe delimited csv file. There is a keyfield for VAT line. The same field will be empty for the Price line. I am trying to ask them to at least provide a space for that field between the pipes for price line so that I can use in FCC. It looks like they can't modify the source file.
    Any inputs please?
    Regards.
    Ramesh.

Maybe you are looking for

  • HP LaserJet Pro MFP M127fw will not print anything except its own config

    Just purchased a HP LaserJet Pro MFP M127fw.  I cannot manage to get it to print using any type of connection to the printer. I can connect to the printer from my Ubuntu PC and my Android phone, but when I attempt to print, the job just hangs, never

  • How to send a email with a link

    Hi All,             I have a scenario where I have to send an email to a person informing him about the workitem             Now this user is not a SAP user so i have to send a link to him of a web page where he will execute             the work item

  • After updating to Mac OS X 10.9.5 my MacBook Pro 2010 reboots constantly

    Every update makes more problems. First 10.9.2 introduced the randomly dis-functioning of my external monitor and now after updating to 10.9.5. my MacBook Pro (mid 2010) is rebooting every 30 minutes. It drives me crazy. Does anyone experience the sa

  • Af:query problem

    I'm getting this message in af:query departmentId is Integer and i'm using  oracle.jbo.domain.Number is it correct to use oracle.jbo.domain.Number  or there another way and ther are 0 comes in the departmentId compo box why It come and I want to hide

  • Can't open iWeb website

    I have spent several days creating  a website in iWeb. Today when I opened iWeb I couldn't see my website. the files are in a folder on the desktop, but can't work out how to access these again via iWeb. every time I clicked 'save' on a finished page