Bash shell does not recognise 'java', 'javac' commands (Linux command line)

i' ve used javac and java compile & execute commands to build the same application on the DOS command line with Windows - no problem.
But when I try to compile the same file on the command line under Linux Redhat (7.1) using Bash shell i get <bash: javac: command not found> and <bash: java: command not found>.
In both cases I'm using j2sdk1.4.2 downloaded from java.sun.com for Windows & Linux respectively.
I make sure I have both the javac and the file I want to compile in the same directory ../j2sdk1.4.2/bin for both the Windows and the Linux applications.
Is there something I need to do to get bash to recognise javac, java etc? Is there a different setup procedure?
Any angles on this are much appreciated ..

Have you tried these correctly..
Set the CLASSPATH environment variable to include whichever directories you like, eg (on bash) type:
export CLASSPATH=$CLASSPATH:.:<your java dirs>
To make java easier to run, put the directory in which it is installed into your path:
export JAVA_HOME=<where you installed java>
Then do
export PATH=$PATH:$JAVA_HOME/bin
verify it has worked by simply typing
java
You can put all of these commands into the .*rc file for your shell, so that they are executed every time you open the shell. So if you are using bash you can put them into ~/.bashrc
Read up setting the PATH and CLASSPATH for more info.
This shall resolve the issue .

