Using basic UNIX commands to make/compile JAVA files
Hello!
This is my first post, and I just learned what UNIX was this week. For a JAVA programming class I am taking, I must be able to create a directory in UNIX, use the nano command to create a JAVA program, compile it, and then run it on the command prompt using the java command.
For some reason I am having trouble, here is what I have tried.
mkdir project13
(I have now created a directory named project13)
cd project13
(I have now changed from default directory to project13 directory)
nano HelloWorld
(This should create a file named HelloWorld that I can edit.)
Here is what I have typed in the nano editor for HelloWorld
I then hit ctrl+x to exit and select NO, I'm not sure what modify buffer means...
then that takes me back to the command prompt.
I then enter javac HelloWorld.java to compile the file but it gives me an error:
what does this mean?
and what Have I done wrong to this point?
Thanks in advance UNIX/Java world!
Last edited by Franklin52; 04-30-2014 at 03:28 AM..
Reason: Please use code tags
If you have successfully saved your source code and compiled your source you should see two files when you do the ls command in your directory from the command line.
If you still have a problem post the results of ls command here.
I understand the logic of creating a file through the text editor, compiling it, then running it through the command prompt. I am still having problems
when I do the ls command, I can see any listed file.
I even type nano filename in order to see the text of filename in the text editor and it is there
however, when I use these commands
javac filename.java
java filename
The file can not be found, or I get a message saying that the main java class cannot be loaded
My steps:
create a directory: mkdir directoryname
change to directory: cd directoryname
create a file: nano filename
Ctrl+x, NO
compile the file: javac filename.java file cannot be found
java filename: cannot find or load main java class
It helps to read what the computer is telling you. When you hit ctrl-x, nano asks you if you want to save first, and warns you "ANSWERING "No" WILL DESTROY CHANGES". You tell it "no".
Last edited by Corona688; 04-30-2014 at 02:24 PM..
Hi,
Brand new to these forums, and I hope that someone can help me out.
I'm trying to run the following command in UNIX
java -jar GenomeAnalysisTK.jar -T SplitSamFile -dt NONE -R reference.fa -I my.bam --outputRoot /my/path/SampleFiles/Sample_
It executes the SplitSamFile from GATK, but I... (3 Replies)
Hi
Im using MobaXterm Unix on my windows XP.I want to compile java in unix.I have installed java to the following path C:\Program Files\Java\jdk1.7.0_09\bin
In order to compile the java prog im typing the following command after entering into the bin directory:
C:\Program... (2 Replies)
I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
I am trying to run make command on 200000 files in HP UX but it refuses to compile giving a message that " command line is too long .stop" I checked and found out that there is a limit imposed by the operating system on the command line .for Eg refer following link :
The maximum length of... (6 Replies)
Greeings all
Im trying to excute a command from Java and direct the output to the main output screen or to another file .... can you please help with this ? can I use filewriter for this ?
Here is my code....
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;... (3 Replies)
Hi,
Iam trying to code in java and wanted to run the commands in the Unix remote servers. I have the following code to run multiple GREP commands in a single session.
But when i execute this, the first command executes successfully, whereas from the next line it says
"Exception Occured... (1 Reply)
Hi.
I'm New user for this Forum.Presently i'm working with Cygwin
I want to know the basic commands that will be used for Cygwin.
Can anyone guide me on this regards
Thanks & Regards
Sanjay (0 Replies)