0
$\begingroup$

Rosanswers logo

I followed rosjava_tutorial_pubsub and rosjavaのプロジェクト作成&Talker作成.

I run:

  roscreate-pkg sam_rosjava_basic
  cd sam_rosjava_basic/

My build.gradle:

  apply plugin: 'java'
  
  // The Maven plugin is only required if your package is used as a library.
  apply plugin: 'maven'
  
  // The Application plugin and mainClassName attribute are only required if
  // your package is used as a binary.
  apply plugin: 'application'
  mainClassName = 'org.ros.RosRun'
  
  sourceCompatibility = 1.6
  targetCompatibility = 1.6
  
  repositories {
    mavenLocal()
    maven {
      url 'http://robotbrains.hideho.org/nexus/content/groups/ros-public'
    }
  }
  
  version = '0.0.0-SNAPSHOT'
  group = 'ros.my_stack'
  
  dependencies {
    compile 'ros.rosjava_core:rosjava:0.0.0-SNAPSHOT'
  }
                                                  

And I run:

  mkdir -p src/main/java

My src/main/java/talker.java:

   package org.ros.rosjava_tutorial_pubsub;
  
  import org.ros.concurrent.CancellableLoop;
  import org.ros.namespace.GraphName;
  import org.ros.node.AbstractNodeMain;
  import org.ros.node.ConnectedNode;
  import org.ros.node.NodeMain;
  import org.ros.node.topic.Publisher;
  
  /**
   * A simple {@link Publisher} {@link NodeMain}.
   * 
   * @author [email protected] (Damon Kohler)
   */
  public class Talker extends AbstractNodeMain {
  
    @Override
    public GraphName getDefaultNodeName() {
      return new GraphName("rosjava_tutorial_pubsub/talker");
    }
  
    @Override
    public void onStart(final ConnectedNode connectedNode) {
      final Publisher<std_msgs.String> publisher =
          connectedNode.newPublisher("chatter", std_msgs.String._TYPE);
      // This CancellableLoop will be canceled automatically when the node shuts
      // down.
      connectedNode.executeCancellableLoop(new CancellableLoop() {
        private int sequenceNumber;
  
        @Override
        protected void setup() {
          sequenceNumber = 0;
        }
  
        @Override
        protected void loop() throws InterruptedException {
          std_msgs.String str = publisher.newMessage();
          str.setData("Hello world! " + sequenceNumber);
          publisher.publish(str);
          sequenceNumber++;
          Thread.sleep(1000);
        }
      });
    }
  }
                                            

Then I run:

  sam@/home/sam$ `rosstack find rosjava_core`/gradlew installApp
  bash: /opt/ros/electric/stacks/rosjava_core/gradlew: No such file or directory      
  sam@/home/sam$ 

How to solve it?

Thank you~

===================================================

I try to use rosws to init my workspace,download rosjava,and rosmake successfully!

I run:

  cd ~/code/ros
  rosws init
  echo 'source ~/code/ros/setup.bash' >> ~/.bashrc
  rosws merge /opt/ros/electric/.rosinstall
  rosws merge http://rosjava.googlecode.com/hg/.rosinstall
  rosws update
  cd rosjava_core/
  rosmake

But when I try:

   sam@/home/sam/code/ros/java/sam_rosjava_basic$ `rosstack find rosjava_core`/gradlew installApp
  Downloading http://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip
  .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  Unzipping /home/sam/.gradle/wrapper/dists/gradle-1.0-milestone-9-bin/7ilkmgo2rn79vvfvd51rqf17ks/gradle-1.0-milestone-9-bin.zip to /home/sam/.gradle/wrapper/dists/gradle-1.0-milestone-9-bin/7ilkmgo2rn79vvfvd51rqf17ks
  Set executable permissions for: /home/sam/.gradle/wrapper/dists/gradle-1.0-milestone-9-bin/7ilkmgo2rn79vvfvd51rqf17ks/gradle-1.0-milestone-9/bin/gradle
  :compileJava
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not resolve all dependencies for configuration ':compile'.
  > Could not find group:ros.rosjava_core, module:rosjava, version:0.0.0-SNAPSHOT.
    Required by:
        ros.my_stack:sam_rosjava_basic:0.0.0-SNAPSHOT
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  
  Total time: 2 mins 29.874 secs
  
  sam@/home/sam/code/ros/java/sam_rosjava_basic$                                                                                                                              

I try again with sudo:

   sam@/home/sam/code/ros/java/sam_rosjava_basic$ sudo `rosstack find rosjava_core`/gradlew installApp
  [sudo] password for sam: 
  Downloading http://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip
  .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  Unzipping /root/.gradle/wrapper/dists/gradle-1.0-milestone-9-bin/7ilkmgo2rn79vvfvd51rqf17ks/gradle-1.0-milestone-9-bin.zip to /root/.gradle/wrapper/dists/gradle-1.0-milestone-9-bin/7ilkmgo2rn79vvfvd51rqf17ks
  Set executable permissions for: /root/.gradle/wrapper/dists/gradle-1.0-milestone-9-bin/7ilkmgo2rn79vvfvd51rqf17ks/gradle-1.0-milestone-9/bin/gradle
  :compileJava
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not resolve all dependencies for configuration ':compile'.
  > Could not find group:ros.rosjava_core, module:rosjava, version:0.0.0-SNAPSHOT.
    Required by:
        ros.my_stack:sam_rosjava_basic:0.0.0-SNAPSHOT
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  
  Total time: 1 mins 49.333 secs
  
  sam@/home/sam/code/ros/java/sam_rosjava_basic$                                                                  

How to solve it?

Thank you~


Originally posted by sam on ROS Answers with karma: 2570 on 2012-08-15

Post score: 0


Original comments

Comment by KruseT on 2012-08-17:
Please ask only one question at a time, and do not change the question. You need to run gradlew install in rosjava_core first, not rosmake. Never use sudo, unless a tutorial tells you to.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You need to follow the directions exactly as they are described in the documentation. rosmake has no effect in rosjava_core. Your package is failing to build because you have not executed the install task for rosjava_core.

Follow the directions, make sure the tutorials build as described, and then try your project again.


Originally posted by damonkohler with karma: 3838 on 2012-08-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by sam on 2012-09-02:
What I know is trying to follow the doc. I can't understand what you told to me. I have already run 'rosws merge http://rosjava.googlecode.com/hg/.rosinstall'. What can I do next? Thank you~

Comment by caca on 2013-06-20:
Create a package in ~/<your_ws>/rosjava_core/ and follow this link http://docs.rosjava.googlecode.com/hg/rosjava_core/html/getting_started.html#creating-a-new-java-package

you must create package rosjava_core and if everything is okey, you run ../gradlew installApp.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.