javaubuntuhdfsjavac

How to compile and execute this JAVA application in Ubuntu?


This is my folder structure of my java project

There is a Hdfs.java inside src/hdfs and there is a utility jar file inside lib.

What are the options I give when I compile the Hdfs.java using the utility jar? And how do I execute?

I went through the examples here and I'm very confused.


Solution

  • If you do not want to use the compiler inside of NetBeans, then go to your terminal application, set your current directory to src and invoke

    javac -cp .:../lib/utility.jar Hdfs.java
    

    To run, you would do this:

    java -cp .:../lib/utility.jar Hdfs
    

    If you want to compile and run within NetBeans, see Jigar Joshi's answer.