Sponsored Content
Top Forums Programming How do i get Java commands to be recognized in command prompt? Post 302512678 by pflynn on Monday 11th of April 2011 09:07:55 AM
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).
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
JAVA-WRAPPERS(7)						   Java wrappers						  JAVA-WRAPPERS(7)

NAME
java-wrappers - capacities shared by java wrapper scripts DESCRIPTION
Most Java programs are not run directly, but through small shell scripts that take care of various things, such as finding a suitable java environment and looking for libraries. To ease the task of the maintainers, they rely on a library providing runtime detection, library detection and other features. This manual page describes the common features of all those scripts, and to which point you can configure them. This is mainly done via environment variables. ENVIRONMENT VARIABLES
java-wrappers understands some environment variables: JAVA_CMD The java command that will be run. If this variable is set, it disables all lookup for a java runtime. JAVA_BINDIR Specifies a directory that will be looked for a java or a jdb executable (depending on the setting of JAVA_DEBUGGER). It has prece- dence over JAVA_HOME but not over JAVA_CMD. JAVA_HOME A path to a java runtime. If this variable is set, all lookup for a java runtime is disabled, except that if no java executable is found in the path, the command java is used. JAVA_FLAVOR A probably more easy-to-use version of the JAVA_HOME variable: instead of specifying the full path of the java runtime, you name it. List of available flavors can be found in the file /usr/lib/java-wrappers/jvm-list.sh. See examples below. JAVA_DEBUGGER If this is set, the wrapper will try to pick up a java debugger rather than a java interpreter. This will fail if the jbd of the runtime found is a stub. JAVA_CLASSPATH Additional classpath, will have priority over the one found by the wrapper. JAVA_ARGS Additional arguments to the java command. They will come before all other arguments. FORCE_CLASSPATH If this variable is set, it will be the only classpath. You'd better know what you are doing. DEBUG_WRAPPER This is probably the most important variable; if it set, the wrapper will print out useful information as it goes by its business, such as which runtime it did find, and which command is run eventually. JAVA_JARPATH The path where the wrappers will go looking for jar archives. If not set, the wrapper will look into the default directory, /usr/share/java. Warning : the wrapper will not look anywhere else than in JAVA_JARPATH. Setting it incorrectly will most probably result in early crashes. EXAMPLES
The examples all rely on rasterizer(1), from the package libbatik-java, but they really apply to all scripts that use java-wrappers. Print out debugging information: DEBUG_WRAPPER=1 rasterizer Limit rasterizer's memory to 80 MB: JAVA_ARGS=-Xmx80m rasterizer Force rasterizer to run with kaffe(1): JAVA_HOME=/usr/lib/kaffe rasterizer The same, but using JAVA_BINDIR: JAVA_BINDIR=/usr/lib/kaffe/bin rasterizer Force rasterizer to run with openjdk: JAVA_FLAVOR=openjdk rasterizer Debug rasterizer with Sun's debugger, while printing debugging information from the wrapper: DEBUG_WRAPPER=1 JAVA_CMD=/usr/lib/jvm/java-6-sun/bin/jdb rasterizer BUGS
Care has been taken to make the wrappers bug-free. If that was not the case, please file a bug report against the java-wrappers package. If you wish to submit any problem with a java executable relying on java-wrappers, please also submit the output of the command run with DEBUG_WRAPPER=1. It will save one mail exchange and therefore potentially reduce the time it takes to fix the bug. DEVELOPERS
There is currently no documentation about writing a wrapper script save the comments in /usr/lib/java-wrappers/java-wrappers.sh. If you have to write one, we suggest you base yourself upon, for instance, the rasterizer wrapper script, or any other one (just pick up any direct reverse dependency of java-wrappers and look for scripts). SEE ALSO
java(1), jdb(1) /usr/lib/java-wrappers/java-wrappers.sh AUTHOR
java-wrappers and its documentation were written by Vincent Fourmond <fourmond@debian.org> Version 0.1.16 2010-05-04 JAVA-WRAPPERS(7)
All times are GMT -4. The time now is 01:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy