Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

rosjava(pure) pubsub tutorial


I'm using the new, pure-java rosjava. I installed ros(diamonback) and rosjava by rosinstall in my ubuntu(lucid). and build rosjava.jar successfully.

I want talk to other node using pubsub tutorial in rosjava. I imported rosjava.jar and other libraries in eclipse project and modified the source as below. (commons-codec-1.3.jar, commons-httpclient-3.1.jar, commons-loggin-1.1.1.jar, dnsjava-2.1.1.jar, guava-r07.jar, junit-4.8.2.jar, mockito-all-1.8.5.jar, netty-3.2.4.Final.jar, rosjava.jar)

When I run below program by java application, I got this error message.

    at org.ros.Node.<init>(
    at Hell.main(
    at Hell.main(

I also tried to debugging with eclipse but, I couldn't debugging with source with this message

Source not found, [Edit Source Lookup Path ...] button.

I tried to connect ros source directory(ros/rosjava/rosjava/src) and include the rosjava source(org.ros), but It also fail to find the source.

Please help me. I'm beginner of the java language. If this question is too sil7ly, Please understand me.


 * Copyright (C) 2011 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.


import org.ros.Node;
import org.ros.NodeConfiguration;
import org.ros.NodeMain;
import org.ros.Publisher;

public class Hell implements NodeMain {
    private Node node;
     * @param args
    public void main(NodeConfiguration configuration){
        Preconditions.checkState(node == null);
        try {
          node = new Node("talker", configuration);
          Publisher<org.ros.message.std_msgs.String> publisher =
              node.createPublisher("chatter", org.ros.message.std_msgs.String.class);
          int seq = 0;
          while (true) {
            org.ros.message.std_msgs.String str = new org.ros.message.std_msgs.String();
   = "Hello world! " + seq++;
        } catch (Exception e) {
          if (node != null) {
          } else {
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Hell h = new Hell();
        NodeConfiguration node_cfg = new NodeConfiguration();

    public void shutdown() {
        node = null;