ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROSJava compiling error

asked 2012-08-07 05:49:00 -0600

James 412 gravatar image

updated 2014-04-20 14:09:24 -0600

ngrennan gravatar image

I am trying to compile rosjava on an Ubuntu 10.10 machine, but I have run across a error.

The error is:

Exception in thread "main" java.lang.NullPointerException at org.ros.internal.message.GenerateInterfaces.main(GenerateInterfaces.java:162)

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':rosjava_messages:generateSources'. > Command '/usr/lib/jvm/java-6-openjdk/bin/java' finished with (non-zero) exit value 1.

The stacktrace is:

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':rosjava_messages:generateSources'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34) at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34) at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:111) at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83) at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247) at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192) at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177) at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31) at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103) at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79) at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78) at ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-08-07 19:32:39 -0600

damonkohler gravatar image

It looks like your ROS_PACKAGE_PATH is not defined. Be sure to follow the instructions for installing rosjava. And be sure to:

$ cd my_ros_workspace
$ source setup.bash

It's best to add the source setup.bash line to your bash.rc.

I've also filed an issue to provide a more informative error message.

edit flag offensive delete link more
0

answered 2012-08-08 08:06:42 -0600

James 412 gravatar image

I fixed the problem with damonkohler's help. I took his suggestion, and followed the instruction for installing rosjava. I, however, still got the same error. After a little thought, I realized that since I was running the command:

$ sudo ./gradlew install

that the ROS_PACKAGE_PATH for the root user was undefined. The conclusion was correct. To fix the problem, I became the root user and defined my ROS_PACKAGE_PATH by using:

$ sudo su $ . /home/user_name/.bashrc $ source /home/user_name/my_workspace/setup.sh

After typing those commands, I was able to build rosjava.

edit flag offensive delete link more

Comments

Why are you running it as root!? That's dangerous.

damonkohler gravatar image damonkohler  ( 2012-08-08 22:37:51 -0600 )edit

I cannot run anything without running it as root. It fails at the very beginning.

James 412 gravatar image James 412  ( 2012-08-09 08:19:15 -0600 )edit

Question Tools

Stats

Asked: 2012-08-07 05:49:00 -0600

Seen: 482 times

Last updated: Aug 08 '12