It may happen that you have installed Java on your Linux system but it is not recognized as installed and existing.
Check out in /usr/bin directory these symbolic links:
/usr/bin/java
/usr/bin/javaw
They should be pointing to your Java installation folder's and the executables there. For example:
$ ll /usr/bin/java*
java -> /etc/alternatives/java
javaws -> /usr/java/latest/bin/javaws
In this case, the first symbolic link is not updated to the latest or default Java bin folder and this may be causing issues.
Change it to point to:
/usr/java/latest/bin/java
and the final result should be:
$ ll /usr/bin/java*
java -> /usr/java/latest/bin/java
javaws -> /usr/java/latest/bin/javaws
In my particular case, I wasn't able to find java on my remote Linux machine via SSH connection through PuTTY and adjusting the symlinks in /usr/bin fixed my problem.
Friday, 9 January 2015
Wednesday, 7 January 2015
Install multiple Java versions on a single Linux machine
It is often the case that you need to have multiple Java versions installed on a single machine. My own issue was that I needed Eclipse to be configured to use several versions of Java (toolbar menu Window -> Preferences -> Java -> Installed JREs) and in order to make them known to Eclipse I first need to have their installation folders.
On a RedHat Linux, once you have a Java installed, then installing a next one is not be possible, the OS will return error that Java was already installed. To workaround you need to do this.
1. Install your first java.
2. Rename its folder located in /usr/java/....
3. Delete the symbolic links "default" and "latest" in that same directory.
4. Uninstall Java from the Applications -> Add/Remove Software (under RedHat) or whichever way it is done on your Linux version.
5. Install the next java the usual way you do it.
This will create a new folder in /usr/java/ and will also create new "default" and "latest" symlinks in that same location.
Uninstalling Java will not remove its folder if you first rename it and then run uninstall, so you will keep it for further work. Switching to another active system java is just done by editing the symlinks "default" and "latest" pointing them to another java folder in /usr/java/...
You may also need to adjust the links in /etc/alternatives/java in order to make java work (be accessible) but this is subject for another post.
On a RedHat Linux, once you have a Java installed, then installing a next one is not be possible, the OS will return error that Java was already installed. To workaround you need to do this.
1. Install your first java.
2. Rename its folder located in /usr/java/....
3. Delete the symbolic links "default" and "latest" in that same directory.
4. Uninstall Java from the Applications -> Add/Remove Software (under RedHat) or whichever way it is done on your Linux version.
5. Install the next java the usual way you do it.
This will create a new folder in /usr/java/ and will also create new "default" and "latest" symlinks in that same location.
Uninstalling Java will not remove its folder if you first rename it and then run uninstall, so you will keep it for further work. Switching to another active system java is just done by editing the symlinks "default" and "latest" pointing them to another java folder in /usr/java/...
You may also need to adjust the links in /etc/alternatives/java in order to make java work (be accessible) but this is subject for another post.
Saturday, 13 December 2014
Mapping a Linux folder to another Linux folder
NFS is a protocol used to map a Linux drive to another Linux drive and treat the other drive as it was a local one.
The following is based on RedHat Linux.
First, on the remote machine that you want to have access to, you need to have installed the nfs service files from the installation disk:
system-config-nfs... (GUI tool to manipulate the NFS configuration)
nfs-utils-lib... (support library)
nfs-utils... (NFS utilities and daemons)
portmap-....(manager of RPC connections)
Next, open NFS in System -> Administration -> Server settings. This will edit the NFS configuration file through the GUI. You can do the same by manually editing the /etc/exports file, if you prefer.
So, once the configuration GUI tool is open, click Add to add info about the folder to be exported for external access.
This link http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-nfs-server-export.html can help you here.
Next, run the NFS service from System -> Administration -> Server settings -> Services
Or, if it was already running, restart it for changes to take effect.
/etc/init.d/nfs restart
Finally, execute this command on the other machine which will gain access to the one we just configured
mount -f nfs -o sync.dirsync.rw,rsize=32768,wsize=32768,noac,lookupcache=none 10.123.10.10:/home/path/to/export /home/local/path
Now we expect that the local folder /home/local/path will be mounted to /home/path/to/export on the remote machine.
The following is based on RedHat Linux.
First, on the remote machine that you want to have access to, you need to have installed the nfs service files from the installation disk:
system-config-nfs... (GUI tool to manipulate the NFS configuration)
nfs-utils-lib... (support library)
nfs-utils... (NFS utilities and daemons)
portmap-....(manager of RPC connections)
Next, open NFS in System -> Administration -> Server settings. This will edit the NFS configuration file through the GUI. You can do the same by manually editing the /etc/exports file, if you prefer.
So, once the configuration GUI tool is open, click Add to add info about the folder to be exported for external access.
This link http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-nfs-server-export.html can help you here.
Next, run the NFS service from System -> Administration -> Server settings -> Services
Or, if it was already running, restart it for changes to take effect.
/etc/init.d/nfs restart
Finally, execute this command on the other machine which will gain access to the one we just configured
mount -f nfs -o sync.dirsync.rw,rsize=32768,wsize=32768,noac,lookupcache=none 10.123.10.10:/home/path/to/export /home/local/path
Now we expect that the local folder /home/local/path will be mounted to /home/path/to/export on the remote machine.
How to attach in Eclipse the source code of Java language
If you need to browse the original code of the Java language, you need to attached its sources to the installed JRE preference page, as by default it is not attached when you specify your working JRE.
In Eclipse, select Windows -> Preferences -> Java -> Installed JREs , expands
That should be right under the JDK folder , for example: C:\Program Files (x86)\jdk7
In Eclipse, select Windows -> Preferences -> Java -> Installed JREs , expands
rt.jar, select “Source attachment” and find the src.zip from your disk drive.That should be right under the JDK folder , for example: C:\Program Files (x86)\jdk7
Wednesday, 23 July 2014
Change display resolution in Linux
Change display resolution in Linux
This also reflects upon the display size in vSphere client, which was the reason I needed to changed the resolution, it was a bit too big and had to scroll the screen and wanted to reduce its size.
To change the VGA card display resolution in RHEL5
1) First check all the possible resolutions supported by your graphics card using the following command.
"xrandr"
It will display all possible resolutions.
2) Change resolution.
Suppose your graphics card support 1024x768 resolution then you can change it using the following command.
"xrandr -s 1024x768"
If you don't have "1024x768" in that “xrandr” output, try below one this might be help to get “1024x768”.
In “/etc/X11/xorg.conf” file just check the entries
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
EndSubSection
Check the entry “Modes”. If it is not present just add this line and check.
Thursday, 10 July 2014
Close port on Linux
sudo netstat -lpn | grep 8080
will list the process on port 8080
example:
tcp 0 0 :::8080 :::* LISTEN 21026/java
kill 21026
will list the process on port 8080
example:
tcp 0 0 :::8080 :::* LISTEN 21026/java
kill 21026
Subscribe to:
Posts (Atom)