Problem building the "Hello world"

7 posts / 0 new
Last post
Offline
Last seen: 8 years 4 months ago
Joined: 01/04/2015
Posts: 6
Problem building the "Hello world"

Hi everybody,


I get this error when I build the basic program "Hello world":

C:\Program Files\RTI\ndds.5.1.0\example\JAVA\Hello_simple\SRC\com\rti\simple\Hel
loPublisher.java:18: error: package com.rti.dds.infrastructure does not exist
import com.rti.dds.infrastructure.RETCODE_ERROR;

C:\Program Files\RTI\ndds.5.1.0\example\JAVA\Hello_simple\SRC\com\rti\simple\Hel
loPublisher.java:19: error: package com.rti.dds.infrastructure does not exist
import com.rti.dds.infrastructure.StatusKind;

C:\Program Files\RTI\ndds.5.1.0\example\JAVA\Hello_simple\SRC\com\rti\simple\Hel
loPublisher.java:20: error: package com.rti.dds.publication does not exist
import com.rti.dds.publication.Publisher;

...etc (34 errors).

Could someone tell me how to fix the error? I think that is a problem with libraries, but I am sure that all environment variables are OK:


NDDSHOME: C:\Program Files\RTI\ndds.5.1.0;C:\Program Files\RTI\ndds.5.1.0\class;
Path: [...] C:\Program Files\RTI\ndds.5.1.0\scripts;C:\Program Files\Java\jdk1.8.0_25\bin;C:\Program Files\RTI\ndds.5.1.0\lib\i86Win32jdk;

Thanks in advance.

 

 

rip
rip's picture
Offline
Last seen: 5 days 16 hours ago
Joined: 04/06/2012
Posts: 324

From inside your development environment (Eclipse, NetBeans, etc?) or from the command line?

The class/nddsjava.jar file is probably not on the classpath.  For java, the classpath is separate from the %PATH% environment variable.  I don't have a windows box, but it would be something like:

C:\RTI\ndds.5.1.0\example\JAVA\Hello_simple\bin> java -cp ".;C:\RTI\NDDS.5.1.0\CLASS\NDDSJAVA.JAR" com.rti.simple.HelloPublisher 

 

or similar.


Regards,

rip

Offline
Last seen: 8 years 4 months ago
Joined: 01/04/2015
Posts: 6

Thanks for your answer.

When I use my development environment (NetBeans) everything works correctly. However when I use the command line I get that error.


I think that the command prompt of Windows doesn't recognize the enviroment variables.

 

 

 

rip
rip's picture
Offline
Last seen: 5 days 16 hours ago
Joined: 04/06/2012
Posts: 324

Your response does not mention the classpath, so I don't know if we're talking at cross-purposes.

Please supply the exact command line you are using.

The dev environments (NetBeans, Eclipse) absolutely set the environment and classpath variables correctly, which is why it works in there.

 

Offline
Last seen: 8 years 4 months ago
Joined: 01/04/2015
Posts: 6

Oh, sorry, I'm beginner and I dont know what you mean when you talk about "classpath". I created an environment variable called CLASSPATH pointing to the directory where the /nddsjava.jar file is, is that right? Anyway, I still get the error.


The exact command line I'm using is: C:\Program Files\RTI\ndds.5.1.0\example\JAVA\Hello_simple>build

(I'm just following the steps of "Getting Started" pdf).

rip
rip's picture
Offline
Last seen: 5 days 16 hours ago
Joined: 04/06/2012
Posts: 324

Not a problem. 

Java uses the classpath information for its 'class loader'.  This is the runtime code that searches for compiled .class files whenever new code needs to be pulled in.  It does this at runtime and uses late binding.

I just ran that test on my vm, the only thing I needed to do was cd to the hello_simple directory, set the NDDSHOME variable, add the java jdk bin directory to my path, build, and runpub/runsub.

One thing that jumps out at me, is that you are using the i86Win32jdk.  Can you please CD to "C:\Program Files\Java\jdk1.8.0_25\bin" and enter this command:

type release

(type is the Win cmd shell version of 'cat', release is the file that has the information about the architecture for the release). 

If the value of OS_ARCH is given as "amd64" then you have the compiler trying to generate 64bit java using the 32bit Windows RTI JNI class library -- which can cause the message you are seeing. 

(JNI stands for "Java Native Interface", a JNI is the glue code that allows a Java application to interface its method calls and objects with an underlying C-based shared library (.so or .a or .dll), for example the DDS core infrastructure from RTI).

If this is the case, try changing your path value entry "C:\Program Files\RTI\ndds.5.1.0\lib\i86Win32jdk;"

replace it with "C:\Program Files\RTI\ndds.5.1.0\lib\x64Win64jdk;"

and this assumes you've installed both the i86 and the x64 variants of Connext.  The other option is to use the i86, 32bit Java compiler in place of the amd64, 64bit one.

Offline
Last seen: 8 years 4 months ago
Joined: 01/04/2015
Posts: 6

My configuration was ok (the NDDSHOME environment variable, the i86Win32jdk, etc...), I finally fixed the error, the problem was completely different.

I suspected that the error could come from command prompt or Windows system so I have installed Windows updates and the error has dissapeared.


Anyway, thanks for all :)