Thursday, July 2, 2009

Java:Compile Errors

When I try to install a java program (JaxoDraw) by ant that draws Feynman diagram, I met some errors with my laptop settings. Here are 3 errors that printed on the screen:

Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.5.0-gcj-4.2-1.5.0.0/lib/tools.jar

BUILD FAILED: /work/JaxoDraw-2.0-0/build.xml:xxx:
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
/work/JaxoDraw-2.0-0/build.xml:191: Error starting modern compiler


My solution and checking are:
1. I do not have jdk installed. So I installed it first.
2. Set JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.07/" (which is one java location)
3. compile by ant -lib /usr/lib/jvm/java-6-sun-1.6.0.07/lib/tools.jar (maybe, -lib ... won't be needed any more, I don't know)

Wednesday, July 1, 2009

Linux:Shell:Bash: how to search slash or backslash by sed

It is tricky to search (or replace) signs slash '\' or backslash '/' by sed. By searching internet, I found 2 approaches:

1. Put the command line of sed to a file called my.sed:

/D\\O/p

(this will print a line containing 'D\O')

2. Another way is to use single quote instead of double one in your shell command line:

sed -n '/D\\O/ p' myfile.txt

(-n is prevent from printing)

Locations of visitors to this page