Results 1 to 9 of 9
  1. #1
    naziya is offline Member
    Join Date
    Sep 2014
    Posts
    4
    Rep Power
    0

    Default Java Network Simulator

    Hi,
    Iam new to Java Network Simulator but i have knowledge about java. I have downloaded jns-1.7 & tried to run an example program "Simulator.java" by specifing the jar classpath while compiling as "javac -cp <path-to-jns-jar-file> Simulator.java". But i got 21 errors as follows:
    Simulator.java:3: error: package jns.command does not exist
    import jns.command.Command;
    ^
    Simulator.java:4: error: package jns.element does not exist
    import jns.element.Element;
    ^
    Simulator.java:5: error: package jns.trace does not exist
    import jns.trace.Trace;
    ^
    Simulator.java:6: error: package jns.util does not exist
    import jns.util.Preferences;
    ^
    Simulator.java:7: error: package jns.util does not exist
    import jns.util.PriorityQueue;
    ^
    Simulator.java:30: error: cannot find symbol
    private PriorityQueue m_commands; // Queue of Command objects
    ^
    symbol: class PriorityQueue
    location: class Simulator
    Simulator.java:32: error: cannot find symbol
    private Trace m_trace; //the trace object
    ^
    symbol: class Trace
    location: class Simulator
    Simulator.java:49: error: cannot find symbol
    public void setTrace(Trace trace)
    ^
    symbol: class Trace
    location: class Simulator
    Simulator.java:72: error: cannot find symbol
    public void attach(Element element)
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:85: error: cannot find symbol
    public void attachWithTrace(Element element, Trace trace)
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:85: error: cannot find symbol
    public void attachWithTrace(Element element, Trace trace)
    ^
    symbol: class Trace
    location: class Simulator
    Simulator.java:97: error: cannot find symbol
    public void schedule(Command command)
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:43: error: cannot find symbol
    m_commands = new PriorityQueue();
    ^
    symbol: class PriorityQueue
    location: class Simulator
    Simulator.java:120: error: cannot find symbol
    Element curelement = (Element) e.nextElement();
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:120: error: cannot find symbol
    Element curelement = (Element) e.nextElement();
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:130: error: cannot find symbol
    Command curcommand = (Command) e.nextElement();
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:130: error: cannot find symbol
    Command curcommand = (Command) e.nextElement();
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:175: error: cannot find symbol
    Command current_command = null;
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:190: error: cannot find symbol
    current_command = (Command) m_commands.peek();
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:195: error: cannot find symbol
    if(Preferences.verbose)
    ^
    symbol: variable Preferences
    location: class Simulator
    Simulator.java:248: error: cannot find symbol
    if(Preferences.verbose)
    ^
    symbol: variable Preferences
    location: class Simulator
    21 errors

    Iam completely new to JNS. Please help me.
    Iam trying my hand on JNS as i need to deveop a key-distribution scheme (random Key-Distribution scheme) using a simulator. As i have experience in java, i thought to use JNS instead of NS2/NS3 which seems very complex to me. Please help me. I have only 1 week of time to develop my project.
    I would be thankful if i get some help from anyone & also some jns tutorial guides to develop my project.

    Thanks alot for any help

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,423
    Rep Power
    25

    Default Re: Java Network Simulator

    Add the -Xlint compiler option to the command line to see if it displays this warning:
    Running: D:\Java\jdk1.7.0.7\bin\javac.exe -Xlint -cp Xpoi-scratchpad-3.7-20101029.jar TestCode18.java

    warning: [path] bad path element "Xpoi-scratchpad-3.7-20101029.jar": no such file or directory
    1 warning

    2 error(s)

    I added the X to the jar filename to cause this error.
    Last edited by Norm; 09-05-2014 at 04:24 AM.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    naziya is offline Member
    Join Date
    Sep 2014
    Posts
    4
    Rep Power
    0

    Default Re: Java Network Simulator

    I have added -Xlint while compiling & got the following warrings & errors:

    javac -Xlint -cp Downloads/jns-1.7/lib/jns-1.7.jar Simulator.java
    warning: [path] bad path element "Downloads/jns-1.7/lib/jns-1.7.jar": no such file or directory
    Simulator.java:3: error: package jns.command does not exist
    import jns.command.Command;
    ^
    Simulator.java:4: error: package jns.element does not exist
    import jns.element.Element;
    ^
    Simulator.java:5: error: package jns.trace does not exist
    import jns.trace.Trace;
    ^
    Simulator.java:6: error: package jns.util does not exist
    import jns.util.Preferences;
    ^
    Simulator.java:7: error: package jns.util does not exist
    import jns.util.PriorityQueue;
    ^
    Simulator.java:30: error: cannot find symbol
    private PriorityQueue m_commands; // Queue of Command objects
    ^
    symbol: class PriorityQueue
    location: class Simulator
    Simulator.java:32: error: cannot find symbol
    private Trace m_trace; //the trace object
    ^
    symbol: class Trace
    location: class Simulator
    Simulator.java:49: error: cannot find symbol
    public void setTrace(Trace trace)
    ^
    symbol: class Trace
    location: class Simulator
    Simulator.java:72: error: cannot find symbol
    public void attach(Element element)
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:85: error: cannot find symbol
    public void attachWithTrace(Element element, Trace trace)
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:85: error: cannot find symbol
    public void attachWithTrace(Element element, Trace trace)
    ^
    symbol: class Trace
    location: class Simulator
    Simulator.java:97: error: cannot find symbol
    public void schedule(Command command)
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:22: warning: [rawtypes] found raw type: Vector
    private Vector m_elements;
    ^
    missing type arguments for generic class Vector<E>
    where E is a type-variable:
    E extends Object declared in class Vector
    Simulator.java:42: warning: [rawtypes] found raw type: Vector
    m_elements = new Vector();
    ^
    missing type arguments for generic class Vector<E>
    where E is a type-variable:
    E extends Object declared in class Vector
    Simulator.java:43: error: cannot find symbol
    m_commands = new PriorityQueue();
    ^
    symbol: class PriorityQueue
    location: class Simulator
    Simulator.java:74: warning: [rawtypes] found raw type: Enumeration
    Enumeration e = m_elements.elements();
    ^
    missing type arguments for generic class Enumeration<E>
    where E is a type-variable:
    E extends Object declared in interface Enumeration
    Simulator.java:117: warning: [rawtypes] found raw type: Enumeration
    Enumeration e = m_elements.elements();
    ^
    missing type arguments for generic class Enumeration<E>
    where E is a type-variable:
    E extends Object declared in interface Enumeration
    Simulator.java:120: error: cannot find symbol
    Element curelement = (Element) e.nextElement();
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:120: error: cannot find symbol
    Element curelement = (Element) e.nextElement();
    ^
    symbol: class Element
    location: class Simulator
    Simulator.java:130: error: cannot find symbol
    Command curcommand = (Command) e.nextElement();
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:130: error: cannot find symbol
    Command curcommand = (Command) e.nextElement();
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:141: warning: [rawtypes] found raw type: Enumeration
    public Enumeration enumerateElements()
    ^
    missing type arguments for generic class Enumeration<E>
    where E is a type-variable:
    E extends Object declared in interface Enumeration
    Simulator.java:175: error: cannot find symbol
    Command current_command = null;
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:190: error: cannot find symbol
    current_command = (Command) m_commands.peek();
    ^
    symbol: class Command
    location: class Simulator
    Simulator.java:195: error: cannot find symbol
    if(Preferences.verbose)
    ^
    symbol: variable Preferences
    location: class Simulator
    Simulator.java:248: error: cannot find symbol
    if(Preferences.verbose)
    ^
    symbol: variable Preferences
    location: class Simulator
    21 errors
    6 warnings

    Please help how can i resolve this issue.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Java Network Simulator

    The error clearly states the path is wrong, it is not lying to you. So determine what the correct path is and provide that to the command.

    Just a hint: the operating system does not magically know where that Downloads folder is, provide the complete path to it like c:/Downloads/blablabla.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    naziya is offline Member
    Join Date
    Sep 2014
    Posts
    4
    Rep Power
    0

    Default Re: Java Network Simulator

    I got the same errors & warrings even if i provide the full path.

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Java Network Simulator

    Then the path you are providing is still wrong. Nobody here can look at your computer to see what you're doing wrong, you'll have to figure it out yourself.

    What operating system are you using anyway? If it isn't Windows, keep in mind that the path must be case-sensitive.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    naziya is offline Member
    Join Date
    Sep 2014
    Posts
    4
    Rep Power
    0

    Default Re: Java Network Simulator

    Iam using Ubuntu linux os.
    yes i have check my path & it is correct.
    Is there any other way out to solve this.

    Thanks for your quick response

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Java Network Simulator

    To solve a problem you first need to figure out what the problem is, and I repeat: that is your job. I can't do that for you, I don't have access to your computer. It is also incredibly not helpful that you don't post the updated command you are now executing.

    Ubuntu you say, so you can cd to the path you specify to javac? On what basis do you claim that the path is 'correct'?

    What are the user rights of the folder?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,423
    Rep Power
    25

    Default Re: Java Network Simulator

    Copy the jar file to the same folder with the java file so no path is needed.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. The One Simulator
    By Miss in forum New To Java
    Replies: 2
    Last Post: 11-27-2012, 08:15 PM
  2. Java Network simulator.
    By priya deshpande in forum Networking
    Replies: 4
    Last Post: 02-18-2012, 03:55 PM
  3. The ONE Simulator
    By TacoZ in forum New To Java
    Replies: 4
    Last Post: 02-15-2012, 06:05 AM
  4. Replies: 7
    Last Post: 05-02-2010, 10:35 PM
  5. Building a HSM Simulator
    By stunnaz101 in forum Advanced Java
    Replies: 0
    Last Post: 03-23-2010, 10:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •