Help need in Signed Applets.....Urgent

Hi,
I am stuck with a problem. Please help me out.
The requirement is :
I have an applet which has to run an executable which produces a .txt. The applet should use this .txt to produce its output.
I made the applet into a signed jar and ran the executable to produce the .txt . But the .txt is outside the jar file and I am not able to use it to create the result.
How do I use the .txt now?? Is the method that I am trying proper or should I use some other method?
Another doubt is, when I run the .html of the applet code (which is in the server), is it cached in the client???

I made the applet into a signed jar and ran the
executable to produce the .txt . But the .txt is
outside the jar file and I am not able to use it to
create the result.
How do I use the .txt now??Hand the user a JFileChooser and let him tell you where the file is, or loook at the exe to see whether you can specify an output directory as a parameter.
Is the method that I am
trying proper or should I use some other method?It's highly ugly, but I can't think of anything else.
Another doubt is, when I run the .html of the applet
code (which is in the server), is it cached in the
client???Yes. No need to download the same stuff each time. The details are browser-specific.

Similar Messages

  • Help needed in importing application -  Urgent

    Hi,
    I am new fairly new to apex and would be grateful for any help....
    I have an application that i would like to import and install... but i am obtaining an error...
    Situation is as follows:
    Application in machine A with oracle 10g standard and apex 3.0. Workspace is portal, schema is status_portal...
    export is working fine.
    Need to import it to machine B with oracle 10g and apex 3.0 Workspace is
    online_portal, schema is portal
    Import also works fine...
    But when i try to install the imported application, i get following error:
    ORA-20001: GET_BLOCK Error. ORA-20001: Execution of the statement was unsuccessful. ORA-02291: integrity constraint (FLOWS_030000.WWV_FLOWS_FK) violated - parent key not found <pre>begin wwv_flow_api.create_flow( p_id =&gt;134, p_display_id=&gt;134, p_owner =&gt; 'STATUS_PORTAL', p_name =&gt; 'Status Portal', p_alias =&gt; 'F114', p_page_view_logging =&gt; 'YES', p_default_page_template=&gt; 3865804637029456 + wwv_flow_api.g_id_offset, p_printer_fri
    Please guide me as to what to do....
    History:
    I have tried exporting from machine A to apex online workspace and installing there.... and vice versa...It is working fine...
    the problem arises only when i try import & install on machine B....
    Please help me.... i need to do this urgently
    Thanks,
    Sumana

    Hi Scott,
    I will not be able to show the actual application, as it has our customer's information. But i have created a sample application and done the export and import. The details are as follows:
    Machine A Details:
    Workspace name = portal
    worskspace ID = 3727029916111535
    schema = status_portal
    Exported Application Name = Status Portal
    Exported Application ID = 117
    When importing application from machine A to online workspace:
    Online Workspace Details: (when importing application 117)
    Workspace Name = sumana
    Workspace iD = 3033192431425185475
    schema = sumanadb
    Imported Application Name = Status Portal
    Imported Application IS = 42146
    You can access the workspace using: http://apex.oracle.com/pls/otn/f?p=4550:1:
    the password is sumi123
    When importing application from machine A:
    Machine B Details:
    1 ) Workspace1 Name = auditws
    workspace ID = 7048503433678645
    schema = audit_schema
    When installing imported application no 117 I get:
    ORA-20001: GET_BLOCK Error. ORA-20001: Execution of the statement was unsuccessful.
    ORA-02291: integrity constraint (FLOWS_030000.WWV_FLOWS_FK) violated - parent key not
    found <pre>begin wwv_flow_api.create_flow( p_id =>129, p_display_id=>129, p_owner =>
    'STATUS_PORTAL', p_name => 'Status Portal', p_alias => 'F114117', p_page_view_logging =>
    'YES', p_default_page_template=> 10898936714426385 + wwv_flow_api.g_id_offset, p_printer
    Error installing application.
    Return to application.
    2) Workspace2 name = online_portal
    workspace ID = 9302626026712423
    schema = portal
    When installing imported application no 117 I get:
    ORA-20001: GET_BLOCK Error. ORA-20001: Execution of the statement was unsuccessful.
    ORA-02291: integrity constraint (FLOWS_030000.WWV_FLOWS_FK) violated - parent key not found
    <pre>begin wwv_flow_api.create_flow( p_id =>159, p_display_id=>159, p_owner => 'STATUS_PORTAL',
    p_name => 'Status Portal', p_alias => 'F114117', p_page_view_logging => 'YES',
    p_default_page_template=> 10898936714426385 + wwv_flow_api.g_id_offset, p_printer
    Error installing application.
    Return to application.
    3) When importing application no 130 from machine B to machine B
    (from workspace auditws and schema audit_schema to workspace online_portal and schema portal)
    I get the error as said before
    "Access Denied by application security check" Also, i observed that,
    the application gets installed in auditws and audit_schema itself...
    Screenshots are here:
    4) when importing application no 130 from auditws back to auditws, it works fine.

  • URGETN HELP NEEDED! JAVA APPLET READING FILE

    Hi everyone
    I need to hand in this assignment today
    Im trying to read from a file and read it onto the screen, my code keeps showing up an error
    'missing method body, or declare abstract'
    This is coming up for the
    public statuc void main(String[] args);
    and the
    public void init();
    Here is my code:
    import java.io.*;
    import java.awt.*;
    import java.applet.*;
    public class Empty_3 extends Applet {
    TextArea ta = new TextArea();
    public static void main(String[] args);
    public void init();
    setLayout(new BorderLayout());
    add(ta, BorderLayout.CENTER);
    try {
    InputStream in =
    getClass().getResourceAsStream("test1.txt");
    InputStreamReader isr =
    new InputStreamReader(in);
    BufferedReader br =
    new BufferedReader(isr);
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    String line;
    while ((line = br.readLine()) != null) {
    pw.println(line);
    ta.setText(sw.toString());
    } catch (IOException io) {
    ta.setText("Ooops");
    Can anyone help me please?
    Is this the best way of doing this? Once i read the file i want to perform a frequency analysis on the words so if there is a better method for this then please let me know!
    Thankyou
    Matt

    Whether it is urgent or not, does not interest us. It might be urgent for you but for nobody else.
    Writing all-capitals is considered shouting and rude.
    // Use code tags for source.

  • Help needed in HTTP Tunneling - urgent

    Hi all,
    I urgently need a working code sample of a client which sends requests to a server that redirects the request to an RMI server via RMI servlet.
    Does any of you familiar of such a code sample?
    Thanks

    I'm sorry, but HTTP Tunneling is not working for me. I must have done something wrong.
    Let me describe my configuration:
    I have a server behind NAT router which connected to apache2 and tomcat 4.1 web servers. The apache2 and tomcat are not connected between them.
    I deployed war file on tomcat which contains the servlet for the HTTP Tunneling which its code is:
    public class RmiHttpTunnelerServlet extends HttpServlet
        public void init(ServletConfig config) throws ServletException
            super.init(config);
            System.out.println("Simplified RMI Servlet Handler loaded successfully.");
        public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            try
                String queryString = req.getQueryString();
                String command, param;
                int delim = queryString.indexOf("=");
                if (delim == -1)
                    command = queryString;
                    param = "";
                else
                    command = queryString.substring(0, delim);
                    param = queryString.substring(delim + 1);
                if (command.equalsIgnoreCase("forward"))
                    try
                        ServletForwardCommand.execute(req, res, param);
                    catch (ServletClientException e)
                        returnClientError(res, "client error : " + e.getMessage( ));
                        e.printStackTrace();
                    catch (ServletServerException e)
                        returnServerError(res, "internal server error : " + e.getMessage());
                        e.printStackTrace();
                else
                    returnClientError(res, "invalid command: " + command);
            catch (Exception e)
                returnServerError(res, "internal error: " + e.getMessage());
                e.printStackTrace();
        public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            returnClientError(res, "GET Operation not supported: Can only forward POST requests.");
        public void doPut(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            returnClientError(res, "PUT Operation not supported: Can only forward POST requests.");
        public String getServletInfo()
            return "Simplified RMI Call Forwarding Servlet Servlet.<br>\n ";
        private static void returnClientError(HttpServletResponse res, String message) throws IOException
            res.sendError(HttpServletResponse.SC_BAD_REQUEST,
                          "<HTML><HEAD><TITLE>Java RMI Client Error < / TITLE > < / HEAD > < BODY > " +
                          "<H1>Java RMI Client Error</H1>" + message + "</BODY></HTML>");
            System.err.println(HttpServletResponse.SC_BAD_REQUEST + "Java RMI Client Error" + message);
        private static void returnServerError(HttpServletResponse res,
                                              String message) throws IOException
            res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                          "<HTML><HEAD>< TITLE > Java RMI Server Error < / TITLE > < / HEAD > < BODY > " +
                          "<H1>Java RMI Server Error < / H1 > " + message + " < / BODY > < / HTML > ");
            System.err.println(HttpServletResponse.SC_INTERNAL_SERVER_ERROR + "Java RMI Server Error : " + message);
        }There is also a utility class:
    public class ServletForwardCommand {
        public static void execute(HttpServletRequest request, HttpServletResponse response, String stringifiedPort)
            throws ServletClientException, ServletServerException, IOException {
            int port = convertStringToPort(stringifiedPort);
            Socket connectionToLocalServer = null;
            try {
                connectionToLocalServer = connectToLocalServer(port);
                forwardRequest(request, connectionToLocalServer);
                forwardResponse(response, connectionToLocalServer);
            } finally {
                if (null != connectionToLocalServer) {
                    connectionToLocalServer.close();
        private static int convertStringToPort(String stringfiedPort) throws ServletClientException {
            int returnValue;
            try {
                returnValue = Integer.parseInt(stringfiedPort);
            } catch (NumberFormatException e) {
                throw new ServletClientException("invalid port number: " + stringfiedPort);
            if (returnValue <= 0 || returnValue > 0xFFFF) {
                throw new ServletClientException("invalid port: " + returnValue);
            if (returnValue < 1024) {
                throw new ServletClientException("permission denied for port: " + returnValue);
            return returnValue;
        private static Socket connectToLocalServer(int port) throws ServletServerException {
            Socket returnValue;
            try {
                returnValue = new Socket(InetAddress.getLocalHost(), port);
            } catch (IOException e) {
                throw new ServletServerException("could not connect to " + "local port");
            return returnValue;
        private static void forwardRequest(HttpServletRequest request, Socket connectionToLocalServer)
            throws IOException, ServletClientException, ServletServerException {
            byte buffer[];
            DataInputStream clientIn = new DataInputStream(request.getInputStream());
            buffer = new byte[request.getContentLength()];
            try {
                clientIn.readFully(buffer);
            } catch (EOFException e) {
                throw new ServletClientException("unexpected EOF " + "reading request body");
            } catch (IOException e) {
                throw new ServletClientException("error reading request" + " body");
            DataOutputStream socketOut = null;
            // send to local server in HTTP
            try {
                socketOut = new DataOutputStream(connectionToLocalServer.getOutputStream());
                socketOut.writeBytes("POST / HTTP/1.0\r\n");
                socketOut.writeBytes("Content-length: " + request.getContentLength() + "\r\n\r\n");
                socketOut.write(buffer);
                socketOut.flush();
            } catch (IOException e) {
                throw new ServletServerException("error writing to server");
        private static void forwardResponse(HttpServletResponse response, Socket connectionToLocalServer)
            throws IOException, ServletClientException, ServletServerException {
            byte[] buffer;
            DataInputStream socketIn;
            try {
                socketIn = new DataInputStream(connectionToLocalServer.getInputStream());
            } catch (IOException e) {
                throw new ServletServerException("error reading from " + "server");
            String key = "Content-length:".toLowerCase();
            boolean contentLengthFound = false;
            String line;
            int responseContentLength = -1;
            do {
                try {
                    line = socketIn.readLine();
                } catch (IOException e) {
                    throw new ServletServerException("error reading from server");
                if (line == null) {
                    throw new ServletServerException("unexpected EOF reading server response");
                if (line.toLowerCase().startsWith(key)) {
                    responseContentLength = Integer.parseInt(line.substring(key.length()).trim());
                    contentLengthFound = true;
            while ((line.length() != 0) &&
                (line.charAt(0) != '\r') && (line.charAt(0) != '\n'));
            if (!contentLengthFound || responseContentLength < 0)
                throw new ServletServerException("missing or invalid content length in server response");
            buffer = new byte[responseContentLength];
            try {
                socketIn.readFully(buffer);
            } catch (EOFException e) {
                throw new ServletServerException("unexpected EOF reading server response");
            } catch (IOException e) {
                throw new ServletServerException("error reading from server");
            response.setStatus(HttpServletResponse.SC_OK);
            response.setContentType("application/octet-stream");
            response.setContentLength(buffer.length);
            try {
                OutputStream out = response.getOutputStream();
                out.write(buffer);
                out.flush();
            } catch (IOException e) {
                throw new ServletServerException("error writing response");
    }I checked also with packets monitoring tool, I couldn't see any http transportation.
    Any help will be appreciated.

  • Help needed in selection screen - Urgent

    Hi Experts,
    I have a selection screen. I have three radi buttons in that selection screen. Based on the selection of the radio buttons I need to activate corresponding selection screen parameters.
    e.g : if radiobutton1 is selected, njo activation needed,
           if radiobutton2 is selected, activate selection screen parameter p_one,
           if radiobutton3 is selected, activate selection screen parameter p_two.
    All three radiobuttons are attached to the same radio button group.
    I have assigned the parameters p_one, p_two, p_three to MODIF ID as follows.
    p_one - NULL
    p_two - t01
    p_three - t02.
    on the selection of a radio button I want the corresponding parameter to get activated.
    please help me.
    Regards,
    Arul jothi A.

    hi
    jothi
    AT SELECTION-SCREEN OUTPUT.                                      
      CASE SY-TCODE.                                                 
        WHEN 'ZEDI6'.                                                
          LOOP AT SCREEN.                                             
            CASE SCREEN-GROUP4.                                      
              WHEN '001'.                  "Sales order select       
                SCREEN-ACTIVE = '1'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                       
              WHEN '002'.                  "Delivery select          
                SCREEN-ACTIVE = '0'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                        
              WHEN '003'.                  "Invoice select           
                SCREEN-ACTIVE = '0'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                       
              WHEN '004'.                  "PO Select                
                SCREEN-ACTIVE = '0'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                       
    regards
    praveen

  • Help needed in getting applet working

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class murali1 extends JApplet{
         private Container contain;
         private GridBagLayout grid;
         private GridBagConstraints c;
    * Create the GUI and show it.
    public murali1() {
              //super("Assignment 1");
    //Create and set up the window.
    JFrame frame = new JFrame("Assignment 1");
              //Menu
              JMenuBar bar = new JMenuBar();
              JMenu file = new JMenu("File");
              bar.add(file);
              JMenuItem open = new JMenuItem("Open");
              file.add(open);
              open.addActionListener(new ActionListener(){
              public void actionPerformed (ActionEvent e)
              JMenuItem save = new JMenuItem("Save Random");
              file.add(save);
              save.addActionListener(new ActionListener(){
              public void actionPerformed (ActionEvent e)
              JMenuItem exit1 = new JMenuItem("Exit");
              file.add(exit1);
              exit1.addActionListener(new ActionListener(){
              public void actionPerformed (ActionEvent e)
                   System.exit(0);
              //Create 4 panels
              JPanel panel1,panel2,panel3,panel4;
              /*Adding components to Panel 1
              Panel 1 contains one Label and a ComboBox
              Panel 1 is a GridLayout
              panel1=new JPanel();
              String method[] = {"Random","Ascending","Descending"};
              JComboBox combo = new JComboBox(method);//Combo Box
              combo.setMaximumRowCount(3);
              combo.addItemListener(new ItemListener(){
              public void itemStateChanged(ItemEvent comboevent)
              JLabel combolabel;
              combolabel = new JLabel("Choose Prioritization Heuristic");
              //panel1.setLayout( new GridLayout (2,1));
              panel1.add(combolabel);
              panel1.add(combo);
              /*Adding components to panel 2
              Panel 2 contains one label and one text area
              Panel 2 is a GridLayout
              panel2 = new JPanel();
              JLabel textlabel = new JLabel("Evaluator Results");
              JTextArea evalarea = new JTextArea();
              panel2.add(textlabel);
              //panel1.setLayout( new GridLayout (2,1));
              panel2.add(evalarea);
              /*Adding components to panel 3
              Panel 3 contains 5 labels,3 textfields, 1 button
              Panel 3 is a GridLayout
              panel3 = new JPanel();
              JLabel label1,label2,label3,label4,label5;
              label1 = new JLabel("Use the Fields only for Random Heuristic");
              label2 = new JLabel("Enter Maximum # of Tries");
              label3 = new JLabel("Enter # of Tests in TS");
              label4 = new JLabel("Enter ID# of Tests in TS(d) (Separated by Comma)");
              label5 = new JLabel("Please Press SUBMIT");
              JTextField tf1,tf2,tf3;
              tf1 = new JTextField();
              tf2 = new JTextField();
              tf3 = new JTextField();
              JButton submit = new JButton("Submit");
              //panel1.setLayout( new GridLayout (9,1));
              panel3.add(label1);
              panel3.add(label2);
              panel3.add(tf1);
              panel3.add(label3);
              panel3.add(tf2);
              panel3.add(label4);
              panel3.add(tf3);
              panel3.add(label5);
              panel3.add(submit);
              /*Adding components to panel 4
              Panel 4 contains 4 labels,1 textfields, 3 button
              Panel 4 is a GridLayout
              panel4 = new JPanel();
              JLabel label6,label7,label8,label9;
              label6 = new JLabel("Press RUN to start evaluation");
              label7 = new JLabel("Press Exit to Terminate Program");
              label8 = new JLabel("MLP(d) and RP(d) are:");
              label9 = new JLabel("Press CLEAR to start new evaluation");
              JButton run = new JButton("Run");
              JButton exit = new JButton("Exit");
              JButton clear = new JButton("Clear");
              JTextArea area1 = new JTextArea();
              panel4.add(label6);
              panel4.add(run);
              panel4.add(label7);
              panel4.add(exit);
              panel4.add(label8);
              panel4.add(area1);
              panel4.add(label9);
              panel4.add(clear);
              /*panel1.setVisible(true);
              panel2.setVisible(true);
              panel3.setVisible(true);
              panel4.setVisible(true);*/
              /* set Grid Bag Layout
              Add all the panels to the GridBag Layout
              contain = frame.getContentPane();
              grid = new GridBagLayout();
              contain.setLayout(new GridBagLayout());
              c = new GridBagConstraints();
              addComponent(panel1,0,0);
              addComponent(panel2,0,4);
              addComponent(panel3,4,0);
              addComponent(panel4,4,6);
              //setSize(1200,100);
              this.setVisible(true);
              /*Method to Add Components*/
              private void addComponent(Component co,int row,int column)
                        c.gridx = column;
                        c.gridy = row;
                        grid.setConstraints(co,c);
                        contain.add(co);
    /*Set up the content pane.
    addComponentsToPane(frame.getContentPane());*/
    //Display the window.
    //frame.pack();
    //frame.setVisible(true);
    public static void main(String[] args) {
    murali1 g = new murali1();
                   //g.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    The Compliation is totally fine,applet loads, but the gui components are not diaplyed.Any suggestions.
    Thank you.

    That's not really an applet. Or it's a half-done one. It looks like you just took a standalone app (with its own frame and everything), added "extends JApplet", commented out a few things that absolutely shouldn't work, and otherwise changed almost nothing.
    The browser won't invoke the applet's main() method. I guess that's not a problem, but are you aware that it's not being invoked?
    An applet is a kind of panel. You shouldn't be creating frames. You should put all the GUI elments in the panel...which it appears you did, but can you actually get rid of the irrelevant code? Furthermore, when you post code on these forums, you should wrap it in [code][/code] tags; it makes it much easier to read.
    An applet shouldn't call System.exit(). You'll probably get a security exception if you try running that.
    That addComponent method looks suspicious to me. You're changing the columns and row of the same object over and over again. I'm not a GUI expert, so maybe I'm wrong, but that seems really wrong.
    You shouldn't need to call this.setVisible(true) for an applet.
    I'd suggest cleaning your code up, and maybe moving some of that stuff out of the constructor anyway. In an applet it might be better placed in init().
    Message was edited by:
    paulcw

  • Help needed in swing!urgently!

    Hi im new to java envirnoment.Im working on a project,i need to design a tutorial page.
    How do i write a program for asking user to input values for a matrix form? how to i design the page for this?
    How do i invoke a Japplet?Is it the same procedure as a awt applet?For awt applet,a html file is written inorder to invoke the program. so how about Japplets or more generally for swing components?
    Is there any reference for new users in the designing of user interface components.I need to bulid a simple one,with buttons,scroll.
    Anyone knows how to plot line graphs??

    Have a loo at the Java Tutorial:
    http://java.sun.com/docs/books/tutorial/
    and the Book "Java Look and Feel Design Guidelines":
    http://java.sun.com/products/jlf/ed2/book/index.html
    -Puce

  • Help needed!!! Urgent!!! Josepheus problem ...

    I need help to solve this problem. I am able to show the winner of this game and I can show the players who are eliminated each round. However, I cannot write the program that just solve a single round instead of the whole game. I need to write a program that, until the game is over, the program should print the state of the game after each round. Once the game is over, the program should indicate which player was the winner.
    Background information:
    The Josepheus problem is a game in which N people are sitting in a circle. A person is designated to be the starter and is given a hot potato. The potato is then passed around the circle; after a designated number of passes (let's call this the pValue), the person holding the potato is eliminated. Thus, the circle now consists of one fewer people. The game then continues with the person who is sitting immediately after the eliminated player picking up the potato. The last remaining player wins.
    For example, consider a game with 6 players and pValue = 3.
    Round 1:
    Player 0 starts with the potato (note: being good Computer Scientist, we'll start counting at 0). The potato is then passed to Player 1, then to Player 2, and then to Player 3. Player 3 is left with the potato, and is thus is eliminated. The circle now consists of Players 0, 1, 2, 4, and 5. The potato is given to Player 4.
    Round 2:
    Player 4 starts with the potato. The potato is then passed to Player 5, then to Player 0, and then to Player 1. Player 1 is left with the potato, and is thus eliminated. The circle now consists of Players 0, 2, 4, and 5. The potato is given to Player 4.
    and so on ...
    Would somebody please help me!!!

    Try this:
    // JosepheusPlayer.java
    public class JosepheusPlayer
        public int num; //player number
        public JosepheusPlayer next;
         * Creates a player with a number.
         * @param num The number of the player.
        public JosepheusPlayer(int num)
            this.num = num;
    // JosepheusGame.java
    import java.util.*;
    public class JosepheusGame
        private int totalPlayer;
        private int pValue;
        private int startingPlayer;
         * Testing purpose.
        public static void main(String[] args)
        throws Exception
            (new JosepheusGame(6, 3, 2)).play();
         * Creates a game.
         * @param totalPlayer Total number of players.
         * @param pValue Number of passes.
         * @param startingPlayer Number of the starting player.
         * @throws Exception If totalPlayer <= 0 or pValue <= 0
         *                    or totalPlayer <= startingPlayer < 0
        public JosepheusGame(int totalPlayer, int pValue, int startingPlayer)
        throws Exception
            if (totalPlayer <= 0)
                throw new Exception("Value of totalPlayer should be more than 0");
            if (pValue <= 0)
                throw new Exception("Value of pValue should be more than 0");
            if ((startingPlayer < 0) || (startingPlayer > (totalPlayer - 1)))
                throw new Exception("Value of startingPlayer should be 0 or more but not more than (totalPlayer - 1)");
            this.totalPlayer = totalPlayer;
            this.pValue = pValue;
            this.startingPlayer = startingPlayer;
         * Plays the game of Josepheus problem.
        public void play()
            System.out.println();
            System.out.println("Start of the game.");
            System.out.println("Number of players = " + totalPlayer + ", P-value = " + pValue + ", Starting = " + startingPlayer);
            System.out.println();
            JosepheusPlayer current = new JosepheusPlayer(0);
            JosepheusPlayer first = current;
            JosepheusPlayer start = null;
            int cnt = 0;
            if (startingPlayer == 0)
                start = first;
            for (int i = 1; i < totalPlayer; i++)
                current.next = new JosepheusPlayer(i);
                current = current.next;
                if (startingPlayer == i)
                    start = current;
            current.next = first;
            current = start;
            int roundNumber = 1;
            while (current.next != current)
                current = playOneRound(current, roundNumber++);
            System.out.println("The winner is = " + current.num);
            System.out.println("End of the game.");
            System.out.println();
         * Plays one round of Josepheus problem.
         * @param start Starting player of the round.
         * @param roundNumber Round number of the game.
         * @return Next starting player after one round.
        public JosepheusPlayer playOneRound(JosepheusPlayer start, int roundNumber)
            System.out.println("Round #" + roundNumber);
            JosepheusPlayer current = start;
            JosepheusPlayer last = null;
            for (int i = 0; i < pValue; i++)
                System.out.println("    Player " + current.num + " has the potatoe");
                last = current;
                current = current.next;
            last.next = current.next;
            System.out.println("    Dead player is " + current.num);
            System.out.println();
            return current.next;
    }You can test it with:
    java JosepheusGameChange the values in the main method of JosepheusGame to do other tests.

  • Help needed for HSC project, urgent.

    Hi,
    I am having further troubles. In my storybook on the first page all the buttons are appearing, I do not want this. How do I code to fix that, the only button I want on the first page is "page1_btn"
    will paste my coding into here, and could you please tell me what to do to fix this ?
    page2_btn.visible= false;
    p3_first_btn.visible= false;
    page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);
    function turnpage2 (evt:MouseEvent):void {
      screen_movie.gotoAndPlay ("page2");
      page1_btn.visible = false;
    page2_btn.visible= true; 
    page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);
    function turnpage3 (evt:MouseEvent):void {
    screen_movie.gotoAndPlay ("page3");
    page2_btn.visible= false;
    p3_first_btn.visible= true;
    p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3a);
    function turnpage3a (evt:MouseEvent):void {
    screen_movie.gotoAndPlay ("page3a");
    p3_first_btn.visible= false;
    And, also the reason why I am setting the buttons to visible= true; at the start and visible= false; at the end is because I can only have one button for each page.
    Please help someone,
    Regards,
    Adam

    In your code you are:
    1. setting page2_btn and p3_first_btn to visible false, then you set an event listener and function for page1_btn.
    2. setting page2_btn to be visible true and setting an event listener and function for that button.
    3. setting p2_first_btn to be visible true and setting an event listener and function for that button.
    If all of this code is in the same frame, then you are turning all of the buttons' visible properties to true.
    If you only want one of those buttons to be visible at any one time then set the visible property for page2_btn to true at the end of the function turnpage2 and do the same for p2_first_btn.
    Something like this:
    page2_btn.visible= false;
    p3_first_btn.visible= false;
    page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);
    function turnpage2 (evt:MouseEvent):void {
      screen_movie.gotoAndPlay ("page2");
      page1_btn.visible = false;
      page2_btn.visible= true; 
    page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);
    function turnpage3 (evt:MouseEvent):void {
    screen_movie.gotoAndPlay ("page3");
    page2_btn.visible= false;
    p3_first_btn.visible= true;
    p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3a);
    function turnpage3a (evt:MouseEvent):void {
    screen_movie.gotoAndPlay ("page3a");
    p3_first_btn.visible= false;
    You may have to make more changes, I'm guessing at what is going on in your movie.

  • Help needed exporting PDF! urgent!

    Hello, I`ve been working on a catalog for the past 2 months, and now its done. But when I export it to PDF only one side(right) has pages numbered and head and foot info. What am I donig here? When the documet is still in indesign everything is normal and there. I has to be someking of master problem, but all the masters applied to pages look fine. Please help, as the thing is supposed to go into print today.

    Do you have pages with different master pages throughout the document, for example does your pages panel look like this
    |A
    A|A
    A|B
    B|B
    B|B
    B|C
    C|C
    C|D
    Where A master page is paired with B, starting a new section, B is paired with C (starting section) etc.
    If you do, make sure that no object crosses the Spine even by .00001 mm, as this causes the Left Master items to disappear when A meets B and C meets D.
    that make sense?

  • Help needed on BEx Query Urgently

    Hello Gurus,
                  I have query, in which, when a user logs in, the user will see list of customers assigned to that particular user only, if they exist in cube. When I execute the report RSRT or ADHOC, it is displaying all the customers correctly, but not the values. But, when I go to 'Key Figure Definition' in RSRT for each customer, it is showing correct values, but displaying different value in the query.
    EX.
    Actual Values for the customers:
    customer1   100
    customer2     50
    customer3   125
    customer4   135
    customer5   150
    customer6   1000
    Result         1550
    But it is displaying like this, when I execute
    customer1   1000
    customer2   1000
    customer3   1000
    customer4   1000
    customer5   1000
    customer6   1000
    Result         1000
    I couldn't figureout this issue.
    Any help is appreciated with points.
    Thanks In Advance
    Regards,
    PNK

    I checked the report again. It is actually displaying like this..
    Actual Values for the customers:
    customer1 100
    customer2 50
    customer3 125
    customer4 135
    customer5 150
    customer6 1000
    Result       1550
    But it is displaying like this, when I execute
    customer1 1550
    customer2 1550
    customer3 1550
    customer4 1550
    customer5 1550
    customer6 1550
    Result      1550
    Result is some how over writting the values for single values.
    Regards,
    PNK
    Edited by: pnk on Apr 23, 2008 9:27 PM

  • Help needed for compiling error  URGENT

    Hello,
    I have been looking at this compilation error for a while and I cannot figure it out.
    I am compiling with this command:
    javac -classpath classes -sourcepath src -d classes src\pshah3\library\gui\GraphicalGui.java
    The error is:
    C:\java\hw5>javac -classpath classes -sourcepath src -d classes src\pshah3\library\gui\GraphicalGui.java
    src\pshah3\library\gui\GraphicalGui.java:32: error while writing <anonymous pshah3.library.gui.GraphicalGui$1>:classes\pshah\library\gui\GraphicalGui$1.class
    (The system cannot find the path specified)
    public void actionPerformed(ActionEvent e) { System.exit
    (0); }
    Why is it telling me that it cannot find the path, when it has to create the .class file itself?
    I would appreciate some insight into this problem?
    Thanks,
    Premal

    Thank you for you help, but i'am still a bit confused. The "pshah" was a typo, it should have been pshah3, so that's not the problem. Here's a more detailed explanation of what i'am trying.
    I am declaring the exitlister class in the following path:
    c:\java\hw5\src\pshah3\library\gui
    The file is fairly simple, it looks like this.
    package pshah3.library.gui;
    import java.awt.*;
    import java.awt.event.*;
    public class ExitListener extends WindowAdapter{
         public void windowClosing(WindowEvent event) {
              System.exit(0);
    The other file that i'am including is in the same location...it starts out like this.
    package pshah3.library.gui;
    import pshah3.library.*;
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class GraphicalGui {
              public static void main (String[] args){     
              JFrame backGround = new JFrame("Tech Library");
              backGround.setSize(400,150);
              backGround.addWindowListener (new ExitListener());
              Container content = backGround.getContentPane();
    I am compiling from the c:\java\hw5 directory with the command
    javac -classpath classes -sourcepath src -d classes src\pshah3\library\gui\GraphicalGui.java
    I am doing this so all the classes go in a "classes" directory with the same heirarchy as the source.
    Do you think i'am doing something funky with the packages??
    Again the error is:
    src\pshah3\library\gui\GraphicalGui.java:39: error while writing <anonymous pshah3.library.gui.GraphicalGui$1>: classes\pshah3\library\gui\GraphicalGui$1.class
    (The system cannot find the path specified)
    public void actionPerformed(ActionEvent e) { System.exit
    (0); }
    THANKS A LOT!!!

  • Minor help needed with an applet that wont load

    problem is that the applet will not load for some reason can anyone point out where i went wrong. i'm new to java programming thanks........
    //a guessing game number 1 - 1000
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class lab4 extends JApplet implements ActionListener
    int count;
    boolean firstguess = true;
    //graphical user interface components
    JLabel guessLabel, countLabel,resultLabel;
    JTextField guessField, countField, resultField;
    // JButton guessButton;
    public void init()
              //obtain content pane and change its layout to a flowlayout
                   Container container = getContentPane();
                   container.setLayout ( new FlowLayout());
              guessLabel = new JLabel(" Enter your Guess and press Enter: ");
                        container.add(guessField);
                        guessField= new JTextField(10);
                        container.add(guessLabel);
                        guessField.addActionListener(this);
                        countLabel=new JLabel("Count: ");
                        container.add(countLabel);
                        countField= new JTextField(15);
                        countField.setEditable(true);
                        container.add(countField);
                        resultLabel = new JLabel(" The secret number was: ");
                        container.add(resultLabel);
                        resultField= new JTextField(25);
                        resultField.setEditable(false);
                        container.add(resultField);
                   /* //create button
                        guessButton=new JButton(" Enter My Guess ");
                        guessButton.addActionListener(this);
                        container.add(guessButton);*/
         public void actionPerformed(ActionEvent e)
              //start guessing
              int number, secret;
              if(firstguess)
                   secret = createSecret(); //assign random number to secret
                   number= Integer.parseInt(e.getActionCommand());
                   if (number == secret)
                             showStatus(" Congrat's You've Guessed My Number !!! ");
                             resultField.setText (Integer.toString (secret) );
    ++count;
                             firstguess= true;
                        if(number < secret)
                             showStatus(" Nope Higher Guess Again ");
                             guessField.setText("");
                   ++count;
                             firstguess= false;
              if(number > secret)
                        showStatus(" Nope Lower Guess Again ");
                        guessField.setText("");
                   ++count;
                        firstguess= false;
    public int createSecret()
              int anyNumber;
              anyNumber = 1+(int) (Math.random() * 1000);
         return anyNumber;
    }//end of program
    <!-lab4.html code to run applet>
    <html>
    <applet code = "lab4.class" width = "450" height="179">
    </applet>
    </html>

    im using Edit plus to compile my code.. the java compiler gives me no error however the applet viewer does..
    ---------- Java Compiler ----------
    Normal Termination
    Output completed (7 sec consumed).
    ---------- Applet Viewer ----------
    Warning: Can't read AppletViewer properties file: C:\WINDOWS\.hotjava\properties Using defaults.
    GetModuleHandleA succeed
    LoadLibrary returns baaa0000
    java.lang.NullPointerException
         at java.awt.Container.addImpl(Container.java:439)
         at java.awt.Container.add(Container.java:298)
         at lab4.init(lab4.java:34)
         at sun.applet.AppletPanel.run(AppletPanel.java:341)
         at java.lang.Thread.run(Thread.java:536)
    Normal Termination

  • Help needed in SQL Loader-Urgent..!

    Hi All,
    I am having a staging table with 4 columns, I have to insert
    values in 3 of the columns from a CSV file using SQl Loader( The
    CSV file has only 3 columns in it) and a default value has to be
    inserted in to the 4th column.How can I attain this?? Can I have
    this default
    value logic written in the Control file used for the data insert? If
    yes, Please tell me how..
    Thanks,
    Vidya

    did you refer the doc before posting this question?
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96652/toc.htm

  • Signed applet stopped working in 1.4.2_04

    We have a signed applet that accesses the file system. After installing 1.4.2_04 it produces this exception
    java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkExec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at edu.nebraska.foundation.applets.AccessApplet.openNewSession(AccessApplet.java:35)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
    java.lang.Exception: java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
    .This was working in 1.4.2 and 1.3.1_08. Anyone else have this problem?

    Sorry, copied and pasted the following, hope it helpes.
    The following examples are for a win 2000 machine, for linux
    you have to use alternative paths but I think the commands
    are about the same.
    The SUN jre doesn't care about IE settings, if an applet is signed it will ask the user "do you trust", if
    the user chooses yes or always the applet can do pretty much anything.
    Because anybody can sign an applet so it will pop up the do
    you trust dialog I prevent this dialog from popping up by
    adding the following to the
    C:\Program Files\Java\j2re****\lib\security\java.policy
    under grant { [/b]
    [color red]
    permission java.lang.RuntimePermission "usePolicy";
    [color]
    You now need to set up special permissions for sites that
    need it, signed applets get no special treatment since you
    specified in the java.policy that policy should allways be
    used.
    When your applet needs to do something it normally could
    not do (applet security) [b]and it needs to do this
    when a user clicks on a html button (applet method called
    from javascript), than all the signing and policy settings
    in the world wouldn't work Unless you grant all permission
    to all code.
    This is because the Java Plug-in executes methods with
    applet sandbox security restrictions.
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0404&L=java-security&F=&S=&P=4012
    To solve this you can start a new thread that checks ...
    times a second if a variable meets certain conditions.
    These conditions are changed with public methods called
    from JavaScript. When a variable meets certain Conditions
    this thread will start the method that will perform
    normally restricted tasks.
    Here is an example where the applet doesn't work
    (the batchfile, html file are OK)
    Note that running this code with Mozilla on my w2k machine
    crashes Mozilla (not on my Fedora machine)
    Batch file to sign the applet: (please note this will
    delete some files)
    del *.cer
    del *.com
    del *.jar
    del *.class
    javac -classpath ".;C:\Program Files\Java\j2re1.4.2_04\lib\plugin.jar" test.java
    keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass pass -storepass pass
    jar cf0 test.jar test.class
    jarsigner -keystore harm.com -storepass pass -keypass pass -signedjar sTest.jar test.jar harm
    del *.classThe html page:
    <DIV id="dvObjectHolder">  </DIV>
    <br><br>
    <script>
    if(window.navigator.appName.toLowerCase().indexOf("netscape")!=-1){ // set object for Netscape:
         document.getElementById('dvObjectHolder').innerHTML = "        <object ID='appletTest1' classid=\"java:test.class\"" +
                    "height=\"0\" width=\"0\" onError=\"changeObject();\"" +
              ">" +
                    "<param name=\"mayscript\" value=\"Y\">" +
                    "<param name=\"archive\" value=\"sTest.jar\">" +
            "</object>";
    }else if(window.navigator.appName.toLowerCase().indexOf('internet explorer')!=-1){ //set object for IE
         document.getElementById('dvObjectHolder').innerHTML =      "<object ID='appletTest1' classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"" +
                   "         height=\"0\" width=\"0\" >" +
                   "   <param name=\"code\" value=\"test.class\" />" +
                      "<param name=\"archive\" value=\"sTest.jar\">" +
                   " </object>"
    </script>
    <LABEL id="lblOutputText">This text will be replaced by the applet</LABEL>
    <BR>
    <input value="Javascript to java" type=button onClick="document.appletTest1.fromJavaScript()"><br>The applet:
    // new class for jsObject!!!! since 1.4.2 compile this:
    // javac -classpath "C:\Program Files\Java\j2re1.4.2_01\lib\plugin.jar" test.java
    // since jaws.jar does not exsist anymore
    // to compile with jaws: javac -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" test.java
    import netscape.javascript.*;
    public class test extends java.applet.Applet {
        JSObject win;
        JSObject outputLabel;
        public void init() {
             try{
                 win = JSObject.getWindow(this);
                 outputLabel = (JSObject) win.eval("document.getElementById('lblOutputText')");
              outputLabel.setMember("innerHTML", "<center><h1>From Init<br>Your homedir " + System.getProperty("user.home") + "</h1></center>");
            }catch(Exception e){
                 e.printStackTrace();
        public void fromJavaScript(){
             try{
                     outputLabel.setMember("innerHTML", "<center><h1>From javascript<br>Your homedir: "+ System.getProperty("user.home") + "</h1></center>");
            }catch(Exception e){
                 e.printStackTrace();
    }When you put the files in c:\temp, run the batch file to
    compile and sign the applet and then open the html file you
    will be asked if you trust ... you can say yes and from
    init the applet can read user.home. Click on the button and
    you will get the following stack trace:
    java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at test.fromJavaScript(test.java:20)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)Conclusion: the applet can read user.home but not from
    JavaScript.
    Here is the applet that does work because a method called
    from javaScript doesn't perform a restricted task.
    // new class for jsObject!!!! since 1.4.2 compile this:
    // javac -classpath "C:\Program Files\Java\j2re1.4.2_01\lib\plugin.jar" test.java
    // since jaws.jar does not exsist anymore
    // to compile with jaws: javac -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" test.java
    import netscape.javascript.*;
    public class test extends java.applet.Applet {
         JSObject win;
         JSObject outputLabel;
         boolean buttonFromJavaClicked = false;
         checkJavaScriptEvent evt = new checkJavaScriptEvent();
         public void init() {
              try {
                   evt.start();
                   win = JSObject.getWindow(this);
                   outputLabel =
                        (JSObject) win.eval("document.getElementById('lblOutputText')");
                   outputLabel.setMember(
                        "innerHTML",
                        "<center><h1>From Init<br>Your homedir "
                             + System.getProperty("user.home")
                             + "</h1></center>");
              } catch (Exception e) {
                   e.printStackTrace();
         public void fromJavaScript() {
              buttonFromJavaClicked = true;
         private void fromJavaScript2() {
              System.out.println("fromjavascript2 is started");
              try {
                   String strLbl =
                        "<center><h1>From javascript<br>Your homedir: "
                             + System.getProperty("user.home")
                             + "</h1></center>";
                   outputLabel.setMember("innerHTML", strLbl);
              } catch (Exception e) {
                   e.printStackTrace();
         class checkJavaScriptEvent extends Thread {
              public void run() {
                   while (true) {
                        if (test.this.buttonFromJavaClicked) {
                             System.out.println("OK buttonfromjava is true");
                             test.this.buttonFromJavaClicked = false;
                             test.this.fromJavaScript2();
                        try {
                             Thread.sleep(300);
                        } catch (Exception e) {
                             System.out.println("exception in sleep");
                             e.printStackTrace();
                             System.exit(1);
    }

Maybe you are looking for

  • Unsupported Version error when trying to run Web Services Tutorial example

    Hi there, I'm trying to run the first example from the Java Web Services Tutorial and get the following error when I type 'asant build' in my Command Window. Buildfile: build.xml BUILD FAILED java.lang.UnsupportedClassVersionError: com/sun/tools/ws/a

  • I'm getting a compiler warning with generics in J2SDK1.5.0

    javac -source 1.5 -target 1.5 -Xlint:unchecked Test.java Test.java:72: warning: unchecked cast to type TYPE mValues = (TYPE[])new Object[aInitialSize]; My code is below, and ideas why this warning appears, is it a bug in my code or is the compiler fa

  • OEL 5.5 11gR2 Validated RPM Missing Dependencies

    OEL 5.5 attempting to install 11gR2. We are getting dependency errors when trying to run the validated rpm. The errors are when trying to find glibc and glibc-headers. It appears that we have only the x86_64 and i686 versions of glibc, but not the i3

  • XML Report Bursting and distribution

    I want to send PDF report as an attachment to more than 200 suppliers using XML Report Bursting In XML Report Bursting and distribution, do we need to configure the "Mail Server" on apps. (I mean any configuration is required on apps server)? Thanks,

  • Individual cache size too large: maximum is 10TB

    Hi All, When application is trying to open environment the following error occur: individual cache size too large: maximum is 10TB All BDB parameters are default. Environment created with the following flags: DB_CREATE | DB_INIT_TXN | DB_INIT_LOCK |