How do i get Java commands to be recognized in command prompt?


 
Thread Tools Search this Thread
Top Forums Programming How do i get Java commands to be recognized in command prompt?
# 1  
Old 04-11-2011
How do i get Java commands to be recognized in command prompt?

I would like to do some of my Java programming homework at home, and when i type things such as "javac" & "java" it does not recognize it. How do i set it up so it recognizes Java coding?
# 2  
Old 04-11-2011
You should set your environment so that the command interpreter (the shell) will be able to find the appropriate commands. This is something platform dependent, but most of the time what you need to do is to add the path of the java binaries to the PATH environment variable. For example, if your java binaries (java, javac) where installed in /home/anna/java/bin, you add the path to the PATH environment variable like this:

PATH=$PATH:/home/anna/java/bin

you can type this command directly into the command line, but this way it will be valid only for the current shell, so you´d better put this command into one of your shell´s initialization files (like $HOME/.bashrc or $HOME/.bash_profile if your shell is GNU Bash, for example).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Help with Overriding a Prompt in UNIX/Java

I am executing a shell script which contains a jar call to an external java package for which I don’t have a read access to. The external package was written in such a way that whenever we make a java –jar call to the package, it shows a prompt on the console asking if we want to continue or no... (1 Reply)
Discussion started by: Harry1302
1 Replies

2. Programming

How do i get Java commands to be recognized in command prompt?

I would like to do some of my Java programming homework at home, and when i type things such as "javac" & "java" it does not recognize it. How do i set it up so it recognizes Java coding? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

3. Programming

How to provide password to the prompt through Java

Hi All, I am using Ubuntu machine with JDK 6. I am running following command on shell- sudo ./somecript . Now, it prompts for sudo password and I provide the sudo password on shell and "somescript" starts running with sudo permissions. What I want to do is, I need to execute... (1 Reply)
Discussion started by: jaibhim
1 Replies

4. AIX

"/" doesn't work on command prompt for searching commands last typed

When I use "/" to look for a particular command that I typed in the current session it says D02:-/home/user1/temp> /job ksh: /job: not found. D02:-/home/user1/temp> previously it used to fetch all the commands which had job in it.. for example subjob, endjob, joblist etc... may I... (7 Replies)
Discussion started by: meetzap
7 Replies

5. Programming

Run Unix commands from Java

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)
Discussion started by: yahyaaa
3 Replies

6. Shell Programming and Scripting

How to enter commands to the command prompt in a program

Hey, So I'm trying to write a program in unix to automate a process for my astrophysics research. Basically I want the program to prompt the user for some information and store the entered string of text as a variable. I know how to do this. This is where I need help: Now lets say I have a... (4 Replies)
Discussion started by: freemoniez
4 Replies

7. UNIX for Advanced & Expert Users

How to execute multiple unix commands in one session from java

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)
Discussion started by: gravi2020
1 Replies

8. Shell Programming and Scripting

Shell script to call multiple java commands

Hi, I want to call multiple java commands through a .sh file. I have drafted one with my least knowledge. But its not working. Pls help. I am trying to run this from Sun Solaris (OS 5.10) server with 10g oracle database. echo \* starting script AUTORUN echo \* get the Monitor path... (4 Replies)
Discussion started by: vivekdn
4 Replies

9. UNIX for Dummies Questions & Answers

jar command not being recognized

Hi, I'm trying to extract a war file via the jar command; however, when I issue: jar -xvf MyWarFile.war I'm recieving "jar: not found" I added /usr/bin to the path ...didn't work also tried /usr/bin/jar to the path...still doesn't work My JAVA_HOME/bin is also in the path. ... (1 Reply)
Discussion started by: orahi001
1 Replies

10. UNIX for Dummies Questions & Answers

?Using Unix commands in Microsoft (Windows') DOS Prompt?

I ran a search for "Unix Dos" in the search field box and checked a few pages' results but did not find what I was looking for. I am trying to find out if there are choices of applications that would enable using Unix commands inside a Windows environment, particularly the DOS Prompt. The only... (2 Replies)
Discussion started by: HLee1981
2 Replies
Login or Register to Ask a Question