• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 635
  • Last Modified:

problem running java program

Hello,


I developed a java program with eclipse that has a graphical interface. During the execution of program when I click a button I have the following message that appears:

FATAL: could not find file 'simulator.properties' in default search paths:
'null', 'C:\Users\.../properties'

this is the code :
import net.sourceforge.jpcap.simulator.PacketCaptureSimulator;
import net.sourceforge.jpcap.capture.*;
import net.sourceforge.jpcap.net.*;

import java.awt.*;
import java.awt.event.*;

import java.io.*;

import java.util.*;

import javax.swing.table.*;
import javax.swing.*;

import java.util.*;
public class FB extends JFrame implements ActionListener {
private JButton b;
private TablePanel tablePanel;

public void actionPerformed(java.awt.event.ActionEvent e) {
new Packets().simulate();
}

private void setGui() {
try {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Container cp = getContentPane();
JPanel bPanel = new JPanel();
tablePanel = new TablePanel();
b = new JButton("Afficher");
b.addActionListener(this);
bPanel.add(b);
cp.add(tablePanel, BorderLayout.CENTER);
cp.add(bPanel, BorderLayout.SOUTH);
} catch (Exception e) {
e.printStackTrace();
}
}

private class Packets {

public void simulate() {
try {
PacketCaptureSimulator sim = new PacketCaptureSimulator();
sim.addPacketListener(tablePanel);
sim.capture(256);
sim.close();
}
catch(Exception e) {
e.printStackTrace();
}
}
}


public static void main(String[] args) {
	try {
	SwingUtilities.invokeAndWait(new Runnable() {
	public void run() {
	FB f = new FB();
	f.setGui();
	f.pack();
	f.setVisible(true);

	}
	});
	} catch (Exception e) {
	e.printStackTrace();
	}
	
	}
	

	private class TablePanel extends JPanel implements PacketListener {
	/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
	JTable table;
	Object[] headers = {
	"Adresse IP source",
	"Adresse IP destination",
	"Data",
	"Protocol"
	};

	public TablePanel() {
	table = new JTable(new DefaultTableModel(null, headers));
	add(new JScrollPane(table));
	}

	public void packetArrived(Packet packet) {
		try {
		
			
		if (packet instanceof IPPacket) {
	IPPacket ip = (IPPacket)packet;
	
	String[] data = new String[] {
	ip.getSourceAddress(),
	ip.getDestinationAddress(),
	new String(ip.getData()),
	IPProtocol.getDescription(ip.getIPProtocol())
	};
	updateTable(data);
		}
		
		
		if (packet instanceof EthernetPacket) {
			EthernetPacket ethernetPacket = (EthernetPacket) packet;
			String[] data = new String[] {
			ethernetPacket.getSourceHwAddress(),ethernetPacket.getDestinationHwAddress()};
			}

			
		if (packet instanceof ARPPacket) {
				ARPPacket arpPacket = (ARPPacket) packet;
				String[] data = new String[] {arpPacket.getSourceProtoAddress(),arpPacket.getDestinationProtoAddress()};
			}

	
		}
	catch(Exception e) {
			e.printStackTrace();	
		}
	}


	public void updateTable(final String[] info) {
	SwingUtilities.invokeLater(new Runnable() {
	public void run() {
	DefaultTableModel model = (DefaultTableModel)table.getModel();
	model.addRow(info);
	}
	});
	
	}
	}
	}

Open in new window


help me !!
0
keviin55
Asked:
keviin55
  • 2
  • 2
  • 2
2 Solutions
 
objectsCommented:
its failing to find the jpcap properties file
wheat directory have you put it in?
0
 
keviin55Author Commented:
i have installed the jpcap librery at /usr/lib/jpcap-0.01.16 then i added it to build path.
0
 
objectsCommented:
what about the properties file, where is that?
SHould be in your project I think
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
vks_vickyCommented:
Yes the property file needs to be in the project root folder. Just place the properties file int the same place you have created your src
0
 
keviin55Author Commented:
thank you for your answer but i can find the proporties file haw can i find it please ?!
0
 
vks_vickyCommented:
In the root folder of jpcap library, there is a folder called properties and it contains two property files

simulator.properties
tool.properties

All the details are in that. And check the javadoc, most of the information is there on that

http://jpcap.sourceforge.net/javadoc/index-all.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now