last day (14 days later) » 

ASR
9:30 AM
hi thank u
 
Hi @ASR
 
ASR
PATH=/usr/bin/java/jdk1.7.0_51/bin:$PATH
export PATH

JAVA_HOME=/usr/bin/java/jdk1.7.0_51
export JAVA_HOME


PATH=/opt/apache-ant-1.7.1/bin:$PATH
export PATH

ANT_HOME=/opt/apache-ant-1.7.1
export ANT_HOME

ANT_OPTS="-Xmx512m -XX:MaxPermSize=512m"
export ANT_OPTS

set PATH=$PATH:$ANT_HOME/bin
export PATH
this is my .bahrc file
i have installed the ant through get -apt install ant
 
Ok, you cannot use /usr/bin/java/... as the path for JAVA_HOME, because /usr/bin/java is an executable or a symbolic link to an executable.
 
ASR
sudheer@VY-B3:~$ which java
/usr/bin/java
sudheer@VY-B3:~$
this is my java location
actual location is /opt/java/jdk1.7_30 is the original location i dnt know y it is showing usr/bin/java
 
So, JAVA_HOME should probably be /opt/java/jdk1.7_30
 
ASR
9:38 AM
ok i will add it now
JAVA_HOME=/opt/java/jdk1.7.0_51
export JAVA_HOME
now is it correct?
 
Yes, this should work.
When you run `java -version`, does it work?
 
ASR
after setting environment variables we need to reboot the system?
 
No, you can either open a new terminal window or just do
. ~/.bashrc
in your current terminal
 
ASR
what it will do?
 
. ~/.bashrc
reads `.bashrc` and executes the commands in there.
The same happens when you open a new terminal window.
 
ASR
9:42 AM
i did this
sudheer@VY-B3:~$ . ~/.bashrc
sudheer@VY-B3:~$ which java
/usr/bin/java
sudheer@VY-B3:~$
 
Ok, now run java -version
 
ASR
sudheer@VY-B3:~$ java -version
java version "1.6.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.1) (6b30-1.13.1-1ubuntu2~0.10.04.1)
OpenJDK Server VM (build 23.25-b01, mixed mode)
sudheer@VY-B3:~$
sudheer@VY-B3:~$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
sudheer@VY-B3:~$
now will it work?
 
Ant looks fine, but this is a different Java version.
What happens when you run
/opt/java/jdk1.7.0_51/bin/java -version
?
 
ASR
iam also thinking that one
how to resolve this?
 
You must modify the PATH variable. Move the PATH after JAVA_HOME, e.g.

JAVA_HOME=/opt/java/jdk1.7.0_51
export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH
export PATH
This should give you the java from /opt/java/jdk1.7.0_51
 
ASR
9:50 AM
JAVA_HOME=/opt/java/jdk1.7.0_51
export JAVA_HOME


PATH=/usr/bin/java/jdk1.7.0_51/bin:$PATH
export PATH

PATH=/opt/apache-ant-1.7.1/bin:$PATH
export PATH

ANT_HOME=/opt/apache-ant-1.7.1
export ANT_HOME

ANT_OPTS="-Xmx512m -XX:MaxPermSize=512m"
export ANT_OPTS

set PATH=$PATH:$ANT_HOME/bin
export PATH
java version "1.6.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.1) (6b30-1.13.1-1ubuntu2~0.10.04.1)
OpenJDK Server VM (build 23.25-b01, mixed mode)
sudheer@VY-B3:~$
not reflected
 
No, don't hardcode the PATH, you still have /usr/bin/java/jdk1.7.0_51/bin.
Use PATH=$JAVA_HOME/bin:$PATH instead.
Also don't use set PATH=$PATH:$ANT_HOME/bin, just write
PATH=$ANT_HOME/bin:$PATH
without set.
 
ASR
like this.........
PATH=$JAVA_HOME/bin:$PATH
export PATH
 
Yes, this is correct.
This way, when you change JAVA_HOME and rerun bashrc, the PATH will be automatically adjusted as well.
 
ASR
now it is ok?
JAVA_HOME=/opt/java/jdk1.7.0_51
export JAVA_HOME


PATH=$JAVA_HOME/bin:$PATH
export PATH

PATH=$ANT_HOME/bin:$PATH
export PATH

ANT_HOME=/opt/apache-ant-1.7.1
export ANT_HOME

ANT_OPTS="-Xmx512m -XX:MaxPermSize=512m"
export ANT_OPTS

set PATH=$PATH:$ANT_HOME/bin
export PATH
 
Not yet, you must move ANT_HOME before you change the PATH.
Remove the final set PATH=...
And you still must increase ANT_OPTS to 1024, IIRC.
JAVA_HOME=/opt/java/jdk1.7.0_51
export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH
export PATH

ANT_HOME=/opt/apache-ant-1.7.1
export ANT_HOME

PATH=$ANT_HOME/bin:$PATH
export PATH

ANT_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
export ANT_OPTS
 
ASR
10:00 AM
JAVA_HOME=/opt/java/jdk1.7.0_51
export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH
export PATH


ANT_HOME=/opt/apache-ant-1.7.1
export ANT_HOME

PATH=$ANT_HOME/bin:$PATH
export PATH

