Importing Graph Class/help implement a weighted graph class

Is there a way to import a graph structure into my java program so that I do not need to write my own graph class?
If not, does anyone have a graph class that I can use? I've been trying to implement this program for the past few days..
I'm having trouble implementing a weighted graph class. This is what I have so far:
import java.util.ArrayList;
import java.util.Queue;
import java.util.*;
public class Graph<T>
     private ArrayList<Vertex> vertices;
     int size = -1;
     public Graph() throws BadInputException
          ReadFile source = new ReadFile("inputgraph.txt");
          size = source.getNumberOfWebpages();
          System.out.println(size);
          vertices = new ArrayList<Vertex>();
     public int bfs(int start, int end) //breadth first search
          Queue<Integer> queue = new LinkedList<Integer>();
          if(start == -1 || end == -1)
               return -1;
          if(start == end)
               return 0;
          int[] d = new int[size];
          System.out.println(size + "vertices size");
          for(int i = 0; i < d.length; i++)
               d[i] = -1;
          System.out.println(start + " START GRAPH");
          d[start] = 0;
          queue.add(start);
          while(!queue.isEmpty())
               int r = queue.remove();
               if(r == end)
                    return d[r];
               for(EdgeNode ptr = vertices.get(r).head; ptr != null; ptr = ptr.next)
                    int neighbor = ptr.dest;
                    if(d[neighbor] == -1)
                         queue.add(neighbor);
                         d[neighbor] = d[r] + 1;
                         if(neighbor == end)
                              return d[neighbor];
          return d[end];
     public boolean addEdge(int start, int end)
          Vertex v = new Vertex();
          v = vertices.get(start);
          EdgeNode temp = v.head;
          EdgeNode newnode = new EdgeNode(end, temp);
          v.head = newnode;
          return true;
     public void setRank(int vertex, double rank) //set the weights
          vertices.get(vertex).pageRank = rank;
     public double getRank(int vertex)
          return vertices.get(vertex).pageRank;
If anyone could help. It would be greatly appreciated
Edited by: brones on May 3, 2008 12:33 PM

