You can not "convert" a program written on C or Java in order to run as a bash script. Bash uses different syntax, so most likely you will have to rewrite the logic on a bash script.
Now if you are only asking about how to execute a program written on Java/C via the command line, then the answer is pretty simple.
Now in order to write a C program in linux, all you need to do is to fire up an editor (gedit is a very good gui editor, nano is good for beginners with the command line, vim/emacs for experienced programmers), like this:
gedit myprogram.c or
vim myprogram.c and start coding. Below is an example of an text editor editing source a Hello World program in C on my computer in the Ubuntu terminal.
NOTE:You can also use a piece of software called an IDE (Integrated Development Environment) to do C programming. Popular IDEs include code::blocks, Eclipse with a plugin called CDT (C/C++ Development tools) and my all time favorite for newbies and starters Geany (although one could argue that Geany is more of an editor, than an IDE, but whatever).
C Standard Library
The standard C Library (glibc) is pretty much in every Linux or Unix system there is and is POSIX compliant. You can find most of in
/usr/include. A fine trick to find where headers (libraries) you are interested in exist in your system is firing up a terminal and typing whereis followed by the header filename like this:
Supposing you have created a file called
myprogram.c that has c source code in it, then you compile it first via a compiler (GCC belonging to the GNU toolchain is contained in nearly every linux system. I am not a 100% sure about this, but I believe that POSIX instructs that there are such tools in the basic OS) like this:
gcc myprogram.c and then you execute the executable (in this case
a.out, since we did not define an executable output name to the compiler) like this:
Java Development Kit
To begin with java development you must make sure there is at least one version of the Java Development Kit (JDK). To make sure you have jdk installed, open up your Ubuntu Software Center, and Type in the Search box
Java Development Kit.
If you see at least one package with "Java Development Kit" or JDK in its name marked with a tick, then this means that you have JDK installed.
WARNING: You need to have a JDK version that supports the version of Java you want to program in and above, otherwise you won't be able to work properly. For instance a JDK that supports Java v6 can compile java source code with features up until Java 6 BUT NOT java 7. A jdk that supports Java version 7 can compile source code that has features up until version 7 (including 6).
SECOND WARNING: You MUST make sure that you have at least one version of a JDK installed. If you see a package named JRE you this doesn't apply to your needs. JRE stands for Java Runtime Environment and you need it to run Java applications. In order to program them, you need a Java Development Kit. A Java Development Kit also includes many of the tools found in Java Runtime Environments.
You may be able to follow the C like code writing technique for java (firing up any text editor and start typing), but for java, such techniques are impractical for serious development. This is why many Java developers use tools named IDE s which stand for Integrated Development Environment that make your life easier when you write source code by attempting to support all the features you might want to have (including, but not limited to, code completion, a debugger, a profiler, compiler integration, etc) under one piece of software. In Ubuntu software centre you can find 3 very good IDEs that you can choose from. The first one is Netbeans which is very friendly to beginners (well, it is at least friendlier than the other too) while being fairly powerful. If you feel like you want more, or are more advanced Java developer you can choose between Eclipse (very popular among Java Developers worldwide on any platform) and IntelliJ IDEA Community Edition by JetBrains which is one nice and powerful Java IDE.
Below is a screenshot of Eclipse, a fairly popular Java IDE.
Now, to compile your java software files (assuming myprogram.java source code file) with the java compiler like this:
javac myprogram.java and then you find the compiler output (should be a .class file, in this case myprogram.class) and call the java virtual machine to process it like this: