Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java compilation problem.. Please Help Me!

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Thanked 0 Times in 0 Posts

    Default Java compilation problem.. Please Help Me!


    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:

    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 {

    * 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
    Simulator menu = new Simulator();

    Appreciate help from anyone...


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,273 Times in 2,244 Posts

    Default Re: Java compilation problem.. Please Help Me!

    .NoClassDefFoundError: Simulator (wrong name: com/logica/smscsim/Simulator)
    The class's name includes the package name. You need to include that name with the java command and the classpath must point to the folder holding the folder at the beginning of the package name: com.

    Simpler for now would be to remove the package statement from the source and then the java command should work as you used it.

    Please edit your post and wrap your code with code tags:
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. JAVA API : Compilation error
    By Roopali in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 26th, 2013, 05:39 AM
  2. Java files compilation with java code
    By stallapp in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: July 14th, 2011, 08:12 AM
  3. Dynamic compilation problem
    By hemanth.yerra in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 29th, 2010, 09:51 AM
  4. A problem with command line compilation
    By goodguy in forum Java Theory & Questions
    Replies: 4
    Last Post: August 2nd, 2010, 10:58 AM
  5. Replies: 6
    Last Post: April 29th, 2009, 09:35 AM