I am having Aparapi translating Java code to OpenCL. However I wonder how I can see the generated OpenCL code. The website says "by using adding -Dcom.amd.aparapi.enableShowGeneratedOpenCL=true to your command line when you start your JVM". Being new to this technology, I am not sure how exactly you can do this? Can anyone please help by elaborating the process?
Added part:
Thank you. But what should I do in case of hadoop? I am trying to generate the OpneCL code for a hadoop program that I am running this way:
hadoop jar .java
I have tried adding -Dcom.amd.aparapi.enableShowGeneratedOpenCL=true before and after jar word, both did not work. Here is what I got.
Exception in thread "main" java.io.IOException: Error opening job jar: -Dcom.amd.aparapi.enableShowGeneratedOpenCL=true
at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.io.FileNotFoundException: -Dcom.amd.aparapi.enableShowGeneratedOpenCL=true (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:215)
at java.util.zip.ZipFile.(ZipFile.java:145)
at java.util.jar.JarFile.(JarFile.java:153)
at java.util.jar.JarFile.(JarFile.java:90)
at org.apache.hadoop.util.RunJar.main(RunJar.java:88)
Just add the property to the command line which you use to start java.
Specifically somewhere you have a command line like this
java -classpath yourpackage.YourApp
Just add the property like this
java -Dcom.amd.aparapi.enableShowGeneratedOpenCL=true -classpath yourpackage.YourApp
Related
Following this post, I am using the following steps to compile the parser/lexer from this repository:
export CLASSPATH=".:/usr/local/Cellar/antlr/<version>/antlr-<version>-complete.jar:$CLASSPATH"
antlr <grammarName>.g4 -o <someFolder>/
javac <someFolder>/<grammarName>*.java
but when I use the instructions here:
grun <someFolder>/<grammarName> tokens -tokens < <inputFile>
I get this error messages:
Exception in thread "main" java.lang.NoClassDefFoundError: IllegalName: <someFolder>/<grammarName>Lexer
at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:889)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:825)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:723)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:646)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at org.antlr.v4.gui.TestRig.process(TestRig.java:129)
at org.antlr.v4.gui.TestRig.main(TestRig.java:119)
I would appreciate if you could help me know what is the problem and how I can resolve it.
I don’t see where you’ve specified a package name, so now your Java classes are located in <someFolder>. Be sure to compile them in that folder.
Then you’ll need to add that folder to your classpath (probably instead of “.”)
Try adding <someFolder> into the CLASSPATH you’re exporting. Then leave it off of your grun command line.
Java will only load classes from the Classpath (it’s a security thing). When TestRig runs, it attempts to load your class by building the Java class name it would have produced for you Parser (and Java will have to find that class somewhere in the classpath).
Your could modify the grun alias to allow for you to specify a directory to search for your classes, and use the -cp option on the Java command, but that’s probably more trouble than just adding it to you classpath that you’re using for this testing.
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'm trying to use semantic vectors. Here are some links:
https://code.google.com/p/semanticvectors/wiki/InstallationInstructions
https://code.google.com/p/semanticvectors/
Anyway, I'm on the step where you input java pitt.search.semanticvectors.BuildIndex, but I'm lacking results.
The current part I'm following is "To Build and Search a Model".
I am able to compile the package successfully with the ant command and I did get the first step working with first setting the class path with:
export CLASSPATH=./lib/lucene-core-3.6.2.jar:./…
And then inputing
java org.apache.lucene.demo.IndexFiles -docs .
However with this next step I'm getting these errors:
user:/home/data/SemanticVectors/semant… java pitt.search.semanticvectors.BuildIndex
Exception in thread "main" java.lang.NoClassDefFoundError: pitt/search/semanticvectors/BuildIndex
Caused by: java.lang.ClassNotFoundException: pitt.search.semanticvectors.BuildIndex
at java.net.URLClassLoader$1.run(URLClassLo…
at java.security.AccessController.doPrivile… Method)
at java.net.URLClassLoader.findClass(URLCla…
at java.lang.ClassLoader.loadClass(ClassLoa…
at sun.misc.Launcher$AppClassLoader.loadCla…
at java.lang.ClassLoader.loadClass(ClassLoa…
Could not find the main class: pitt.search.semanticvectors.BuildIndex. Program will exit.
I am using a terminal on a mac OS X
As I see your post, it appears you are not providing a path to the semanticvectors-x.x.jar file as indicated in
export CLASSPATH=./lib/lucene-core-3.6.2.jar:./…
Once this change is done, it should work.
Please go easy on me. I just started linux and hadoop at the same time. I have almost zero experience with linux and a complete beginner with hadoop.
I downloaded the file hadoop-1.1.1-bin.tar.gz from here:
http://www.motorlogy.com/apache/hadoop/common/hadoop-1.1.1/
I was able to unpack it.
I am following a tutorial that tells me to run:
bin/hadoop jar hadoop-*-examples.jar
I am getting this error:
agordon#Ubuntu32:/hadoop/hadoop-1.1.1$ bin/hadoop jar hadoop-*-examples-1.0.3.jar
Exception in thread "main" java.io.IOException: Error opening job jar: hadoop-*-examples-1.0.3.jar
at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.io.FileNotFoundException: hadoop-*-examples-1.0.3.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.jar.JarFile.<init>(JarFile.java:152)
at java.util.jar.JarFile.<init>(JarFile.java:89)
at org.apache.hadoop.util.RunJar.main(RunJar.java:88)
What am i doing wrong? thank you for your guidance.
Instead of hadoop-*-examples.jar use the full name of the jar file.
I'm using the JDK 3.1. I am using XML Publisher. I'm getting this error:
Could not find the main class. Program will exit.
After I click on "OK", I get
Java execution failed. Please check the Java Option in the option dialog
Sounds like you're trying to execute .jar file and there's no Main-Class entry in the manifest file. Other than that obvious point, your question does not give much information for assistance.
Your question is tricky to understand, but I'm guessing that you haven't actually compiled your Java code, or your compiled code isn't on the classpath.
When I try and execute a non-existent class (this would work if there was a MyClass.class on the classpath with a main() method):
paul#paul-laptop:~$ java MyClass
Exception in thread "main" java.lang.NoClassDefFoundError: MyClass
Caused by: java.lang.ClassNotFoundException: MyClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: MyClass. Program will exit.
Is that what you're seeing? If so:
compile your class with javac if you haven't done so
check that your classpath includes the location of the class
(You can specify the classpath explicitly when you execute the java program using -classpath, check the documentation for details.)
I include this answer as someone who has made an error someone consuming java rather than programming in it would make:
On the command line when executing a JAR file, be sure your line reads
java -jar whatever.jar
instead of
java whatever.jar
Without the -jar you sometimes get the "Could not find the main class" error.
Here are some good answers What does "Could not find or load main class" mean?
But, I will share one possibility I had. I used the JDK1.7 to compile my code and run the jar package using the JDK1.6, the error is:
Could not find the main class. Program will exit.
So, check if the JDK version you used to run your code is lower than that used to compile your code.
Check this website: "Could not find main class" error when previewing BI Publisher for Word. It directly references Java issues with Oracle BI Publisher Plugins for Word.
It basically says that you need to set your Java Home by going to Options in the BI Publisher Tab in the MS Office Ribbon.