Hot questions for Using Ubuntu in path


I have gradle installed on my Ubuntu 15.10 System.I want to find the location where it is. I am following this ( article.Here it is given that sample program can be found at samples/java/quickstart. I want to open this sample program and for this I want to find location of gradle on my system.


There's multiple ways to locate where gradle is actually installed on your computer :

  • locate : will locate where the bin gradle is on your computer. Assuming, gradle is on your PATH. It will most likely locate gradle in /usr/bin or /usr/share directory. If it locates the symbolic link use either ls -l or readlink to see where the bin is actually located.
  • which : similar as locate
  • find : to use at end if neither locate neigher which worked. It's the "brutal" way. You can use find / -name "gradle" 2> /dev/null to find all occurence of gradle (exact match) on your computer.


I installed tomcat, set variables CATALINA_HOME=/opt/tomcat and CATALINA_BASE=/opt/tomcat. in terminal I entered command which java and got response /usr/bin/java. So how I understand this is path for JAVA_HOME. I set it. When I start tomcat in terminal with $CATALINA_HOME/bin/ I get response:

Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr/bin/java
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

But when I check, I see that tomcat wasn't started and in logs I found:

/opt/tomcat/bin/ 1: eval: /usr/bin/java/bin/java: not found

I suppose,that something wrong with path to java. How can I fix it? PS everyhing was performed in Ubuntu OS


I think you should point you JRE_HOME to the directory where your java is installed, not the executable java itself. An example would be /usr/lib/jvm/java-7-oracle where that folder will contain the bin/java executable...


I use Windows and Ubuntu to code with Eclipse, also I have a big folder with a lot of libraries inside it so i can choose the library i want and add it to my project... But windows and linux (Ubuntu) doesnt uses the same paths for the libraries, i add a library on windows and on ubuntu it doesnt work because ubuntu cant find G:/Programation/Libraries, if i want to add a library on ubuntu, it is /media/Media1/Programation/Libraries... I have searched here a little bit for this, but i dont understand how that works, also I cant move my libraries to the SDK Java path, i need to move the java stuff in various computers... Also idk how variables works on eclipse... Idk how to add a lib of a variable Help is apreciatted. Note that im on Java 7 and Eclipse Luna, Windows 7 and Ubuntu 14.04 Also i cant move the libraries folder to the project lib folder... Also why file structure is something like this: -G:/ -Programation -Workspaces -Bukkit -FIRST WORKSPACE -Java -SECOND WORKSPACE -BungeeCord -THIRD WORKSPACE -Libraries -ALL THE LIBRARIES


Path "/media/Media1/Programation/Libraries..." tells me your shared partition is not properly mounted from Ubuntu. You should install ntfs-configuration tool from Ubuntu Software center and it will mount all your partitions in a proper read/write mode. After that, you will be able to specify paths which will stay consistent.


I installed hadoop watching a youtube video. while I try to run this in terminal it gives me this error

$ /usr/local/hadoop-2.6.0/bin/hadoop     version
/usr/local/hadoop-2.6.0/bin/hadoop: line 144:     /usr/iib/java/jdk1.8.0_31/bin//bin/java: No such file or directory

I have java in /usr/lib/java/jdk1.8.0_31/bin/ but I dont know why the error is showing a different path.

I have setup the path in like this


I did the same in .bashrc

export HADOOP_HOME=/usr/local/hadoop-2.6.0/bin/hadoop
export JAVA_HOME
export PATH

Please help me. if you need any extra info please ask.


Your JAVA_HOME should point to /usr/iib/java/jdk1.8.0_31 and not the bin folder under it.

Also, usually it would be lib and not iib.

The PATH should include the $JAVA_HOME/bin, though.


I have recently installed ubuntu and want to start compiling programs in the terminal. What is the command to set the path for java in ubuntu terminal? I tried "cd path" but it did not work. Could anyone please tell me the right command?


first of all if you have not installed java you need to execute the command

$ sudo apt-get install openjdk-7-jdk

if it does not work then first execute

$ sudo apt-get update

and the execute the above command

and the do

$ sudo vi /etc/profile

and at the last line of the file add JAVA_HOME={path to java home} PATH=$JAVA_HOME/bin:$PATH

and do $ . /etc/profile

and now you are good to go to see the effect type java -version


I was trying to implement simple word count as given in docs from eclipse. Same Program works on terminal but when I tried to run it in eclipse I pass it arguments from run config

arguments was:

/home/rachit/wordcount/input /home/rachit/wordcount/output

Got this exception:

Exception in thread "main" java.lang.NullPointerException
    at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.getBlockIndex(
    at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.getSplits(
    at org.apache.hadoop.mapreduce.JobSubmitter.writeNewSplits(
    at org.apache.hadoop.mapreduce.JobSubmitter.writeSplits(
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(
    at org.apache.hadoop.mapreduce.Job$
    at org.apache.hadoop.mapreduce.Job$
    at Method)
    at org.apache.hadoop.mapreduce.Job.submit(
    at org.apache.hadoop.mapreduce.Job.waitForCompletion(

Then I changed this

FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));


FileInputFormat.setInputPaths(job,new Path("hdfs://localhost:9000/home/rachit/wordcount/input"));
FileOutputFormat.setOutputPath(job, new Path("hdfs://localhost:9000/home/rachit/wordcount/output"));

Point to be Noted : dfs port number was 9000 and it was connected, I can browse the file structure from map_reduce perspective in eclipse I upload the file from there.

setInputPaths(..) documentation:

Sets the given comma separated paths as the list of inputs for the map-reduce job.

addInputPaths(..) documentation:

Add the given comma separated paths to the list of inputs for the map-reduce job.

What is the difference b/w setInputPaths(..) and addInputPaths(..)? Why does that make a difference ?


A job can have more than one input path. Suppose you have five paths you want in your job. You can do things like:

  • Add them one by one in five operations
  • Set all five of them together at the same time
  • Add two of them, and then add another three.

So, addInputPath allows you to add a single path to the existing list of paths.

addInputPaths allows you to add several paths to the existing list. If the job had two paths, and you use addInputPaths to add three more, you'll have five paths in the job.

setInputPaths allows you to set several paths replacing the existing list. So if you had two paths, and you use setInputPaths to set three paths, you'll have three paths at the end.

The difference is betwen adding (to the existing list of paths), and replacing it.

The error that you got is probably due to not having the correct path in args[0] or to having an existing bad path in the job before the part of the code that you have shown. If you are starting with a job that has an empty list of paths, there shouldn't really be a difference between using add and using set.


when i run

mvn clean install

i get the truststore path as

trustStore is: /home/user/Downloads/jdk8/openjdk-8u40-b25-linux-x64-10_feb_2015/java-se-8u40-ri/jre/lib/security/cacerts

but that's a a wrong path and it end's up giving me this error

Failed to read artifact descriptor for org.springframework.statemachine:spring-statemachine-core:jar:
2.1.3.RELEASE: Could not transfer artifact org.springframework.statemachine:spring-statemachine-core:
pom:2.1.3.RELEASE from/to central ( java.lang.RuntimeException: 
Unexpected error: the trustAnchors parameter must be non-empty

so how can i change the path of the default truststore??

i'am running in ubuntu 18.04 and openjdk 8



As documented here:, you can also export / set the environment variable:



I started a project using the Oracle BDB XML java API in a Linux(Ubuntu-eclipse) environment.

I proceeded with the installation as follows:

> cd dbxml-6.1.4

> sh --enable-java

> sh --build-one-berkeleydb

> sh --build-one-dbxml

enter image description here

After that, I imported the jar file into the project as shown in the figure above.

At least there was no problem up to this point.

However, when I run the program after compiling, I get the following error.

enter image description here

I searched Google for "no db_java-6.2 in java.lang.library.path" and tried to solve the problem,

but I have not found a clear solution yet.

Any suggestion are appreciated, so please give me some helpful advice.


After you build from db-xml sources, did you find at the output location? If yes, add the path of directory where is located to the search path where JRE could find it. In your case (looks like you were using Eclipse), on the Java Build Path --> Libraries tab, expand the JRE System Library node, Edit the Native Library Location, add the directory path of in Native Library Location



The locations in the PATH environment variable are searched in order, and the first match for an executable is returned. Since you added JAVA_HOME at the end of the PATH, the global version of java is found first (as /usr/bin comes before JAVA_HOME).

Try this order instead (in the second line of your code above):

export PATH=${JAVA_HOME}/bin:${PATH}

BTW, it is not necessary to reboot each time you change ~/.bashrc. You can just open a new shell terminal.