Similar Messages

  • Variable does not work for sqlplus (command line)

    Here is an select:
    variable x number;
    variable y number;
    variable a number;
    define x = 2000;
    define y = 2*1000;
    define a = &x+&y;
    select ener from adding where ener = &a;
    When I execute it under SQL*Plus Worksheet (client installed on my PC) then I get output:
    ENER
    4000
    1 row selected
    When I execute this same under command line sqlplus (under unix shell) then I get output
    old 1: select ener from adding where ener = &a
    new 1: select ener from adding where ener = 2000+2*1000
    no rows selected
    What is worng ?

    Nothing.
    Sqlplus is correct and sql worksheet is buggy.
    Define works with strings only. You cannot use it to calculate an expression.
    Apparently sql worksheet did calculate the expression, and sqlplus didn't, submitting it as a string.
    This is the expected behavior.
    This behavior can likely vary by version, so thank you for not providing version info.
    Will anything awful happen when you do, or is this just the lazyness epidemia in this forum?
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read documentation.

  • My Imac late 2012 running Yosemite does not recognise my Huawei 3g usb modem. itried to install Java bt still it does not although the same modem works with my MacBook pro . any help please

    My Imac late 2012 running Yosemite does not recognise my Huawei 3g usb modem. itried to install Java bt still it does not although the same modem works with my MacBook pro . any help please

    Hey there mbarikiwa,
    If your iMac still has not recognized the usb modem, I would use the troubleshooting for Yosemite USB issues in the following article:
    OS X Yosemite: If a USB device isn’t working
    If the device is connected to a USB hub: 
    Make sure the device and the hub are the same speed. Connect USB 3.0 SuperSpeed devices to a USB 3.0 SuperSpeed HUB, USB 2.0 Hi-Speed devices to a USB 2.0 Hi-Speed hub, and so on. 
    If the device doesn’t have a power cord and is plugged into another USB device that doesn’t have a power cord: 
    Try plugging the device directly into your computer’s USB port  or into a USB device that does have a power cord. You might need to disconnect and reconnect the other device as well, if it has stopped responding. 
    If you have many devices connected to your Mac: 
    Disconnect all USB devices except the device you’re testing, an Apple keyboard, and an Apple mouse. Make sure that the device is connected directly to the computer, and that any hubs or extension cables are disconnected. If you can use the device now, the problem may be with one of the other USB devices or hubs you had connected to your computer. Try reconnecting them, one by one, to your computer. When you find the device causing the problem, review its documentation for further troubleshooting steps. 
    Verify that the device appears in System Information: 
    Choose Apple menu > About This Mac. In the window that appears, click Overview, then click the System Report button to open System Information. 
    In the window that appears, see if the USB device is listed below Hardware in the Contents list. If the device appears but does not work, review the device’s documentation for further troubleshooting steps. 
    Restart apps: 
    Quit and restart any apps that use the device. 
    Restart your Mac: 
    Choose Apple menu > Restart.
    Check your device’s USB connection
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Any tips on Controlling interactive bash shell on Cygwin via Java process?

    Ideally, I'd like to be able to control an interactive bash shell on Cygwin from a Java process. But for starters, I want to do 'ls > /cygdrive/c/fred.txt'. The little program to do this, below, doesn't work. It simply runs without error.
    Any ideas? And also, any tips on doing a fully interactive shell?
    --> Java program to test simple command:
    package com.treelogic_swe.real_estate_explorer.utils;
    import java.io.File;
    import java.io.InputStream;
    * Quick and dirty test of Java to Cygwin bash shell process control.
    * Thanks to [email protected]
    * re: http://groups.google.com/group/comp.lang.java.help/browse_thread/thread/914403fbdd1de127/40363d2e7cbae823?lnk=st&q=cygwin+shell+java+process+runtime&rnum=1&hl=en#40363d2e7cbae823
    public class RunSystemCommand {   
        public static void main(String args[]) throws Throwable {
         // System command to run
         String cmd = "ls > /cygdrive/c/fred.txt";
            String [] sysArgs = { };
         // Set the working directory for the OS command processor
         File workDir = new File( "c:/cygwin/bin" );
         Process bash = Runtime.getRuntime().exec( cmd, sysArgs, workDir );
         InputStream bashIn = bash.getInputStream();
         while( bashIn.read() != -1 ); // Added, as otherwise the ls hangs.
         bash.waitFor();
    }

    Ideally, I'd like to be able to control an
    interactive bash shell on Cygwin
    What do you mean by this? Do you just want to start a bash shell, and have it's input and output come from and go to your Java program?
    Please be specific about what you want, as there are a couple of interpretations for what you said. You need to understand the differences and relationships among terminals, shells, shell builtins, and executables.
    You'll want to read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    from a Java
    process. But for starters, I want to do 'ls >
    /cygdrive/c/fred.txt'. The little program to do
    this, below, doesn't work. It simply runs without
    error.
    , <, |, and others are specific to the shell. When you're in a terminal, and you type ls > /tmp/zzz, it's the bash shell that interprets the >. Cygwin doesn't know anything about it. ls doesn't know anything about it.So if you want to to that, the command you'd execute from Java is not ls, but bash (or some other shell). You'd then tell bash to execute the rest. I'm not sure what the command line arg is for bash to tell it the rest of the command line args are a command that bash should interpret and execute. I think it might be -c like it is for zsh. So you'd need to do something like Runtie.getRuntime().exec("bash -c 'ls > /tmp/zzz'");

  • Airport utilities does not recognise windows 7 and will not load, how do I fix this?

    Airport utiltiy will not load, it does not recognise windows 7 and I get an effor message telling me that it requires XP  or vista etc.
    I have deleted and reloaded Airport Utilities, Bonjour and Itunes to no effect. Help!

    well...i go only to the site "Test it here: http://java.com/en/download/help/testvm.xml". After this i was able to go to a site with the title "Java Downloads for All Operating Systems" and here you download your JRE for your OS. For XP or Win 7 it was a java 6 update 29-b11. The file to install is named '''jxpiinstall.exe'''. After install an restart you go again to [http://java.com/en/download/help/testvm.xml testvm.xml] and see that the java plugin works fine.... (see the screenshot)...
    cheers
    marco

  • I cannot use a favourite site Monsoon fashions message says server does not recognise it

    Hi my favourite online shopping site (Monsoon) I use quite a lot now all of a sudden I cant open it, the message says server does not recognise Apache ...... can you tell me how now after so long this is happening, it doesnt happen on any other site

    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Apple TV does not "learn" the IR commands from a Bang & Olufsen (Beo4) remote

    Under Settings-General-Remotes is possible that the Apple TV "learn" the IR commands from any other (non Apple) remote.
    However I have tried this with a Beo4 remote (Bang & Olufsen), but the Apple TV does not recognise the Beo4 remote IR commands.
    Is this feature expected for a next update of the Apple TV?
    (my Apple TV is 3rd generation)

    Thanks a lot pluimpje, I understand now why it is not woking.
    Initially I thought that probably in a next update of the apple tv firmware it would reconise the Beo4.
    But I am afraid that this will not happen ever ( at least with the current apple tvs)
    I am interested in to know how can I equipe such module in my Beo 4.

  • HP dv7 notebook PC does not recognise the dvd burner.

     HP dv7 notebook with win7 64bit does not recognise the dvd burner.A diagnostic check says the dvd is working but it cannot play or burn CDs,DVDs as the DVD does not appear with the other HDs in the computer window.Can anyone help?

    Hi,
    It's possible that this is a hardware issue with the optical drive itself, but try running automated fixit from Microsoft on the link below.
    Windows 7
    Check if the drive is now working.
    If it still doesn't work, click the Start Menu, open All Programs, open Accessories, right click the Command Prompt and select 'Run as Administrator'.  In to the prompt type the following command and hit enter.
    sfc /scannow                 ( note that there is a space between sfc and the / )
    Let the process complete, then type exit and hit enter. 
    Next, click the Start Menu, open the Control Panel and click on Device Manager.  Next click to open DVD/CD-ROM Drives.  Right click the drive and select uninstall.  Do not delete drivers if asked.  When the device has uninstalled click on the 'Scan for Hardware Changes' icon ( usually just below Help on the toolbar ).  Let windows reinstall the drive and see if it now works.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • IPod Nano: Error Message "The USB device has malfunctioned and Windows does not recognise it"

    Hi everyone, I just received 2 brand new iPod Nanos for my kids for Christmas, thought I'd be smart and sync them both now before wrapping them so I don't have to be messing around with them on the day. One synced without a problem, then using the same cable, same computer, same USB port, the 2nd one came up with "The USB device has malfunctioned and Windows does not recognise it" I've tried restarting my computer, unplugging and reinserting the USB. Is there anthing else I can try before returning it? Thanking you for any help.

    I have solved my problem, I ended up ringing Apple and got an awesome lady who told me to reset it by pressing the sleep button and menu button together for about 10 seconds and once it actually turned on for the first time the computer then recognised it, so it's all good, :-) Thank you lovely lady!

  • I have a 16GB iPhone 3GS. Tried synching my phone through iTunes (11.0.1 I think... on a 2009 Macbook Pro). Now when I connect to iTunes, it says it does not recognise the content on my phone. Is this because my phone (and laptop) are too old?

    I have a 16GB iPhone 3GS. Tried synching my phone through iTunes (11.0.1 I think... on a 2009 Macbook Pro). Now when I connect to iTunes, it says it does not recognise the content on my phone. Is this because my phone (and laptop) are too old?
    Also, when I tried to Restore the settings, an Error Message pops up that says " The iPhone software update server could not be contacted. The requested resource was not found.
    I'm trying to free up space on my phone by removing [literally] thousands of old photos which were originally synched to the phone, because I had forgotten to uncheck the photos button when I synched it ages ago.
    I have also tried synching it on my 24" iMac (running OSX Snow Leopard). But again, when I try restoring the phone through itunes, it says the file is corrupted. It sggests unplugging the device, and then plugging it in again. I have done this numerous times with no success.
    I'm guessing it must be because my phone (and versions of iTunes, and OSX) are all too old.
    Please can anybody help.
    Cheers,
    Dan_nz.

    There are multiple reasons that lead to issue. You should read the troubleshooting guide to get the right solution to solve the issue: iPhone, iPad, or iPod touch not recognized in iTunes for Windows - Apple Support

  • I changed from i iphone 5 back to a iphone 4.. now my itunes does not recognise that i have a iphone 4! how do i convert my last back up (on iphone 5) to my new iphone 4?

    i changed from i iphone 5 back to a iphone 4.. now my itunes does not recognise that i have a iphone 4! how do i convert my last back up (on iphone 5) to my new iphone 4?

    In your case you can only restore from a backup that has been created with the same iOS version. An iPhone 4 can only run 7.1.2, and, unless your iPhone 5 did not run the same version, you can't use a newer iOS backup of the 5 on the iPhone 4

  • HT1414 I was in the middle of updating my iphone 4s to iOS7, then it crashed, I am able to get the apple simple when trying to restart, then it shows the cord and itunes logo and then switches off again.  Itunes on computer does not recognise the phone

    I was in the middle of updated iOS7 onto my 4s then it crashed, tried to restore and backup and it wont power off restart it just shows a black screen.
    Tried the tips
    Does not recognise my phone as I updated Itunes to see if this would work and I have lost all my back ups and every thing,
    when i try the power on butter and the home button I get the apple icon, then it shows power cord and itunes logo and then returns to a black screen, I can hear it beeping like when you put it on the charge each time this happens on my PC.
    please can anyone else help me???

    Unable to Update or Restore..?
    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...
    Take your time... Pay particular attention to Steps 3 and 4
    Note:
    Some users have reported as many as 8 or 9 attempts were necessary before success.

  • My Apple TV does not recognise My iTunes password. It works on all other devices but not Apple TV? Any ideas why or how to fix?

    Any ideas why my Apple TV does not recognise my iTunes password, when all other devices, including these communities are good with it?

    Hi Mick2291,
    Thanks for visiting Apple Support Communities.
    I'd suggest restarting, and then restoring, your Apple TV if the issue persists:
    Apple TV (2nd and 3rd generation): How to restart your Apple TV
    http://support.apple.com/kb/HT3180
    Apple TV (2nd and 3rd generation): Restoring your Apple TV
    http://support.apple.com/kb/HT4367
    Best Regards,
    Jeremy

  • Please help. ive bought a second hand ipod nano, when i connect it to my  pc it recognises it as a sigma mass usb device, yet its a 8gb ipod nano,and i tunes does not recognise it, im running on windows vista basic yet my own 80g classic ipod runs perfect

    please help. ive bought a second hand ipod nano, when i connect it to my pc, it does not recognise it in itunes,yet it comes up as a sigma mass usb device. its an ipod nano 8gb?. im running on windows vista,my own ipod classic runs fine.

    there is a good chance that this can be related to bad contact in USB lead.. e.g not enough power from IPOD to PC so that pc cannot recognise it. Where I work I get alot of USB devices on pc's that are not recognised and most of the time it is the connection to the device that is not good enough because the flat end of the USB adapter has been gradually bent over time just slightly and now contact is not good. It can also be todo with drivers or If you are using it through a USB hub.
    so if it is not working through USB hub try direct. also try in back of PC as these Ports or direct access to main board to pc and would be less trouble some if there was a voltage loss from mainboard in pc to front of unit.

  • Itunes does not recognise ipod touch

    i've reinstalled the latest version of itunes plus ios 6 and followed the troubleshooting sections for Windows 7 PC but itunes does not recognise the ipod touch.  the USB cable is ok (charges the ipod anyway) but when I run diagnostics it does not see an ipod.

    iOS: Device not recognized in iTunes for Windows
    Try another computer to help determine if you have an iPod or computer problem.

Maybe you are looking for

  • How to process a batch input session directly from the program

    Hi, I have developed a program which will create a batch input session. When the program is executed, the session should get processed . ie. the user need not have to go to sm35 to process the session. I am facing some problem in this. I am using BDC

  • Capturing data from a website

    Hello, I would like to capture data from websites, or get a snapshot of a given URL. I was wondering how this would be posible using Java. Any help or comments will be greatly appreciated. Chanie

  • Custom data labels in Crystal Reports charts

    Hi, I have a problem with charts in Crystal Reports. The notation prescribe e.g.  that positive values appears a plus (+21) and negative values a minus (-21). The problem is, that I canu2019t assign custom values to the data labels (e.g. the value is

  • Why when I scan it doesn't import because file already exists, i never scanned it before?

    Why when I scan anything in my Photoshop Elements 8, it tells me that nothing was imported because a file already exists.  I never scanned this photo before?? Please help!

  • Website design?

    Hi i am a photographer graduate, but  i have used dreamweaver cs4 to design class web sites. now i am using muse and dreamweaver cc. i just recently in last year found out that photo shop is not just a image editor anymore, in the latest update, phot