This discussion is archived
2 Replies Latest reply: Apr 1, 2013 10:07 AM by baftos RSS

Java compilation problem.. Please Help Me!

1000254 Newbie
Currently Being Moderated
hi,

I have downloaded logica smpp siimulator source code. In the source code, it contains directory /com/logica/smscsim/*.java. I try to modify the code in Simulator.java in smscsim folder. So I modify the code and compile with command

javac -cp "lib/*:." Simulator.java

A class Simulator.class was successfully build. But when I try to run the code with the command

java -cp "lib/*:." Simulator

I got error java.lang.NoClassDefFoundError: Simulator (wrong name: com/logica/smscsim/Simulator)

Maybe it has something to do with the package. I successfully compile with old package with command java -cp "lib/*:." com.logica.smscsim.Simulator, but the problem is I need to modify the Simulator.java. I dont want to use the old com.logica.smscsim.Simulator. How do I use the newly created class for Simulator.java? Here's some code of Simulator.java that I successfully compiled, but fail to run:

SImulator.java
=========


package com.logica.smscsim;

import java.io.*;
import java.util.*;

import com.logica.smpp.debug.*;
import com.logica.smpp.SmppObject;
import com.logica.smpp.pdu.DeliverSM;
import com.logica.smpp.pdu.WrongLengthOfStringException;
import com.logica.smscsim.SimulatorPDUProcessor;
import com.logica.smscsim.SimulatorPDUProcessorFactory;
import com.logica.smscsim.util.BasicTableParser;
import com.logica.smscsim.util.Table;


public class Simulator
{
static final String copyright =
"Copyright (c) 1996-2001 Logica Mobile Networks Limited\n"+
"This product includes software developed by Logica by whom copyright\n"+
"and know-how are retained, all rights reserved.\n";

static {
System.out.println(copyright);
}

/**
* Name of file with user (client) authentication information.
*/
static String usersFileName = "users.txt";

/**
* Directory for creating of debug and event files.
*/
static final String dbgDir = "./";

/**
* The debug object.
*/
static Debug debug = new FileDebug(dbgDir,"sim.dbg");

/**
* The event object.
*/
static Event event = new FileEvent(dbgDir,"sim.evt");

public static final int DSIM = 16;
public static final int DSIMD = 17;
public static final int DSIMD2 = 18;

static BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));

boolean keepRunning = true;
private SMSCListener smscListener = null;
private SimulatorPDUProcessorFactory factory = null;
private PDUProcessorGroup processors = null;
private ShortMessageStore messageStore = null;
private DeliveryInfoSender deliveryInfoSender = null;
private Table users = null;
private boolean displayInfo = true;

private Simulator()
{
}

/**
* The main function of the application displays menu with available
* options.
*/
public static void main(String args[]) throws IOException
{
SmppObject.setDebug(debug);
SmppObject.setEvent(event);
debug.activate();
event.activate();
debug.deactivate(SmppObject.DRXTXD2);
debug.deactivate(SmppObject.DPDUD);
debug.deactivate(SmppObject.DCOMD);
debug.deactivate(DSIMD2);
Simulator menu = new Simulator();
menu.menu();
}


.....


Appreciate help from anyone...

thanks...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points