[CMake] Java Support

Alain Leblanc aalebl at gmail.com
Fri Jan 22 22:03:23 EST 2010


On 01/22/2010 08:47 PM, Alex Brandt wrote:
> On Friday 22 January 2010 2:26:58 pm you wrote:
>   
>> What specific problems are you having with your Java code?
>> ___________________________________________________________
>> Mike Jackson                      www.bluequartz.net
>> Principal Software Engineer       mike.jackson at bluequartz.net
>> BlueQuartz Software               Dayton, Ohio
>>     
> I'm getting the following error when trying to run the Java application I 
> compile:
>
> alunduil at elijah ~/work/adsoap/build/test $ java LdapTest
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> com/novell/ldap/LDAPReferralException
> Caused by: java.lang.ClassNotFoundException: 
> com.novell.ldap.LDAPReferralException
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
> Could not find the main class: LdapTest. Program will exit.
>
> The CMake file I'm using is the following:
>
> project(AdSoapService Java)
> cmake_minimum_required(VERSION 2.6)
>
> set(CMAKE_JAVA_COMPILE_FLAGS "${CMAKE_JAVA_COMPILE_FLAGS} -
> Xlint:deprecation")
>
> include_directories(/usr/share/soap/lib/soap.jar)
> include_directories(/usr/share/jldap/lib/ldap.jar)
>
> set(Zimbra_SRC
>     Zimbra/ZimbraAccount.java)
> include_directories(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Zimbra.dir/Zimbra/)
> message(STATUS "${CMAKE_CURRENT_BINARY_DIR}")
> add_library(Zimbra ${Zimbra_SRC})
>
> set(AdSoapService_SRC
>     AdSoapService/AdSoapSession.java
>     AdSoapService/AdSoapService.java
>     AdSoapService/AdSoapServiceImpl.java)
> include_directories(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/AdSoapService.dir/AdSoapService/)
> add_library(AdSoapService ${AdSoapService_SRC})
>
> add_dependencies(AdSoapService Zimbra)
>
> add_subdirectory(test)
>
> Regards,
>
> Alex Brandt
>
>   
>
The jar file containing LDAPReferralException (probably
/usr/share/jldap/lib/ldap.jar) must be included in your CLASSPATH
variable.  This is a basic java issue. Nothing to do with cmake.


More information about the CMake mailing list