brones wrote:
along with the rest of my code, I'm not sure how to implement it as a weighted graphA single list is not the proper way of representing a graph. An easy way to implement a graph is to "map" keys, the source-vertex, to values, which is a collection of edges that run from your source-vertex to your destination-vertex. Here's a little demo:
import java.util.*;
public class TestGraph {
    public static void main(String[] args) {
        WeightedGraph<String, Integer> graph = new WeightedGraph<String, Integer>();
        graph.add("New York", "Washington", 230);
        graph.add("New York", "Boston", 215);
        graph.add("Washington", "Pittsburgh", 250);
        graph.add("Pittsburgh", "Washington", 250);
        graph.add("Pittsburgh", "New York", 370);
        graph.add("New York", "Pittsburgh", 370);
        System.out.println("New York's edges:\n"+graph.getEdgesFrom("New York"));
        System.out.println("\nThe entire graph:\n"+graph);
class WeightedGraph<V extends Comparable<V>, W extends Number> {
    private Map<V, List<Edge<V, W>>> adjacencyMap;
    public WeightedGraph() {
        adjacencyMap = new TreeMap<V, List<Edge<V, W>>>();
    public void add(V from, V to, W weight) {
        ensureExistenceOf(from);
        ensureExistenceOf(to);
        getEdgesFrom(from).add(new Edge<V, W>(to, weight));
    private void ensureExistenceOf(V vertex) {
        if(!adjacencyMap.containsKey(vertex)) {
            adjacencyMap.put(vertex, new ArrayList<Edge<V, W>>());
    public List<Edge<V, W>> getEdgesFrom(V from) {
        return adjacencyMap.get(from);
    // other methods
    public String toString() {
        if(adjacencyMap.isEmpty()) return "<empty graph>";
        StringBuilder b = new StringBuilder();
        for(V vertex: adjacencyMap.keySet()) {
            b.append(vertex+" -> "+getEdgesFrom(vertex)+"\n");
        return b.toString();
class Edge<V, W extends Number> {
    private V toVertex;
    private W weight;
    public Edge(V toVertex, W weight) {
        this.toVertex = toVertex;
        this.weight = weight;
    // other methods
    public String toString() {
        return "{"+weight+" : "+toVertex+"}";
}Note that I didn't comment it, so you will need to study it a bit before you can use it. If you have further question, feel free to ask them. However, if I feel that you did not take the time to study this example, I won't feel compelled to assist you any further (sorry to be so blunt).
Good luck.

Similar Messages

  • Import Java Classes

    Hello,
    Is anybody knows where i can find documentation about the Import Java Classes functions in Forms9i.
    What they are, how to implement them, etc. ?

    Hi,
    did you check teh online help for the Java Importer?
    also:
    http://otn.oracle.com/products/forms/pdf/forms_in_java_world.pdf
    http://otn.oracle.com/products/forms/pdf/javaimporter.pdf
    Frank

  • 'Cannot Resolve Symbol' error when importing custom class

    I get this error...
    c:\mydocu~1\n307\auto.java:14: cannot resolve symbol
    symbol: class Box
    import Box;
    ^
    when I try to compile auto.java, the applet that's supposed to import the class Box, which I built to be like a message box in VB. Here is the code for Box...
    import java.awt.*;
    import java.awt.event.*;
    public class Box extends Window{
         Label lblMsg = new Label();
         Button cmdOk = new Button("OK");
         Panel pnlSouth = new Panel();
         EventHandler ehdlr=new EventHandler(this);
         public Box(Frame parent){
              super(parent);
              setLayout(new BorderLayout());
              add(lblMsg, BorderLayout.NORTH);
              add(pnlSouth, BorderLayout.SOUTH);
              pnlSouth.setLayout(new FlowLayout());
              pnlSouth.add(cmdOk);
              cmdOk.addActionListener(ehdlr);
              this.addWindowListener(ehdlr);
         public void speak(String msg){
              lblMsg.setText(msg);
              this.setLocation(200,200);
              this.setSize(200,200);
              this.setVisible(true);
         private class EventHandler extends WindowAdapter
                        implements ActionListener{
              Window theWindow;
              public EventHandler(Window a){
                   theWindow=a;
              public void actionPerformed(ActionEvent e){
                   theWindow.setVisible(false);
    AND HERE IS THE CODE FOR AUTO...
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import Box;
    public class auto extends Applet implements ActionListener{
         Panel pnlCenter=new Panel();
         Panel pnlSouth=new Panel();
         Panel pnlNorth=new Panel();
         Panel pnlCenterleft=new Panel();
         Panel pnlCenterright=new Panel();
         Button cmdSubmit=new Button("Submit");
         Button cmdNext=new Button("Next");
         Button cmdPrev=new Button("Previous");
         Label lblLoc=new Label("LOCATION:");
         Label lblDate=new Label("DATE:");
         Label lblMile=new Label("MILEAGE:");
         Label lblCost=new Label("COST:");
         Label lblDesc=new Label("DESCRIPTION:");
         Label lblFind=new Label("FIND LOCATION:");
         Label lblDisp=new Label();
         TextField txtLoc=new TextField();
         TextField txtDate=new TextField();
         TextField txtMile=new TextField();
         TextField txtCost=new TextField();
         TextArea txtDesc=new TextArea();
         TextField txtFind=new TextField();
         Box bxOne = new Box((Frame(this).getParent()));
         /*by declaring these four variables here, they are instance level, meaning they are
         available to the whole applet*/
         String textFile="auto.txt";
         String list[] = new String[100];
         String sort[] = new String[100];
         int counter=0;
         int count=0;
         String currentLine="";
         int i;
         int sortcount;
         public void init(){
              this.setLayout(new BorderLayout());
              this.add(pnlNorth, BorderLayout.NORTH);
              this.add(pnlCenter, BorderLayout.CENTER);
              this.add(pnlSouth, BorderLayout.SOUTH);
              pnlNorth.setLayout(new FlowLayout());
              pnlNorth.add(new Label("VIEW RECORDS"));
              pnlCenter.setLayout(new GridLayout(1,2));
              pnlCenter.add(pnlCenterleft);
              pnlCenter.add(pnlCenterright);
              pnlCenterleft.setLayout(new GridLayout(0,1));
              pnlCenterleft.add(lblLoc);
              pnlCenterleft.add(lblDate);
              pnlCenterleft.add(lblMile);
              pnlCenterleft.add(lblCost);
              pnlCenterleft.add(lblDesc);
              pnlCenterleft.add(lblFind);
              pnlCenterright.setLayout(new GridLayout(0,1));
              pnlCenterright.add(txtLoc);
              pnlCenterright.add(txtDate);
              pnlCenterright.add(txtMile);
              pnlCenterright.add(txtCost);
              pnlCenterright.add(txtDesc);
              pnlCenterright.add(txtFind);
              pnlSouth.setLayout(new FlowLayout());
              pnlSouth.add(cmdPrev);
              pnlSouth.add(lblDisp);
              pnlSouth.add(cmdSubmit);
              pnlSouth.add(cmdNext);
              lblDisp.setText("0 of 0");
              cmdPrev.addActionListener(this);
              cmdNext.addActionListener(this);
              cmdSubmit.addActionListener(this);
         public void actionPerformed(ActionEvent e){
              String command=e.getActionCommand();
              if (command.equals("Next")){
                   if(txtLoc.getText().equals("")){
                        reader();
                        transfer();
                        writer();
                        bxOne.speak("Viewing all records");
                   }else{
                        if(counter<count-2){
                             counter++;
                             writer();
                        }else{
                             //don't move
              } else if (command.equals("Previous")){
                   if(txtLoc.getText().equals("")){
                        //do nothing
                   }else{
                        if(counter>0){
                             counter--;
                             writer();
                        }else{
                             //don't move
              } else {
                   txtLoc.setText("");
                   txtDate.setText("");
                   txtMile.setText("");
                   txtCost.setText("");
                   txtDesc.setText("");
                   reader();
                   sorter();
                   writer();
         private void writer(){
              StringTokenizer stCurrent=new StringTokenizer(sort[counter], "\t");
              txtLoc.setText(stCurrent.nextToken());
              txtDate.setText(stCurrent.nextToken());
              txtMile.setText(stCurrent.nextToken());
              txtCost.setText(stCurrent.nextToken());
              txtDesc.setText(stCurrent.nextToken());
              lblDisp.setText(String.valueOf(counter+1) + " of " + String.valueOf(count-1));
         private void reader(){
              try{
                   URL textURL=new URL(getDocumentBase(), textFile);
                   InputStream issIn=textURL.openStream();
                   InputStreamReader isrIn=new InputStreamReader(issIn);
                   BufferedReader brIn=new BufferedReader(isrIn);
                   while(currentLine!=null){
                        currentLine=brIn.readLine();
                        list[count]=currentLine;
                        count++;
              }catch(MalformedURLException exc){
              System.out.println("MalformedURLException Error");
              }catch(IOException exc){
              System.out.println("IOException Error");
              }catch(NullPointerException exc){
              System.out.println("NullPointerException Error");
         private void transfer(){
              for(i=0;i<count;i++){
                   sort=list[i];
         private void sorter(){
              sortcount=0;
              String find=txtFind.getText();
              System.out.println(String.valueOf(count));
              for(i=0;i<count-1;i++){
                   StringTokenizer st=new StringTokenizer(list[i], "\t");
                   String next=st.nextToken();
                   if (find.equals(next)){
                        sort[sortcount]=list[i];
                        sortcount++;
              count=sortcount+1;
    Any help is greatly appreciated.
    2Willis4

    Hi agian,
    I looked closer at your code, I think if you play around with directories and paths, you'll get it, and I think also when you import, you have to have put the class in a package...? Maybe? Blind leading the blind here! So at the top of your box class you have to say something like
    package org.blah.lala
    and you have to have that directory structure for the class files org/blah/lala/Box.class
    Does that make sense?
    And then when you import you say:
    import org.blah.lala.Box
    (I think)
    I cna only imagine that this 'help' I am giving you would be hilarious to a more experienced programmer!
    Anyway, best of luck.

  • How to run the imported java class in form

    Help!!!!!
    Pls help me to run the imported java class in forms.
    Package is created in forms while imported one class called
    singlexml.class and that package has one procedure and one
    function.
    I just wanted to run that class.I mean the new package.
    Thanks
    Anil

    Hi,
    It is because the converter works on byte code and it only supports a subset of the Java language (see the JC specifications). It is kind of like compiling you code on Java 6 and trying to run it on Java 5. The JCDK outlines the required compiler version.
    Cheers,
    Shane

  • Importing a class CEX file using TOOL

    Hi Forte Users,
    Would anyone know how to import a class CEX file using TOOL code? Is there
    a class in one of the libraries that I can use to do such a task?
    If anyone has some insight into such an endeavor (positive or negative)
    please respond!
    As well, I would like to express my appreciation for this mailing list - it
    has carried some excellent Forte dialogue.
    Thanks for all your help!
    Geoff Whittington
    -----Original Message-----
    From: [email protected] [SMTP:[email protected]]
    Sent: Wednesday, May 13, 1998 3:54 PM
    To: [email protected]
    Cc: [email protected]; [email protected];
    [email protected]; [email protected]
    Subject: Re: Backing up an Environment
    Hi Daniel,
    How can you use RpClean on an environment repository
    which is C-tree ? (Or is there a way to store it as B-tree
    with Forte R3 ?)
    Note also that your Name Server performances may be
    dramatically impoverished after several applications
    install/uninstall (say 8 or 10), once your Env. Mgr repository
    has grown pretty big. The only way to recycle it is then to restart
    it from an export file with the -b option.
    Please let me know,
    Vincent
    On Wed, 13 May 1998 00:03:52 +0200 Daniel Nguyen
    <[email protected]> writes:
    Hi,
    It is normal. The Export of the Environment only contains node
    definitions.
    You should also loose your partitioning definition in your Workshop.
    Have you tried the RpClean on the environment repository ?
    I would use the export file only after a crash of the environment on
    production
    site or restart from a backup of the environment repository without
    the
    user
    connexions.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Chael, Tom wrote:
    Every time I export my environment definition and rebuild the
    environment repository I loose my application definitions. I have to
    go into Econsole/Escript to Uninstall and reinstall my applications.
    Is this normal? I am on a Windows NT environment running Forte
    2.0.H.1. I have verified that I am using the correct .edf file when I
    do my environment rebuild.
    -----Original Message-----
    From: Don Nelson [SMTP:[email protected]]
    Sent: Wednesday, April 29, 1998 5:35 PM
    To: Sanchez, Bernardo
    Cc: '[email protected]'
    Subject: Re: Backing up an Environment
    Sanchez,
    Try this simple escript:
    findactenv
    exportenv
    exit
    Note that this will only export the active environments - no
    simulated
    environments will be exported.
    It's also a good idea to rebuild your environment repository
    every now and
    then. How often you do it depends partly on how many and how
    often you do
    deployments, installations, or other changes to the environment.
    However,
    once a month is not a bad starting point.
    Don
    At 04:54 PM 4/29/98 -0400, Sanchez, Bernardo wrote:
    We are currently running a cron job to backup & clean ourCentralRepository
    (bt:central) on a daily basis. This works OK.
    We would also like to backup our forte environment on a weeklybasis. Does
    anyone have a script to do this?
    Thanks in advance.
    Bernardo Sanchez DMC Inc.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/>
    ============================================
    Don Nelson
    Regional Consulting Manager - Rocky Mountain Region
    Forte Software, Inc.
    Denver, CO
    Phone: 303-265-7709
    Corporate voice mail: 510-986-3810
    aka: [email protected]
    ============================================
    "When you deal with high numbers, you need higher math." - Hobbes
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>
    You don't need to buy Internet access to use free Internet e-mail.
    Get completely free e-mail from Juno at http://www.juno.com
    Or call Juno at (800) 654-JUNO [654-5866]
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi Forte Users,
    Would anyone know how to import a class CEX file using TOOL code? Is there
    a class in one of the libraries that I can use to do such a task?
    If anyone has some insight into such an endeavor (positive or negative)
    please respond!
    As well, I would like to express my appreciation for this mailing list - it
    has carried some excellent Forte dialogue.
    Thanks for all your help!
    Geoff Whittington
    -----Original Message-----
    From: [email protected] [SMTP:[email protected]]
    Sent: Wednesday, May 13, 1998 3:54 PM
    To: [email protected]
    Cc: [email protected]; [email protected];
    [email protected]; [email protected]
    Subject: Re: Backing up an Environment
    Hi Daniel,
    How can you use RpClean on an environment repository
    which is C-tree ? (Or is there a way to store it as B-tree
    with Forte R3 ?)
    Note also that your Name Server performances may be
    dramatically impoverished after several applications
    install/uninstall (say 8 or 10), once your Env. Mgr repository
    has grown pretty big. The only way to recycle it is then to restart
    it from an export file with the -b option.
    Please let me know,
    Vincent
    On Wed, 13 May 1998 00:03:52 +0200 Daniel Nguyen
    <[email protected]> writes:
    Hi,
    It is normal. The Export of the Environment only contains node
    definitions.
    You should also loose your partitioning definition in your Workshop.
    Have you tried the RpClean on the environment repository ?
    I would use the export file only after a crash of the environment on
    production
    site or restart from a backup of the environment repository without
    the
    user
    connexions.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Chael, Tom wrote:
    Every time I export my environment definition and rebuild the
    environment repository I loose my application definitions. I have to
    go into Econsole/Escript to Uninstall and reinstall my applications.
    Is this normal? I am on a Windows NT environment running Forte
    2.0.H.1. I have verified that I am using the correct .edf file when I
    do my environment rebuild.
    -----Original Message-----
    From: Don Nelson [SMTP:[email protected]]
    Sent: Wednesday, April 29, 1998 5:35 PM
    To: Sanchez, Bernardo
    Cc: '[email protected]'
    Subject: Re: Backing up an Environment
    Sanchez,
    Try this simple escript:
    findactenv
    exportenv
    exit
    Note that this will only export the active environments - no
    simulated
    environments will be exported.
    It's also a good idea to rebuild your environment repository
    every now and
    then. How often you do it depends partly on how many and how
    often you do
    deployments, installations, or other changes to the environment.
    However,
    once a month is not a bad starting point.
    Don
    At 04:54 PM 4/29/98 -0400, Sanchez, Bernardo wrote:
    We are currently running a cron job to backup & clean ourCentralRepository
    (bt:central) on a daily basis. This works OK.
    We would also like to backup our forte environment on a weeklybasis. Does
    anyone have a script to do this?
    Thanks in advance.
    Bernardo Sanchez DMC Inc.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/>
    ============================================
    Don Nelson
    Regional Consulting Manager - Rocky Mountain Region
    Forte Software, Inc.
    Denver, CO
    Phone: 303-265-7709
    Corporate voice mail: 510-986-3810
    aka: [email protected]
    ============================================
    "When you deal with high numbers, you need higher math." - Hobbes
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>
    You don't need to buy Internet access to use free Internet e-mail.
    Get completely free e-mail from Juno at http://www.juno.com
    Or call Juno at (800) 654-JUNO [654-5866]
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Importing java class in servlet

    hi,
    i need to import a java class file in a servlet. how do i do that.
    also, when i remove the following lines, the import & the line following line,
    //JavaClass class=new JavaClass();
    msgsend class=new msgsend();
    it compiles ok, else i get the error,
    out.println cannot resolve symbol.
    the code of the servlet is as follows:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import "msgsend.class";
    * @author A
    * @version
    public class myemail2 extends HttpServlet {
    String to,bcc,cc,from,subject;
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    HttpSession session = request.getSession();//geting a new session everytime this is called
    PrintWriter out = response.getWriter();
    try
    System.out.println(1);
    response.setContentType("text/html");
    out.println("<html>");
    out.println("<head>");
    out.println("<title> </title>");
    out.println("</head>");
    to=request.getParameter("to");
    from=request.getParameter("from");
    bcc=request.getParameter("bcc");
    cc=request.getParameter("cc");
    subject=request.getParameter("subject");
    System.out.println(to);
    //JavaClass class=new JavaClass();
    msgsend class=new msgsend();
    System.out.println(2);
    out.println("<body align= center bgcolor='white'>");
    out.println("<br><br><br><br><H2 align=center> ");
    out.println("<FONT color=#ffffff face=arial size=2></FONT>");
    out.println("</FORM>");
    out.println("</B><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><pagebreak>");
    out.println("<footer align=center><font size=1><a href='/wpc.html'>");
    out.println("Home Page");
    out.println("</a></footer>");
    //place javascript function for exiting window
    out.println("</form>");
    out.println("</body>");
    out.println("</html>");
    } catch(Exception e){ }
    out.close();}
    pls help,
    thanx,
    ashna

    You have to do like the others import. You have to put import and the complete path(with all the packages).
    For example:
    import mypackage.msgsend;
    and if you wouls like to import all the classes of a package use:
    import mypackage.*;

  • Importing WebService class into Forms10g

    Hi ,
    I want to import webservice from Jdeveloper in Forms10g.I am using Jdeveloper 10.1.3.4 complaint with JDK 1.4. When I import the class in Forms10g from Jdeveloper it gave me error:
    Importing Class Proxy.classes.oracle.srtutorial.datamodel.proxy.SendServiceSoapClient...
    Exception occurred: java.lang.UnsupportedClassVersionError: Proxy/classes/oracle/srtutorial/datamodel/proxy/SendServiceSoapClient (Unsupported major.minor version 49.0)
    I figured out that this error is due to different versions of JDK used in Oracle Forms10g(JDK 1.3) and Jdeveloper 10.1.3.4(JDK 1.4). So I changed the compile properties in Jdev to 1.3.
    After changing this to 1.3 when I import the class the previous error is resolved but I get another error :
    Importing Class Proxy.classes.oracle.srtutorial.datamodel.proxy.SendServiceSoapClient...
    Exception occurred: java.lang.NoClassDefFoundError: Proxy/classes/oracle/srtutorial/datamodel/proxy/SendServiceSoapClient (wrong name: oracle/srtutorial/datamodel/proxy/SendServiceSoapClient)
    Please help how to resolve this.
    Regards,
    Noman
    Edited by: user773433 on Aug 11, 2009 4:33 AM

    Hi,
    I have tried. The problem is when I make the JAR file in Jdeveloper and Change the class path in Windows. The Jar doesnt shows up in Formgs10g when we import the class. I have tried several times by adding the path of JAR file in windows environment but still it doesnt shows up..
    Regards,
    Edited by: user773433 on Aug 12, 2009 10:54 AM

  • Import the classes in the package java.util

    I haven't taken a class in two years so I have ideas but am unsure of myself, and I most likely am way off base, but is this how you import the classes in the package java.util
    import java.util.*;
    I would appreciate anyone's help. I have a lot of questions.
    Thanks,
    rp

    My assignment is below so that you will know exactly what I am asking. I am being asked to create an instance of LinkedList. I know that this is a part of the java.util. So when you create an instance of LinkedList would that be similar to instance variables? or am I misunderstanding something. I have several ideas, so I will start with the first one.
    LinkList();
    I really appreciate your taking the time to answer my questions to help me to rebuild my confidence in doing this.
    Thanks,
    // 2. import the classes in the package java.util
    public class MyProgram
         public static void main(String [] args)
              // 3. Create an instance of LinkedList
              // 4. add 5 entries to the list so that it contains
              //     Ann, Bart, Carl, Dirk, Zak
              // 5. display the list on one line using a loop and ADT list methods
              System.out.println("\n\n3. ");
              // 6. display the list using one println
              System.out.println("\n\n4. ");
              // 7. create a ListIterator object for the list
              // 8. display the list on one line using the iterator
              System.out.println("\n\n6. ");
              // 9. restore the iterator to the first item in the list
              // 10. retrieve and display the first item in the iteration,
              //      then advance the iterator to the next item
              System.out.println("\n\n8. ");
              // 11. advance the iterator to the end of the list without displaying anything;
              //      do not use the length of the list
              // 12. display the last item in the list
              System.out.println("\n\n10. ");
              // 13. move back to the beginning of the list without displaying anything;
              //      do not use the length of the list
              // 14. display the first item in the list
              System.out.println("\n\n12. ");
              // 15. advance the iterator to the end of the list without displaying anything;
              // 16. advance the iterator - what happens?
              System.out.println("\n\n14. ");
              // 17. advance the iterator within a try block; catch the exception, display a message,,
              //      and set the iterator back to the beginning of the list.
              System.out.println("\n\n15. ");
              // 18. what does nextIndex and previousIndex return?
              System.out.println("\n\n16. ");
              // 19. move the iterator to the third item in the list; if you were to
              //      execute next(), the third item would be returned and the iterator
              //      would advance to the 4th item.
              System.out.println("\n\n17. ");
              // 20. add the string "New" to the list; where is it inserted relative to
              //      the current item in the iteration?
              System.out.println("\n\n18. ");
              // 21. remove the current item; what happens?
              System.out.println("\n\n19. ");
              // 22. display the current item in the list without advancing the iteration
              //      in 2 ways, as follows:
              // 22A - using only iterator methods
              System.out.println("\n\n20A. ");
              // 22B using an iterator method and list methods
              System.out.println("\n\n20B. ");
              // 23. advance the iterator and remove the current item; which one is removed?
              System.out.println("\n\n21. ");
              // 24. move the iterator back and remove the current item; which one is removed?
              System.out.println("\n\n22. ");
              // 25. move the iterator to the first item in the list and change it to "First"
              System.out.println("\n\n23. ");
         } // end main
    } // end MyProgram

  • RE: Importing a class CEX file using TOOL

    What exactly are you trying to do when you say "import"? I can think of
    two possibilities:
    1. You simply want to import the text of the file, in which case
    you can use Forte's File class.
    2. You actually want to load the class definition and instantiate
    an object based on that class. If so, you will need to deploy the class
    in a library and use Forte's dynamic class loading and instanceAlloc().
    This is well documented in the Forte manuals.
    CJ
    Chris Johnson
    BORN Information Services, Inc.
    612-417-6035 (direct)
    612-510-4077 (pager)
    -----Original Message-----
    From: Geoffery Whitington [SMTP:[email protected]]
    Sent: Thursday, May 14, 1998 9:24 AM
    To: [email protected]
    Subject: Importing a class CEX file using TOOL
    > ----------
    > From: Geoffery
    Whitington[SMTP:[email protected]]
    > Sent: Thursday, May 14, 1998 9:24:28 AM
    > To: [email protected]
    > Subject: Importing a class CEX file using TOOL
    > Auto forwarded by a Rule
    >
    Hi Forte Users,
    Would anyone know how to import a class CEX file using TOOL
    code? Is there
    a class in one of the libraries that I can use to do such a
    task?
    If anyone has some insight into such an endeavor (positive or
    negative)
    please respond!
    As well, I would like to express my appreciation for this
    mailing list - it
    has carried some excellent Forte dialogue.
    Thanks for all your help!
    Geoff Whittington
    > -----Original Message-----
    > From: [email protected] [SMTP:[email protected]]
    > Sent: Wednesday, May 13, 1998 3:54 PM
    > To: [email protected]
    > Cc: [email protected]; [email protected];
    > [email protected]; [email protected]
    > Subject: Re: Backing up an Environment
    >
    > Hi Daniel,
    >
    > How can you use RpClean on an environment repository
    > which is C-tree ? (Or is there a way to store it as B-tree
    > with Forte R3 ?)
    > Note also that your Name Server performances may be
    > dramatically impoverished after several applications
    > install/uninstall (say 8 or 10), once your Env. Mgr repository
    > has grown pretty big. The only way to recycle it is then to
    restart
    > it from an export file with the -b option.
    >
    > Please let me know,
    >
    > Vincent
    >
    > On Wed, 13 May 1998 00:03:52 +0200 Daniel Nguyen
    > <[email protected]> writes:
    > >Hi,
    > >
    > >It is normal. The Export of the Environment only contains
    node
    > >definitions.
    > >You should also loose your partitioning definition in your
    Workshop.
    > >Have you tried the RpClean on the environment repository ?
    > >I would use the export file only after a crash of the
    environment on
    > >production
    > >site or restart from a backup of the environment repository
    without
    > >the
    > >user
    > >connexions.
    > >
    > >Hope this helps,
    > >
    > >Daniel Nguyen
    > >Freelance Forte Consultant
    > >
    > >Chael, Tom wrote:
    > >>
    > >> Every time I export my environment definition and rebuild
    the
    > >> environment repository I loose my application definitions.
    I have
    > >to
    > >> go into Econsole/Escript to Uninstall and reinstall my
    applications.
    > >> Is this normal? I am on a Windows NT environment running
    Forte
    > >> 2.0.H.1. I have verified that I am using the correct .edf
    file when
    > >I
    > >> do my environment rebuild.
    > >>
    > >> -----Original Message-----
    > >> From: Don Nelson [SMTP:[email protected]]
    > >> Sent: Wednesday, April 29, 1998 5:35 PM
    > >> To: Sanchez, Bernardo
    > >> Cc: '[email protected]'
    > >> Subject: Re: Backing up an Environment
    > >>
    > >> Sanchez,
    > >>
    > >> Try this simple escript:
    > >>
    > >> findactenv
    > >> exportenv
    > >> exit
    > >>
    > >> Note that this will only export the active
    environments - no
    > >> simulated
    > >> environments will be exported.
    > >>
    > >> It's also a good idea to rebuild your environment
    repository
    > >> every now and
    > >> then. How often you do it depends partly on how many
    and how
    > >> often you do
    > >> deployments, installations, or other changes to the
    > >environment.
    > >> However,
    > >> once a month is not a bad starting point.
    > >>
    > >> Don
    > >>
    > >> At 04:54 PM 4/29/98 -0400, Sanchez, Bernardo wrote:
    > >> >
    > >> >We are currently running a cron job to backup & clean
    our
    > >> CentralRepository
    > >> >(bt:central) on a daily basis. This works OK.
    > >> >
    > >> >We would also like to backup our forte environment on
    a weekly
    > >> basis. Does
    > >> >anyone have a script to do this?
    > >> >
    > >> >Thanks in advance.
    > >> >
    > >> >Bernardo Sanchez DMC Inc.
    > >> >
    > >> >
    > >> >
    > >> >-
    > >> >To unsubscribe, email '[email protected]' with
    > >> >'unsubscribe forte-users' as the body of the message.
    > >> >Searchable thread archive
    > >> <URL:http://pinehurst.sageit.com/listarchive/>
    > >> >
    > >> >
    > >>
    > >> ============================================
    > >> Don Nelson
    > >> Regional Consulting Manager - Rocky Mountain Region
    > >> Forte Software, Inc.
    > >> Denver, CO
    > >> Phone: 303-265-7709
    > >> Corporate voice mail: 510-986-3810
    > >>
    > >> aka: [email protected]
    > >> ============================================
    > >>
    > >> "When you deal with high numbers, you need higher
    math." -
    > >Hobbes
    > >>
    > >> -
    > >> To unsubscribe, email '[email protected]' with
    > >> 'unsubscribe forte-users' as the body of the message.
    > >> Searchable thread archive
    > >> <URL:http://pinehurst.sageit.com/listarchive/>
    > >-
    > >To unsubscribe, email '[email protected]' with
    > >'unsubscribe forte-users' as the body of the message.
    > >Searchable thread archive
    > ><URL:http://pinehurst.sageit.com/listarchive/>
    > >
    >
    >
    > You don't need to buy Internet access to use free Internet
    e-mail.
    > Get completely free e-mail from Juno at http://www.juno.com
    > Or call Juno at (800) 654-JUNO [654-5866]
    > -
    > To unsubscribe, email '[email protected]' with
    > 'unsubscribe forte-users' as the body of the message.
    > Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hello,
    I don't know about any forte classes to do the job.
    But, if it just automating the imports that you are concerned with
    then you can accomplish it using fscript.
    For eg. in UNIX machines you can write a shell script to go through
    a directory, get all files with .cex extension and call fscript which
    would open a workspace/repository and do an import plan.
    Hope this helps
    Santha Athiappan
    From [email protected] Thu May 14 09:23:53 1998
    Received: (from sync@localhost) by pebble.SageIT.com (8.6.10/8.6.9) id IAA01294 for forte-users-outgoing; Thu, 14 May 1998 08:43:25 -0700
    Received: (from uucp@localhost) by pebble.SageIT.com (8.6.10/8.6.9) id IAA01283 for <[email protected]>; Thu, 14 May 1998 08:43:22 -0700
    Received: from descartes.com(205.210.27.1) by pebble.sagesoln.com via smap (V2.0)
    id xma001277; Thu, 14 May 98 08:43:10 -0700
    Received: by descartes.com with Internet Mail Service (5.5.1960.3)
    id <KRDBVHV9>; Thu, 14 May 1998 11:45:11 -0400
    Message-ID: <[email protected]>
    From: Geoffery Whitington <[email protected]>
    To: "Johnson, Chris CWT-MSP" <[email protected]>
    Cc: [email protected]
    Subject: RE: Importing a class CEX file using TOOL
    Date: Thu, 14 May 1998 11:45:10 -0400
    X-Mailer: Internet Mail Service (5.5.1960.3)
    Sender: [email protected]
    Precedence: bulk
    Reply-To: Geoffery Whitington <[email protected]>
    Hi Chris,
    The goal that I want to achieve is this: at runtime, read a CEX file from
    my filesystem and "import class" it into my workspace. It is equivalent to
    invoking the menu item "Component,Import Class/Interface".
    Basically I am generating hundreds of TOOL classes and I don't want to
    manually import them myself. I am aware of the Forte Code generator, but
    the classes I wish to generate are much too complex for the generator (I
    want virtual attributes based upon NonKeyAttributes, with their own Set and
    Get methods, as well as methods with changing/variable parameters -
    something I believe that the generator cannot handle).
    Cheers,
    Geoff Whittington
    -----Original Message-----
    From: Johnson, Chris CWT-MSP [SMTP:[email protected]]
    Sent: Thursday, May 14, 1998 11:19 AM
    To: 'Geoffery Whitington'; [email protected]
    Subject: RE: Importing a class CEX file using TOOL
    What exactly are you trying to do when you say "import"? I can think
    of
    two possibilities:
    1. You simply want to import the text of the file, in which case
    you can use Forte's File class.
    2. You actually want to load the class definition and instantiate
    an object based on that class. If so, you will need to deploy the class
    in a library and use Forte's dynamic class loading and instanceAlloc().
    This is well documented in the Forte manuals.
    CJ
    Chris Johnson
    BORN Information Services, Inc.
    612-417-6035 (direct)
    612-510-4077 (pager)
    -----Original Message-----
    From: Geoffery Whitington [SMTP:[email protected]]
    Sent: Thursday, May 14, 1998 9:24 AM
    To: [email protected]
    Subject: Importing a class CEX file using TOOL
    From: Geoffery
    Whitington[SMTP:[email protected]]
    Sent: Thursday, May 14, 1998 9:24:28 AM
    To: [email protected]
    Subject: Importing a class CEX file using TOOL
    Auto forwarded by a Rule
    Hi Forte Users,
    Would anyone know how to import a class CEX file using TOOL
    code? Is there
    a class in one of the libraries that I can use to do such a
    task?
    If anyone has some insight into such an endeavor (positive or
    negative)
    please respond!
    As well, I would like to express my appreciation for this
    mailing list - it
    has carried some excellent Forte dialogue.
    Thanks for all your help!
    Geoff Whittington
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    >
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Whether to import the class file put in JAVA_TOP

    I have put the java class file in JAVA_TOP. Now i want to access the method in that class from jsp, is it necessary to import the class file path in jsp. Without importing the class file path how can i access the method.
    JSP Coding
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.*" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <%
    sample objsample = new sample();
    %>
    <b>
    NAME : </b><input type="text" value="<%=objsample.getName()%>">
    </body>
    </html>
    Class file
    public class sample
    public sample()
    String name = "JOHN";
    public String getName()
    return name;
    Pls help me

    Hi,
    For sys outs check the following log files:
    <ORACLE_SOA_HOME>/opmn/logs/default_group~home~default_group~1.log
    or
    <ORACLE_SOA_HOME>/j2ee/home/log/home_default_group_1/system_*.log
    Here server instance name is home, change it with your server instance name.
    Dharmendra
    http://soa-howto.blogspot.com

  • Importing java classes into jsp page

    I'm trying to import java classes inside my jsp page, while doing that i am getting compilation error "package uma.natarajan.javaclasses" not found. I don't know where to copy the java files. i'm keeping my jsp files under public_html folder
              

    Hi uma,
              create uma\natarajan\javaclasses under weblogic_home\myserver and copy java
              classes(u want to import) to uma\natarajan\javaclasses and then u try.
              Concept is the java classes u import should be present in a classpath. Hope
              this may help u,
              Arun,
              [email protected]
              "uma natarajan" <[email protected]> wrote in message
              news:3a490bcb$[email protected]..
              > I'm trying to import java classes inside my jsp page, while doing that i
              am getting compilation error "package uma.natarajan.javaclasses" not found.
              I don't know where to copy the java files. i'm keeping my jsp files under
              public_html folder
              

  • Not able to import a class in jsp

    Hello.
    I want to import a custom java class (non-packaged) that resides in the same directory as the
    jsp file.
    I tried the page directive as:
    <%@ page import="MyClass.class" %>
    But Tomcat complains and doesn't compile.
    Shows the following error message:
    No identifier.
    What's wrong here? Is there another way to import a custom class?
    Please help. Thank you.

    You need to place your custom class in a package. Has to do with tomcat not giving you access to the default package.

  • Classpath problems when importing my classes

    I'm using a tutorial with sample programs dealing with bank accounts.
    I get this error:
    InterestBearingAccount.java [9:1] '.' expected
    import Account;
    ^
    1 error
    Errors compiling InterestBearingAccount.
    The Account class already exists in the current directory. I've tried everything as far as setting the classpath variable (nothing, just a period, period & slash, the actual complete path for the current directory, nothing works!!!!!). I also tried using -classpath (.) and the end of my javac command and that seemed to not work at all.
    The Java Coffee Break tutorial have some already compiled (*.class) files and they run fine. My *.java files are identical. In fact, I cut and pasted them so I know it's not a typo.
    My path is set to include the jdk1.4.0\bin directory and I've only begun to have problems now that I need to import existing classes into the programs.
    I should mention that I get the same error using Forte environment or doing it at the command prompt window. Please help.

    Thanks ATMGUY. I commented out the import statements in both InterestBearingAccount and AccountDemo and it worked fine. I guess the author of that tutorial was obviously not working with jdk 1.4.
    As far as using packages, com.kusek.bank would make a good package name then??
    The statement:
    package com.kusek.bank; OR a shorter version package kusek.bank;
    should be added to all three classes and no import statements would then be necessary, right??
    I just remember reading that it should be something unique as a good habit to get into.
    I'm trying to learn enough to make a useful GUI program for a special project so I probably should be using packages anyway when I get to that point.
    My programming backround is limited to procredural languages Basic, QBasic, Pascal, and Fortran and I find myself still wanting to think in those terms. I have read several web sites and worked through some basic examples but I still have much to learn. I once I can grasp how to write OOP style it would be nice to look at code for a somewhat detailed application (like a store checkout app) and have every line explained as to why it's there. I can see where it makes sense to have your GUI classes predefined (Swing), File I/O, serial port communications, and even things like this InterestBearingAccount example that extends from the Account class utilizing its basic attributes but overriding the constructors for the additional parameters (interest calculation) that are passed. How to take a common problem and go about creating a solution is what I need to see being done to help me.
    My telemetry project uses VHF radios with packet radio modems to monitor two diesel engines and turn one off if the other turns off. The modems have built in A/D data gathering and can also output control signals, they just need to be told what to do. I can manually use a Windows Hyperterminal session and type in "connect Engine1" and use commands to determine the A/D inputs "analog". The modems have built in end-to-end acknowledgement so the only think I need is an application than can be setup to run in the Startup folder to handle this. It would use a timer class to "poll" engine1 every 5-10 minutes and if it has stopped (based on the response of the "analog" command) I would "disconnect" from engine1 and "connect" to engine2 and send a "ctrl B off" or something similar. The standard responses from the modem should allow me just to send and recieve STRING data to and from the serial port and parse them as needed. I need at least this much but it shouldn't be too much harder to develop a way to reset the system(reverse of this) when that is required. I could also read a water pressure value at one of the locations and display that on the screen along with the current status of the engines (using values obtained from the "analog" command on the modems).
    The hardest part of OOP programming seems to be knowing what classes are already out there and knowing how to find them or apply them. I hope Swing has classes that provide for displaying values on the Windows taskbar (my motherboard monitor freeware displays temperature readings down on the taskbar). I appreciate all the help given here. It's almost like having a private tutor.
    randy

  • How to import a .class in eclipse?

    I have a .class file w/ out the source, and im tiring to import that into my project.
    So I go to import->File System and check the .class file. It shows up in my project but when I try to instantiate it I get a "can not be instantiated to a type" error.
    any thoughts?
    this is happening to a lot of people in my course.
    thanks!

    Hi,
    i tried that what you sad, but my eclipse can't import that class.
    So: I have eclipse 3.1, and i would like to import a class (without source). I develop at the moment a J2ME project with eclipse.
    The class what i want to import is in a package, so i must to import like this: import net.jscience.math.kvm.MathFP;
    Can you tell me how in the hell can i this class to import?
    (I tried about 6 hours long, and i got some result, but not the really perfect.)
    When i make this subdirectory structure (what is in the import line) into my project, then in eclipse work the auto completing, 'till the class name. :-/. But the class is there. Egal i add an external class folder, i got always the same result.
    Please help me, because my brain at the moment wants to explode.
    Thanks a lot.

  • How to import a class in 10g

    I have a jar file and wanted to import the class into pl/sql
    I have saved the jar file in c:\ora10g\forms\java and have this path to my classpath in default.env file when i tried to import the class . I got an error
    Importing Class C:\ora10g\forms\java\XXX.jar...
    Exception occurred: java.lang.ClassNotFoundException: C:\ora10g\forms\java\XXX/jar
    Can anyone help me how to set the classpath correctly.

    The path to the jar file (including the jar file name and extension) must be added to the FORMS_BUILDER_CLASSPATH registry variable for the import step. For runtime you need to have it in the default.env.

Maybe you are looking for

  • HT1420 if you deortherize all 5 registered computers do you loose your music library

    Apparently i have registered my phone and 2 ipods to 5 computers over the years.  I have my old laptop which i have tried to deothorize but says it was never authorized.  I am wondering if i opt to  deothorize all computers, do i loose all of my musi

  • Best Workstation Card for AE and Mac Pro 3,1

    I want to upgrade my video card. What is the best one for my purposes. I do HEAVY After Effects, CG (Lightwave and Vue) I was thinking about this: http://www.nvidia.com/object/product-quadro-4000-mac-us.html Pros? Cons? This is my system config. MacP

  • Equivalent table for A920 & A928 in 3.1 i version to ECC 6.0

    Hi Friends, I am working in an upgrade project from 3.1 i to ECC 6.0 I have a report to be migrated from old version to ECC 6.0 I have 2 tables - A920 & A928 which are no longer available in ECC 6.0 A920 is a condition table - Customer / Price list /

  • Click Wheel won't work.

    I've tried all the R's and everything and it still won't work, do I need to send it in for a repair? Because it's brand new.

  • Doubt in performance

    hi, i am retrieving records from db. i am using java and jsp. The table that i am using has nearly 1 lakh records. it's taking time to retrieve records from db. by the time, it retrieves, jrun gets time out. and it's giving JRun Connector Proxy reque