I checked (based on cannot execute binary file and some other SO questions) that the java file I'm trying to run is indeed executable on Ubuntu 12.04.
$ file ORA/include/OraFiles/bin/ora
ORA/include/OraFiles/bin/ora: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
But when I try to run it
$ ORA/ora.sh -measures ORA/include/OraFiles/xml/ora_xml_measures.xml -script junkin.xml -log 1999-progress.log
Exception in thread "main" java.lang.NoClassDefFoundError: edu/cmu/casos/OraUI/controller/OraMain
Caused by: java.lang.ClassNotFoundException: edu.cmu.casos.OraUI.controller.OraMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: edu.cmu.casos.OraUI.controller.OraMain. Program will exit.
or
$ ORA/include/OraFiles/bin/ora -measures ORA/include/OraFiles/xml/ora_xml_measures.xml -script junkin.xml -log 1999-progress.log
ORA/include/OraFiles/bin/ora: error while loading shared libraries: liborautils.so.0: cannot open shared object file: No such file or directory
however liborautils.so.0 does in fact exist:
$ ls ORA/include/OraFiles/bin/
construct.exe libjogl_cg.so libora.so.0
dynetml2orgahead.exe libjogl.jnilib libora.so.0.0.0
gluegen-rt.dll libjogl.so liborautils.so
html_to_ppt_converter.exe libnetstatplusfog.so **liborautils.so.0**
j3dcore-ogl.dll libnetstatplusfog.so.0 liborautils.so.0.0.0
jogl_awt.dll libnetstatplusfog.so.0.0.0 libtinyxml.so
jogl_cg.dll libnetstatplus.so libtinyxml.so.0
jogl.dll libnetstatplus.so.0 libtinyxml.so.0.0.0
libcasos_utils.so libnetstatplus.so.0.0.0 ora
libcasos_utils.so.0 libnewran.so ora.exe
libcasos_utils.so.0.0.0 libnewran.so.0 ora_jni.dll
libgluegen-rt.jnilib libnewran.so.0.0.0 ora_log.txt
libgluegen-rt.so libora_jni.so orgahead.exe
libjogl_awt.jnilib libora_jni.so.0 orgahead_perf.exe
libjogl_awt.so libora_jni.so.0.0.0
libjogl_cg.jnilib libora.so
How do I make Java see that it's there? I'm trying to run ng-nailgun but the instructions on nailgun quickstart don't seem to relate to the Ubuntu sudo apt-get install nailgun.
I installed ant, nailgun, and maven2 in the hopes that their dependencies would install whatever java stuff I need. This is on a 64-bit EC2 prebuild of Ubuntu 12.04.1.
UPDATE: Here is the text of ora.sh:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./include/OraFiles/bin/lib:./include/OraFiles/bin
java -splash:include/OraFiles/images/ORA-splash-screen.png -Xmx1024m -cp ora.jar:lib/jfreechart-1.0.13.jar:lib/jfreechart-1.0.13-swt.jar:lib/TableLayout.jar:lib/jcommon-1.0.9.jar:lib/httpcore-nio-4.0-beta3.jar:lib/j3dcore.jar:lib/httpcore-4.0-beta3.jar:lib/jung.jar:lib/twitter4j-1.1.7.jar:lib/jcalendar.jar:lib/rssutils.jar:lib/omj3d.jar:lib/json-1.0.jar:lib/commons-collections-3.1.jar:lib/jsi-generics.jar:lib/opencsv-1.7.jar:lib/trove-2.0.4.jar:lib/xml-writer.jar:lib/commons-logging-api-1.1.1.jar:lib/junit.jar:lib/jts-1.7-generics.jar:lib/casosparser.jar:lib/jgraphlayout.jar:lib/htmlparser.jar:lib/facebook-util-1.8-final.jar:lib/j3d-vrml97.jar:lib/omcorba.jar:lib/ant-launcher.jar:lib/colt.jar:lib/wwj/worldwind-ora.jar:lib/freehep/freehep-graphics2d-2.0.jar:lib/gt2-2.3.3/gt2-widgets-swing-2.3.3.jar:lib/gt2-2.3.3/batik-svggen-1.6.jar:lib/gt2-2.3.3/spatialdb-0.1.jar:lib/gt2-2.3.3/velocity-1.4.jar:lib/gt2-2.3.3/gt2-go-2.3.3.jar:lib/gt2-2.3.3/jsr108-0.01.jar:lib/gt2-2.3.3/db2jcc_dummy-8.2.1.jar:lib/gt2-2.3.3/gt2-postgis-2.3.3.jar:lib/gt2-2.3.3/gt2-xml-gml3-2.3.3.jar:lib/gt2-2.3.3/gt2-xml-2.3.3.jar:lib/gt2-2.3.3/concurrent-1.3.4.jar:lib/gt2-2.3.3/gt2-image-2.3.3.jar:lib/gt2-2.3.3/jaxb-impl-1.3.jar:lib/gt2-2.3.3/gt2-tiger-2.3.3.jar:lib/gt2-2.3.3/imageioext-asciigrid-1.0-rc1.jar:lib/gt2-2.3.3/gt2-api-2.3.3.jar:lib/gt2-2.3.3/gt2-shapefile-2.3.3.jar:lib/gt2-2.3.3/gt2-main-2.3.3.jar:lib/gt2-2.3.3/gt2-validation-2.3.3.jar:lib/gt2-2.3.3/commons-jxpath-1.2.jar:lib/freehep/freehep-graphicsio-svg-2.0.jar:lib/gt2-2.3.3/ecore-2.1.0.jar:lib/gt2-2.3.3/postgis-driver-1.0.jar:lib/gt2-2.3.3/commons-beanutils-1.4.jar:lib/gt2-2.3.3/relaxngDatatype-X.jar:lib/gt2-2.3.3/gt2-db2-2.3.3.jar:lib/gt2-2.3.3/geowidgets-1.0-M1.jar:lib/jai_codec.jar:lib/freehep/freehep-graphicsio-2.0.jar:lib/jogl/jogl.jar:lib/freehep/freehep-io-2.0.1.jar:lib/freehep/freehep-xml-2.0.1.jar:lib/gt2-2.3.3/ant-optional-1.5.1.jar:lib/gt2-2.3.3/gt2-vpf-2.3.3.jar:lib/gt2-2.3.3/gt2-demo-property-2.3.3.jar:lib/gt2-2.3.3/commons-pool-1.3.jar:lib/gt2-2.3.3/gt2-cql-2.3.3.jar:lib/gt2-2.3.3/geoapi-nogenerics-2.1-M2.jar:lib/gt2-2.3.3/gt2-sde-dummy-2.3.3.jar:lib/gt2-2.3.3/vecmath-1.3.1.jar:lib/gt2-2.3.3/velocity-dep-1.4.jar:lib/gt2-2.3.3/gt2-coverage-2.3.3.jar:lib/gt2-2.3.3/batik-util-1.6.jar:lib/gt2-2.3.3/gt2-wms-2.3.3.jar:lib/gt2-2.3.3/jaxb-api-1.3.jar:lib/omsvg.jar:lib/gt2-2.3.3/batik-xml-1.6.jar:lib/gt2-2.3.3/batik-bridge-1.6.jar:lib/gt2-2.3.3/commons-lang-2.1.jar:lib/gt2-2.3.3/gt2-render-2.3.3.jar:lib/gt2-2.3.3/batik-dom-1.6.jar:lib/gt2-2.3.3/gt2-graph-2.3.3.jar:lib/gt2-2.3.3/gt2-epsg-hsql-2.3.3.jar:lib/gt2-2.3.3/gt2-indexed-shapefile-2.3.3.jar:lib/gt2-2.3.3/jlfgr-1.0.jar:lib/gt2-2.3.3/gt2-hsql-2.3.3.jar:lib/java-getopt-1.0.13.jar:lib/gt2-2.3.3/batik-svg-dom-1.6.jar:lib/gt2-2.3.3/common-2.1.0.jar:lib/gt2-2.3.3/gt2-geotiff-2.3.3.jar:lib/toolkits_1-2-0.jar:lib/milStd2525_png.jar:lib/j3dutils.jar:lib/JAXWS2.1.3-20071218.jar:lib/Jama-1.0.1.jar:lib/commons-codec-1.3.jar:lib/gt2-2.3.3/gt2-imagemosaic-2.3.3.jar:lib/iText-2.1.0.jar:lib/commons-math-1.2.jar:lib/gt2-2.3.3/postgresql-8.1-407.jdbc3.jar:lib/freehep/freehep-util-2.0.1.jar:lib/idw-1.5.0/idw.jar:lib/gt2-2.3.3/batik-awt-util-1.6.jar:lib/gt2-2.3.3/gt2-gtopo30-2.3.3.jar:lib/gt2-2.3.3/gt2-wfs-2.3.3.jar:lib/gt2-2.3.3/picocontainer-1.2.jar:lib/gt2-2.3.3/gt2-arcgrid-2.3.3.jar:lib/gt2-2.3.3/gt2-mysql-2.3.3.jar:lib/gt2-2.3.3/gt2-openoffice-2.3.3.jar:lib/gt2-2.3.3/batik-ext-1.6.jar:lib/gt2-2.3.3/gt2-oracle-spatial-2.3.3.jar:lib/gt2-2.3.3/batik-gvt-1.6.jar:lib/gt2-2.3.3/gt2-svgsupport-2.3.3.jar:lib/svgSalamander-tiny.jar:lib/jhall.jar:lib/gt2-2.3.3/batik-css-1.6.jar:lib/gt2-2.3.3/gt2-mappane-2.3.3.jar:lib/gt2-2.3.3/gt2-demo-mappane-2.3.3.jar:lib/gt2-2.3.3/gt2-directory-2.3.3.jar:lib/gt2-2.3.3/gt2-geomedia-2.3.3.jar:lib/activation.jar:lib/commons-logging-1.1.1.jar:lib/gt2-2.3.3/gt2-mif-2.3.3.jar:lib/openmap-4.6.5.jar:lib/gt2-2.3.3/gt2-xml-filter-2.3.3.jar:lib/httpmime-4.0-beta2.jar:lib/gt2-2.3.3/junit-3.8.1.jar:lib/jai_core.jar:lib/gt2-2.3.3/xml-apis-1.0.b2.jar:lib/mail.jar:lib/gt2-2.3.3/hsqldb-1.8.0.1.jar:lib/jogl/gluegen-rt.jar:lib/gt2-2.3.3/commons-cli-2.0-gt2-pre1.jar:lib/gt2-2.3.3/commons-io-1.2.jar:lib/gt2-2.3.3/xsd-2.1.1.jar:lib/gt2-2.3.3/gt2-demo-data-2.3.3.jar:lib/gt2-2.3.3/batik-transcoder-1.6.jar:lib/javaml-0.0.12.jar:lib/gt2-2.3.3/gt2-epsg-access-2.3.3.jar:lib/gt2-2.3.3/jta-1.0.1B.jar:lib/gt2-2.3.3/gt2-epsg-postgresql-2.3.3.jar:lib/gt2-2.3.3/gt2-referencing-2.3.3.jar:lib/freehep/freehep-graphicsio-pdf-2.0.jar:lib/gt2-2.3.3/gt2-brewer-2.3.3.jar:lib/gt2-2.3.3/xercesImpl-2.7.1.jar:lib/commons-httpclient-3.1.jar:lib/gt2-2.3.3/imageioext-customstreams-1.0-rc1.jar:lib/gt2-2.3.3/jdbc-stdext-2.0.jar:lib/httpclient-4.0-beta2.jar:lib/gt2-2.3.3/jaxb-libs-1.3.jar:lib/gt2-2.3.3/gt2-imagepyramid-2.3.3.jar:lib/gt2-2.3.3/batik-script-1.6.jar:lib/gt2-2.3.3/xsdlib-20050614.jar:lib/facebook-java-api-1.8-final.jar:lib/gt2-2.3.3/gt2-arcsde-2.3.3.jar:lib/gt2-2.3.3/gt2-coveragetools-2.3.3.jar:lib/MDateSelector14-00347.jar:lib/rome-1.0.jar:lib/gt2-2.3.3/gt2-shapefile-renderer-2.3.3.jar:lib/gt2-2.3.3/gt2-epsg-wkt-2.3.3.jar:lib/gt2-2.3.3/gt2-gml-2.3.3.jar:lib/gt2-2.3.3/log4j-1.2.6.jar:lib/gt2-2.3.3/xml-apis-xerces-2.7.1.jar:lib/gt2-2.3.3/batik-parser-1.6.jar:lib/gt2-2.3.3/gt2-xml-gml2-2.3.3.jar:lib/gt2-2.3.3/gt2-referencing3D-2.3.3.jar:lib/jdom-1.1.jar:lib/jide-oss-2.8.8.jar edu.cmu.casos.OraUI.controller.OraMain
Related
I built a java program in Eclipse in Windows and it worked well. The program included 5 java classes and 5 jar library files.
Then I copied all *.java files and *.jar files to Linux. After I compiled and run it, I got an exception, the class PaserException of htmlparser.jar was not found.
Exception in thread "main" java.lang.NoClassDefFoundError: org/htmlparser/util/ParserException
Caused by: java.lang.ClassNotFoundException: org.htmlparser.util.ParserException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
I just begin to learn Linux so I'm not sure if I compiled and run it correctly.
All of my files(*.java and *.jar) are in the same directory, and my operation is in this directory.
To compile:
javac -cp ./htmlparser.jar:./filterbuilder.jar:./sitecapturer.jar:./thumbelina.jar:./htmllexer.jar *.java
To run:(the main method is in Crawler class, main method requires at lease 1 argument)
java -cp ./htmlparser.jar:./filterbuilder.jar:./sitecapturer.jar:./thumbelina.jar:./htmllexer.jar Crawler arg0 arg1
Then I got the exception above. Did I compile and run it correctly? Why did I got this exception? Thanks.
The folder that holds the class file (.) is not on the classpath. Add another :. to the classpath:
java -cp ./htmlparser.jar:./filterbuilder.jar:./sitecapturer.jar:./thumbelina.jar:./htmllexer.jar:. Crawler arg0 arg1
I have tried several approaches as suggested on this website as well as several others to no avail.
-Running Angstrom embedded Linux, OpenJDK6, Shark VM.
File Structure
All .java and .jar files are stored in directory ./src
jarfiles: j1.jar j2.jar
Source code: Coder.java, WrapperClass.java
Compiling and Running
javac -cp j1.jar:j2.jar Coder.java WrapperClass.java
Successfully compiles, outputs Coder.class, WrapperClass.class, as well as several other files including Coder$1.class through Coder$6.class, as well as Coder$Main_thread.class and Coder$Progress_Bar_Thread.class, any insight onto what all these .class files are for?
Run attempts all terminate in java.lang.ClassNotFoundException.
~/coder/src: java Package.Coder
~/coder/src: java -cp jar1.jar:jar2.jar Package.Coder
~/coder: java ./src/Package.Coder
~/coder: java -cp jar1.jar:jar2.jar ./src/Package.Coder
Thank you very much for your help. I have run this on NetBeans and can verify that it's functional code, just a matter of getting it to run on Linux.
Stacktrace is:
Exception in thread "main" java.lang.NoClassDefFoundError: Package/Coder Caused by: java.lang.ClassNotFoundException: Package.Coder
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
Could not find the main class: Package.Coder. Program will exit
Assuming this structure
/coder
/src
/Package
/Coder.java
/WrapperClass.java
/j1.jar
/j2.jar
You will need to compile from /src as
javac -cp j1.jar:j2.jar Package/Coder.java Package/WrapperClass.java
This will create .class files in /Package. You can then run it, again from /src as
java -cp j1.jar:j2.jar Package.Coder
assuming the Coder class has a main method which is your entry point.
I am in the folder :
/cygdrive/d/ragsxq where I have kept some simple X-Query stmts to be executed via Saxon X-Query engine...(Saxon 9.4 HE )
The following statement :
$ java -classpath /cygdrive/d/saxon/saxon9he.jar net.sf.saxon.Query -q:ragsXQuery.xq
gives :
java.lang.NoClassDefFoundError: net/sf/saxon/Query Caused by:
java.lang.ClassNotFoundException: net.sf.saxon.Query at
java.net.URLClassLoader$1.run(Unknown Source) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class:
net.sf.saxon.Query. Program will exit. Exception in thread "main"
But the below statement works fine:
$ java -classpath ../saxon/saxon9he.jar net.sf.saxon.Query -q:ragsXQuery.xq
?!?!
Something to do with the Class-loader..?? Permmissions..?? Cygwin ? Hmmmmm...
Thanks a lot for pointing out this Cygwin behavior!
But the strange thing is, i run into this java.lang.NoClassDefFoundError (exactly the same as above) when I try to Run an Xquery via my Eclipse (Indigo) on Mac OS Lion too...via the XQDT plugin, where I have to configure the XQuery engine by providing the full-path of the saxon9he.jar & the main-class viz., net.sf.saxon.Query
Note that a similar set-up on Windows-XP works fine.
This time, I guess it could be some Classpath issue or the way Mac OS's Java treats things differently ?
I think I have faced this before. It is probably a Cygwin nuance. Just try
$ java -classpath `cygpath -m /cygdrive/d/saxon/saxon9he.jar` net.sf.saxon.Query -q:ragsXQuery.xq
Here is a possible explanation as to why:
http://cygwin.com/ml/cygwin/2008-01/msg00083.html
Below is the output from my Cygwin for an executable JAR file. I use Windows Vista 32 bit (I know, it sucks).
adarshr$ java -jar /cygdrive/d/adarshr/data/cf.jar
Error: Unable to access jarfile /cygdrive/d/adarshr/data/cf.jar
adarshr$
adarshr$ java -jar `cygpath -m /cygdrive/d/adarshr/data/cf.jar`
Usage: java -jar cf.jar SEARCH [DIRECTORY] [OPTIONS]...
Try -h or --help for more information
As you can see, the second command worked and printed a help (as expected).
I am new to jython. Here is my failed attempt to use javac to complie my python script into class file.
rohit#rohit-laptop:~/backyard$ echo "print 'hi'" > test.py
rohit#rohit-laptop:~/backyard$ jython test.py
hi
rohit#rohit-laptop:~/backyard$ jythonc test.py
Warning: jythonc is unmaintained and will not be included in Jython-2.3. See http://jython.org/Project/jythonc.html for alternatives to jythonc. Add '-i' to your invocation of jythonc to turn off this warning
processing test
Required packages:
Creating adapters:
Creating .java files:
test module
Compiling .java to .class...
Compiling with args: ['/usr/bin/javac', '-classpath', '/usr/share/java/jython.jar:/usr/share/java/servlet-api-2.4.jar:/usr/share/java/libreadline-java.jar:./jpywork::/usr/share/jython/Tools/jythonc:/usr/share/jython/Lib:/usr/lib/site-python:__classpath__', './jpywork/test.java']
0
rohit#rohit-laptop:~/backyard$
rohit#rohit-laptop:~/backyard$ cd jpywork/
rohit#rohit-laptop:~/backyard/jpywork$ ls
test.class test.java test$_PyInner.class
rohit#rohit-laptop:~/backyard/jpywork$ java test
Exception in thread "main" java.lang.NoClassDefFoundError: org/python/core/PyObject
Caused by: java.lang.ClassNotFoundException: org.python.core.PyObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: test. Program will exit.
rohit#rohit-laptop:~/backyard/jpywork$
Please suggest the correct way.
Jython will automatically compile it into .class file on first execution, however in case you want to compile it, you can use standard library, find py_compile.py or compileall.py on Jython lib folder.
$ java test # is not the exact command to execute the class file
this class file requires jython.jar file to execute you have to give the jython.jar path at the run time.
#java -cp /home/litindia/jython-2.0.1/jython.jar:. test
-cp is compulsory /home/litindia/jython-2.0.1/jython.jar is my path where is jython.jar is present in my system, your path may be different. so please give the appropriate path.
And after the path :. is compulsory. Then file name is required.
System properties:
Java 1.6
Mac OSX version 10
Ant 1.8
Scenario: I am working on my final year project which is to create a website which uses Lucene to search my website and my database. I am working through lucene demos here
http://lucene.apache.org/java/2_3_2/demo.html
which talks about classpath
http://lucene.apache.org/java/2_3_2/demo3.html and a web example
I have created a .bash_profile file in my home directory /Users/philhunter/ which sets my classpaths:
CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562_Project/lucene-3.0.3/lucene-core-3.0.3.jar
CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562_Project/lucene-3.0.3/lucene-demo-3.0.3.jar
CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562_Project/lucene-3.0.3/src/demo/org/apache/lucene/demo
When i try and run the commands it asks on the command line i am getting ClassDefNotFoundError:
Exception in thread "main" java.lang.NoClassDefFoundError: /Users/philhunter/Desktop/COM562_Project/lucene-3/0/3/src/demo/org/apache/lucene/demo/IndexHTML
Caused by: java.lang.ClassNotFoundException: .Users.philhunter.Desktop.COM562_Project.lucene-3.0.3.src.demo.org.apache.lucene.demo.IndexHTML
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
The command line command is:
java /Users/philhunter/Desktop/COM562_Project/lucene-3.0.3/src/demo/org/apache/lucene/demo/IndexHTML -create -index /Applications/MAMP/htdocs/
which should index my website files. That indexHTML file is a java file in that last classpath directory above. Anyone know why I am getting theat error!?
I think the path you're passing is the problem. Try adding the following to your bash script
cd /Users/philhunter/Desktop/COM562_Project/lucene-3.0.3/src/demo/
java org.apache.lucene.demo.IndexHTML -create -index /Applications/MAMP/htdocs/
The problem is that when you run
java /Users/philhunter/Desktop/COM562_Project/lucene-3.0.3/src/demo/org/apache/lucene/demo/IndexHTML
you are telling java run the class in the package Users.philhunter.Desktop.COM562_Project.lucene-3.0.3.src.demo.org.apache.lucene.demo.