I downloaded mpj-v0_44 and extracted it to C:\mpj
Put Windows system env. variables MPJ_HOME to C:\mpj and in PATH added value C:\mpj\bin
I added mpi.jar, mpj.jar in Project Structure -> Libraries
and wrote simple helloworld mpi program:
import mpi.MPI;
public class Main {
public static void main(String[] args) {
MPI.Init(args);
int me = MPI.COMM_WORLD.Rank();
int size = MPI.COMM_WORLD.Size();
System.out.println("Hello world from <"+me+"> of <"+size+">");
MPI.Finalize();
}
}
I created run configuration described on picture:
But I get the following error:
MPJ Express (0.44) is started in the multicore configuration
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at runtime.starter.MulticoreStarter$1.run(MulticoreStarter.java:281)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: 0
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
... 6 more
I found similar problems in eclipse posted but none solution worked:
java.io.FileNotFoundException: null\conf\wrapper.conf (The system cannot find the path specified)
"Unresolved compilation problems" from running MPJ express in Eclipse Indigo
In Eclipse everything works fine but I need Intellij IDEA!
PS:
(if you need javadoc add whole C:\mpj\lib folder and C:\mpj\src folder for library sources)
You need to change the main class to
"runtime.starter.MPJRun"
and VM options to include your main class
"-jar $MPJ_HOME$\lib\starter.jar nz.geek.colin.mpj.Main -np 4"
This is because MPJExpress runs and then loads your program in order to create multiple processes.
If IntelliJ complains about runtime.starter.MPJRun not found you can ignore it but if the warning bothers you you can add the starter.jar to the project.
Related
I have simple gradle project created on my desktop in Intellij IDE. Everything seems to be alright there. I can run my application by right-clicking in it's context and choosing option Run 'MyClass.main()'. After finishing my work on this project I pushed it to my github and tried to import it to my laptop, so I can show it on university. There was no problem with importing but when I tried run it, I get following exception:
"C:\Program Files\Java\jdk1.8.0_66\bin\java" -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_66\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\rt.jar;F:\io_evolutions\io_evolutions\build\classes\main;F:\io_evolutions\io_evolutions\build\resources\main;C:\Users\Bartosz Sądel\.gradle\caches\modules-2\files-2.1\org.uncommons.maths\uncommons-maths\1.2.1\cc1d4ec8abf49e86080670d062575f43009f7d82\uncommons-maths-1.2.1.jar;C:\Users\Bartosz Sądel\.gradle\caches\modules-2\files-2.1\org.uncommons.watchmaker\watchmaker-swing\0.7.1\1f72e93816b5638f892dd0e1a98be7a5b3ffe605\watchmaker-swing-0.7.1.jar;C:\Users\Bartosz Sądel\.gradle\caches\modules-2\files-2.1\jfree\jcommon\1.0.16\376f19a7c317509a57dfc684cdfd4081db7c082c\jcommon-1.0.16.jar;C:\Users\Bartosz Sądel\.gradle\caches\modules-2\files-2.1\jfree\jfreechart\1.0.13\b5fbdc552c4caec3dac4b4dcbc10d119a194946e\jfreechart-1.0.13.jar;C:\Users\Bartosz Sądel\.gradle\caches\modules-2\files-2.1\com.google.collections\google-collections\1.0\9ffe71ac6dcab6bc03ea13f5c2e7b2804e69b357\google-collections-1.0.jar;C:\Users\Bartosz Sądel\.gradle\caches\modules-2\files-2.1\org.uncommons.watchmaker\watchmaker-framework\0.7.1\5e8b088427e972bdf4b5649a2d2dd39ed27197f2\watchmaker-framework-0.7.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain pl.agh.edu.evolution.experiment.EMASApplet
Exception in thread "main" java.lang.NoClassDefFoundError: org/uncommons/watchmaker/swing/AbortControl
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethod(Class.java:2128)
at java.awt.Component.isCoalesceEventsOverriden(Component.java:6220)
at java.awt.Component.access$500(Component.java:186)
at java.awt.Component$3.run(Component.java:6174)
at java.awt.Component$3.run(Component.java:6172)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Component.java:6171)
at java.awt.Component.<init>(Component.java:6140)
at java.awt.Container.<init>(Container.java:283)
at java.awt.Panel.<init>(Panel.java:64)
at java.awt.Panel.<init>(Panel.java:56)
at java.applet.Applet.<init>(Applet.java:65)
at javax.swing.JApplet.<init>(JApplet.java:131)
at pl.agh.edu.evolution.experiment.AbstractExampleApplet.<init>(AbstractExampleApplet.java:26)
at pl.agh.edu.evolution.experiment.EMASApplet.<init>(EMASApplet.java:35)
at pl.agh.edu.evolution.experiment.EMASApplet.main(EMASApplet.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: org.uncommons.watchmaker.swing.AbortControl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 23 more
Process finished with exit code 1
I get the same error on every other project run in Intellij on my laptop. It's the first time I'm trying to run application in Intellij after upgrading system do Windows 10. Is there some configurations which may cause this problem? I don't remember I had to set up anything to run it on desktop (Windows 8.1) but I may have forgotten.
I'm trying to make a Java program that can communicate with JavaDB. I've made the Database class, started a server and made a tiny client program to check if they would communicate.
The program crashes when i try to run it, giving a class not found exception at the line where i try to set the database driver. I googled it and found that this error appears if derbyclient.jar and derby.jar are not found in the classpath. I also read that the scripts setNetworkClientCP and setNetworkServerCP found in the db directory would set these in the classpath. I found the scripts, ran them, and checked to make sure the classpath got updated, but i still get the same error. Does anyone know what the problem might be?
EDIT: SOLVED - i just realized that i need to include the derbyclient.jar in the NetBeans project library.
I'm using NetBeans and the built in JavaDB. I set the classpath by using the scripts that i mentioned above, and upon checking the classpath i found these entries:
%DERBY_INSTALL%\lib\derbyclient.jar;
%DERBY_INSTALL%\lib\derby.jar;
%DERBY_INSTALL%\lib\derbytools.jar;
%DERBY_INSTALL%\lib\derbynet.jar;
The Error:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at Database.<init>(Database.java:14)
at TestKlient.main(TestKlient.java:8)
I am using Spoon tool of Pentaho data integration for long and it was working fine on my system. But since i moved it to /opt I am unable to run again . I have Oracle Java 8 installed on my system and each time try to run it i am end up with following exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getMethod0(Class.java:2937)
at java.lang.Class.getMethod(Class.java:1771)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:149)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Composite
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more
please help me to resolve this error i haven't found any solution yet
I found a solution to this problem I have removed all hidden directories generated by Kettle as well as its copy from /opt . Then I have extracted new version copy . after that I have added /opt/data-integration to my path variable and I have tried to run it from my home . Although it was not a successful run but it has generated all those dependent hidden folders required to run it . then I have to go to that directory by issuing
cd /opt/data-integration
and then I was successful to run it by issuing
sh spoon.sh
I have to go to that directory because Pentaho developers has set it so by placing relative path to launcher folder in their main command at spoon.sh.
I stumbled upon a weird error while using JDBC sqlite with org.sqlite.JDBC
my code compiles and runs fine on Windows.
But when I tried moving it to Ubuntu it started showing this:
Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at mall.SQLiteJDBC.<init>(SQLiteJDBC.java:27)
at mall.AllegroReader.<init>(AllegroReader.java:33)
at mall.Mall.main(Mall.java:31)
I'm running it with java -classpath "sqlite-jdbc-3.7.2.jar" -jar Mall.jar" and java -classpath "sqlite-jdbc4-3.8.2-SNAPSHOT.jar" -jar Mall.jar
with both versions in the same directory as my jar and I've tried a dozen different options specifying classpath and it behaves exactly the same. I tried openjdk and oracle jdk.
I tried rebuilding it on Ubuntu, changing ant .xmls, changing paths, etc.
I have no idea what is going on. Pls help.
Here is what happens inside my dist directory:
work1#workwork:/var/www/mall/dist$ ls
mall.db Mall.jar Mall.jar.old sqlite-jdbc-3.8.4.3-SNAPSHOT.jar
work1#workwork:/var/www/mall/dist$ java -classpath "sqlite-jdbc-3.8.4.3-SNAPSHOT.jar:Mall.jar" Mall
Error: Could not find or load main class Mall
The classpath is ignored when you use -jar.
You have to either include the dependencies in the jar (or at least have the jar manifest point to them), or run it with -classpath sqlite.jar:Mall.jar the.main.class.
Error: Could not find or load main class Mall.main. all files are there,
my main class comes from Mall.java and is in mall package which
compiles to Mall.jar
So the correct command line is:
java -classpath "sqlite-jdbc-3.8.4.3-SNAPSHOT.jar:Mall.jar" mall.Mall
OP findings
to view the classes in jar use jar tf Mall.jar - from this I got mall/Mall.class meaning my class containing main was mall.Mall
it showed
mall/Mall.class
so I should have used mall.Mall as the class to run (instead of pulling my hair)
After spending over 6 hours total with many failed attempts at running "portable" jar package using classpath and whatnot, after having tried OneJar and jarjar to no avail (ended up with Class file too large!) I decided to write the offending piece of code in PHP.
It proved to be more portable than Java in my case.
I'd like to run WsImport directly with the java command. I'm using the following command (with CLASSPATH environment set up):
$ java com.sun.tools.ws.WsImport -d /home/bence/NetBeansProjects/WebFormsTest/build/generated-sources/jax-ws -Xendorsed -keep -B-jaxb-facets -wsdl -r /home/bence/NetBeansProjects/WebFormsTest/build/generated-sources/jax-ws/resources -s /home/bence/NetBeansProjects/WebFormsTest/build/generated-sources/jax-ws -verbose org.czentral.test.service.AdminService
And get the error message in the title. With all the details:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/xjc/Plugin
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1058)
at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at com.sun.istack.tools.MaskingClassLoader.loadClass(MaskingClassLoader.java:82)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:363)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at com.sun.tools.xjc.Options.findServices(Options.java:952)
at com.sun.tools.xjc.Options.getAllPlugins(Options.java:374)
at com.sun.tools.xjc.Options.parseArgument(Options.java:692)
at com.sun.tools.ws.wscompile.WsimportOptions.parseArguments(WsimportOptions.java:326)
at com.sun.tools.ws.wscompile.WsimportOptions.parseArguments(WsimportOptions.java:232)
at com.sun.tools.ws.wscompile.WsimportTool.parseArguments(WsimportTool.java:359)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:193)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.tools.ws.Invoker.invoke(Invoker.java:135)
at com.sun.tools.ws.WsImport.main(WsImport.java:57)
Ok, this far a reasonable explanation would be a missing .jar from classpath. But I actually have the right jar, which is confirmed with the following:
$ java com.sun.tools.xjc.Plugin
Error: Main method not found in class com.sun.tools.xjc.Plugin, please define the main method as:
public static void main(String[] args)
So the classloader actually can load the class.
What condition can result in an error like this?
This is a platform specific issue. Code was compiled in a platform resulting in a platform specific jar, and then, although the class and the jar exist in your classpath, java does not recognize it.
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time.
Read more at: http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html#ixzz2ILpyqUVe