ANT_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
export ANT_OPTS
is it ok?
do i need to add any more?
suppose if i want to add some jar files i need to set CLASSPATH right?
sudheer@VY-B3:~$ . ~/.bashrc
sudheer@VY-B3:~$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Server VM (build 24.51-b03, mixed mode)
sudheer@VY-B3:~$
now iam getting java 1.7
 
Yes, this looks fine now.
In my system, eclipse and ant work out of the box, so I don't know if you must add anything else.
If you need to add jar files, you can set CLASSPATH. This gives the jars to all java programs.
You can also give it to individual programs by adding the option -cp jarfile1:jarfile2 and so on.
 
ASR
@OlafDietsche can u tell me how to set this classpath also
 
It's the same as any environment variable
CLASSPATH=/path/to/jarfile1:/path/to/another/jarfile2
export CLASSPATH
 
ASR
thank u
 
When you give it to one invocation only
java -cp /path/to/jarfile1:/path/to/another/jarfile2 ...
 
ASR
10:08 AM
how to start mysqlserver in ubuntu?
i have database name lpotal
 
When you installed mysql through apt, it should start automatically.
If you must restart it manually, you can say

sudo /etc/init.d/mysql start

or just

sudo start mysql
 
ASR
sudheer@VY-B3:~$ sudo start mysql
[sudo] password for sudheer:
start: Job is already running: mysql
sudheer@VY-B3:~$
 
Ok, then mysql was started at boot time and everything is working fine.
 
ASR
@OlafDietsche thank u so much.. iam thankfull to u
 
No problem, bye.
 
ASR
10:16 AM
@OlafDietsche bye tc
 
ASR
10:28 AM
@OlafDietsche hi
getting same error while running other build file
Buildfile: /home/sudheer/Desktop/Life-ray/Liferay_workspace/portal/build.xml

BUILD FAILED
/home/sudheer/Desktop/Life-ray/Liferay_workspace/portal/build.xml:4: The following error occurred while executing this line:
/home/sudheer/Desktop/Life-ray/Liferay_workspace/portal/build-common.xml:393: .

Please set the environment variable ANT_OPTS to the recommended value of
"-Xmx1024m -XX:MaxPermSize=512m".

Total time: 1 second
preiviously what i have done is clicking on build.xml-->run configuration-->envirornment--->added ANT_opts
 
ASR
10:44 AM
 
11:05 AM
@ASR Have you set ANT_opts or ANT_OPTS?
 
ASR
i have set ANT_OPTS
now issue resolved
To fix it, right click portal-dist in the Ant View and go to Run As > External Tools Configuration > Environment and add a new Variable:

Name: ANT_OPTS
Value: -Xmx1024m -XX:MaxPermSize=512m

Since Eclipse is invoking Ant it needs the variable.
 
Ok, what have you changed?
 
ASR
but iam getting one doubt...
if i create a project , for every project do i need to add this ANT_OPTS?
this is i followed
 
I just looked through eclipse and haven't found a solution.
The only thing I see is to set ANT_OPTS in your shell profile.
Or you start eclipse from a shell script, which includes the ANT_OPTS variable.
#! /bin/sh

ANT_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
export ANT_OPTS

eclipse
 
ASR
how to start eclipse from shell script
sudheer@VY-B3:~/Desktop/Life-ray/eclipse$ ls
about_files configuration eclipse.ini hs_err_pid1830.log p2
about.html dropins epl-v10.html icon.xpm plugins
artifacts.xml eclipse features notice.html readme
sudheer@VY-B3:~/Desktop/Life-ray/eclipse$
 
11:21 AM
You write the text above in some text file.
You can open a terminal window and start the script.
Depending on the desktop you use, you can also modify the icon properties and set the script path.
 
ASR
iam new to shell scripting
can u help me
 
A Linux/Unix shell script is like a Windows batch file.
 
ASR
this is the location of eclipse
sudheer@VY-B3:~/Desktop/Life-ray/eclipse
 
Does it work when you type eclipse on the command line?
 
ASR
sudheer@VY-B3:~/Desktop/Life-ray/eclipse$ eclipse
The program 'eclipse' is currently not installed. You can install it by typing:
sudo apt-get install eclipse-platform
sudheer@VY-B3:~/Desktop/Life-ray/eclipse$
No its not opening
 
11:29 AM
Try ./eclipse with a leading ./ instead.
 
ASR
ok
now it is opened
@OlafDietsche why ./ is used?
 
This is because the current directory "." is not in the PATH.
You can try this script
 
ASR
@OlafDietsche ok
 
#! /bin/sh

ANT_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
export ANT_OPTS

$HOME/Desktop/Life-ray/eclipse/eclipse
This is the same as above, only the last line uses the complete path to eclipse.
 
ASR
vi starteclipse
ANT_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
export ANT_OPTS

$HOME/Desktop/Life-ray/eclipse/eclipse
to run it sh starteclipse
is it right?
 
11:47 AM
Yes, this is correct.
 
ASR
thank u so much..
 
Ok, good bye.
 
 
2 hours later…
ASR
1:40 PM
@OlafDietsche hi
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb55e5ffe, pid=6822, tid=3077981888
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) Client VM (24.51-b03 mixed mode linux-x86 )
# Problematic frame:
# J org.eclipse.osgi.internal.resolver.StateImpl.getHighestBundleId()J
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
while opening the eclipse through terminal it is showing the above error
 

last day (14 days later) »