This forum has been archived. Please start a new discussion on GitHub.

package com.zeroc.Ice not found Ice 3.7 Java Ubuntu 16.04

edited December 2017 in Help Center

I have a problem in java files compilation on Ubuntu (slice2java from Slice definition was successfully generated)

The error is "package com.zeroc.Ice does not exist"

The compilation command line is " javac -d pathTo/classes -classpath /pathTo/classes:/pathTo/Ice.jar /PathTo/generated/MP3/*.java "

All code source is in attachment


  • benoit
    benoit Rennes, France


    Where did you copy/get the Ice.jar file from? Are you sure it's the Ice jar file for the new Java mapping and not the old mapping (see

    You can check the content of the Ice.jar file with:

    jar tf <path>/Ice.jar

    If the classes don't start with the com/zeroc prefix, the Ice.jar file contains the Ice runtime for the old Java mapping.


  • The classes don't start with, could you tell me how can I do ?

  • neros
    edited December 2017

    Please, I'm a student and I must solve the problem

    jar tf Ice.jar > log.txt

    log.txt 43.4K
  • bernard
    bernard Jupiter, FL

    Hi Mauris,

    You just need to install and use the correct ice.jar file (with a lowercase i).

    One option is to use Maven Central, as described on

    On Ubuntu 16.04, another option is to install the libzeroc-ice3.7-java package - see

    Best regards,

  • Where can I find the right ice.jar ?

    I have already installed libzeroc-ice3.7-java

  • joegeorge
    joegeorge Jupiter, Florida

    The ice jar files are installed into /usr/share/java. For example, the Ice 3.7.0 jar file is /usr/share/java/ice-3.7.0.jar.

  • neros
    edited December 2017

    Compilation command line :

    javac -d /path/classes -classpath /path/classes:/usr/share/java/ice-3.7.0.jar /path/generated/MP3/*.java

    Compilation result into log25.txt, jar tf /usr/share/java/ice-3.7.0.jar into log2.txt

    Please help I don't have much time

  • neros
    edited December 2017

    Compilation problem solved, I have a problem in trying of execute the Server (impossible of load the main class TP3.Serveur)

    Execution command line : java TP3/Serveur

    Source code attached

  • I have a problem when I execute Serveur

    java Serveur

    Exception in thread "main" java.lang.NoClassDefFoundError: com/zeroc/Ice/Object
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(
    at java.lang.Class.privateGetMethodRecursive(
    at java.lang.Class.getMethod0(
    at java.lang.Class.getMethod(
    at sun.launcher.LauncherHelper.validateMainClass( )
    at sun.launcher.LauncherHelper.checkAndLoadMain(
    Caused by: java.lang.ClassNotFoundException: com.zeroc.Ice.Object
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    ... 7 more

  • Please, I would like solve the problem.
    I need to have a good mark for this work to valid my semester
  • xdm
    xdm La Coruña, Spain

    you need to add /usr/share/java/ice-3.7.0.jar to the classpath when running the application try:

    java -cp classes:/usr/share/java/ice-3.7.0.jar Serveur
  • Result : impossible to find or load main class Serveur

  • xdm
    xdm La Coruña, Spain

    Right you need to include the package name of Serveur

    java -cp classes:/usr/share/java/ice-3.7.0.jar TP3.Serveur
  • Result : impossible to find or load main class TP3.Serveur

  • If this can help, the content of the folder in which I run the command :

    ClientServeurI.class Morceau.class MP3 Serveur.class TP3

  • xdm
    xdm La Coruña, Spain

    Hi Mauris,

    The source you upload has the following structure


    Try running this command from source directory

  • I don't find the "source" folder

  • The server is running, no error for the moment in execution.

    Thanks you

  • I'am newbie with Ice, all my pure Java cod works, but I don't have tested the Ice code part yet.
    If I understand it correctly, thanks to Ice work with Slice definition, the server method call mechanism is invisible ? For the client point of view, its like a simply local method call ?

  • I have a problem with my Python, client.

    Client in attachment

    A simply server connection test failed with this error :

    Traceback (most recent call last):
    File "", line 6, in
    printer = MP3.ClientServeurPrx.checkedCast(base)
    File "/home/hector/Téléchargements/python/", line 133, in checkedCast
    return _M_MP3.ClientServeurPrx.ice_checkedCast(proxy, '::MP3::ClientServeur', facetOrContext, context)
    Ice.ObjectNotExistException: exception ::Ice::ObjectNotExistException
    id =
    name = clientserveurAdapter
    category =
    facet =
    operation = ice_isA

  • xdm
    xdm La Coruña, Spain

    Seems you attach the wrong file

  • bernard
    bernard Jupiter, FL

    Hi Mauris,

    Did you try the Ice demos? They include a build system and instructions on how to run the client and server, so it should make everything easier for you.

    For this latest ObjectNotExistException error, ObjectNoExistException means the object adapter in your server could not find an object with the specified identity. The exception shows the object identity specified by your client is "clientserverAdapter". Check if this matches the identity for the target object in your server (the identity in your call to "add" on the object adapter).

    Best regards,

  • Python client :

    import sys, Ice
    import MP3

    with Ice.initialize(sys.argv) as communicator:
    base = communicator.stringToProxy("clientserveurAdapter:default -p 10000")
    printer = MP3.ClientServeurPrx.checkedCast(base)
    if not printer:
    raise RuntimeError("Invalid proxy")

    Java server :

    package TP3;

    public class Serveur {

       public static void main(String[] args) throws Exception
            try(com.zeroc.Ice.Communicator communicator = com.zeroc.Ice.Util.initialize(args))
                com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("clientserveurAdapter", "default -p 10000");
                com.zeroc.Ice.Object object = new ClientServeurI();
                adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("clientserveur"));


  • I can't find the problem, cloud you help ?
  • xdm
    xdm La Coruña, Spain

    You are using the wrong object identity in the client proxy

    base = communicator.stringToProxy("clientserveurAdapter:default -p 10000")

    Should be

    base = communicator.stringToProxy("clientserveur:default -p 10000")
  • I have a problem with my Python client

    def ajouterMorceau():
    global titre;
    global id;
    global serveur;
    titre = raw_input("Veuillez entrer le nom du morceau : ");
    '''resultat = serveur.getIdMorceauByTitre(titre);'''
    interprete = raw_input("Veuillez entrer l'interprete : ");
    genre = raw_input("Veuillez entrer le genre : ");
    url = raw_input("Veuillez entrer l'URL : ");
    print "Ajout morceau..."
    id = serveur.addMorceau(titre)
    print id

    Result :

    Traceback (most recent call last):
    File "", line 143, in
    File "", line 31, in menuPrinci
    File "", line 85, in ajouterMorceau
    File "/home/hector/Téléchargements/python/", line 72, in setInterpreteMorceauById
    return _M_MP3.ClientServeur._op_setInterpreteMorceauById.invoke(self, ((id, interprete), context))
    Ice.UnknownException: exception ::Ice::UnknownException
    unknown = java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    at java.util.ArrayList.rangeCheck(
    at java.util.ArrayList.get(
    at TP3.ClientServeurI.setInterpreteMorceauById(
    at MP3.ClientServeur._iceD_setInterpreteMorceauById(
    at MP3.ClientServeur._iceDispatch(
    at com.zeroc.IceInternal.Incoming.invoke(
    at com.zeroc.Ice.ConnectionI.invokeAll(
    at com.zeroc.Ice.ConnectionI.dispatch(
    at com.zeroc.Ice.ConnectionI.message(
    at com.zeroc.IceInternal.ThreadPool.access$500(
    at com.zeroc.IceInternal.ThreadPool$


  • Problem solved, index error in Java Interface

  • After small debug of Java server, all the project is working, thanks a lot