I am trying to run weka on linux server.
The steps I followed as listed below:
1. I download a zipped archive containing Weka as given on http://www.cs.waikato.ac.nz/ml/weka/downloading.html
I then unzipped the zip file.
I next tried executing weka.jar using the command:
java -Djava.awt.headless=true -jar weka.jar
I also simply tried: java -jar weka.jar
This also gives me errors.
I have set the DISPLAY variable using setenv DISPLAY localhost:0.0.
I have tried other values too such as DISPLAY 0
weka.jar has also been added to the PATH variable.
The error I am getting is as follows:
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.Window.<init>(Window.java:433)
at java.awt.Frame.<init>(Frame.java:403)
at javax.swing.JFrame.<init>(JFrame.java:202)
at weka.gui.LogWindow.<init>(LogWindow.java:252)
at weka.gui.GUIChooser.<clinit>(GUIChooser.java:215)
Could not find the main class: weka.gui.GUIChooser. Program will exit.
Any help would be appreciated.
Thank You
Perhaps you need to add the CLASSPATH. For example:
java -cp "$CLASSPATH:./weka.jar" -Xmx500m weka.gui.explorer.Explorer
Google told me to run this command :
sudo apt-get install openjdk-6-jre
When I did as following, it worked.
Extract weka.jar to directoy named weka.
Write a script runWeka.sh:
#! /bin/bash
WEKA_HOME="~/weka";
java -classpath $WEKA_HOME weka.gui.Main
Run this script.
Related
I wrote a little java program and now I want to execute this .jar file from a .sh script.
my script:
#! /bin/bash
java -jar /var/spool/sms/sentSMS.jar
then i run the command: sudo bash sentSMS.sh
an get following error:
ERROR: Unable to access jarfile /var/spool/sms/sentSMS.jar
I am using a Raspberry with raspian-jessie, if this important to solve it.
Sorry, but I'm new in scripting with linux.
Take into account that the user must have at least READ permissions on that file.
Also, as you say you are new in linux, make sure the name is correct. sentSMS.jar is different from sentsms.jar
i'm new with java.
when i come to run my java app i'm getting this error below:
java.lang.NoClassDefFoundError: org/apache/poi/EncryptedDocumentException
the issue it is ALSO happens when i'm adding the classpath to my command:
java -jar myApp.jar -classpath .\lib
BUT,
when i'm copy myApp.jar to the lib direcotry and running form there it's working fine.
thanks for the help guys.
You cannot use both -jar and -classpath at the same time. If you use -jar, it will ignore your -classpath and use settings from the manifest in the jar. Try all in the classpath:
java -cp myApp.jar:lib/*:. mypackage.MyClass
On Windows you need to use ';' instead of ':'
java -cp myApp.jar;lib/*;. mypackage.MyClass
See similar question here: Execute jar file with multiple classpath libraries from command prompt
I have Windows7 OS and want to use MEKA GUI what I did is the following:
downloading meka-release1.5.zip from http://sourceforge.net/projects/meka/files/meka-1.5.0/
extracting it, and type run.bat in cmd.exe
But I had the following Error :
Error: Could not find or load main class .\lib\Jama.jar
Can any one help with clear steps how to install and use MEKA EXplorer?
Suppose you have unzipped it into c:\tmp\meka\, so you have c:\tmp\meka\run.bat, you can:
open a shell (cmd.exe)
go inside your tmp dir: cd c:\tmp\meka\'
call .\run.bat'
You should at least use a JRE >= 6, because the script is using the star notation in order to list the Jars:
#ECHO OFF
SET MEMORY=512m
SET MAIN=meka.gui.explorer.Explorer
java -Xmx%MEMORY% -cp ".\lib\*" %MAIN% %1
I did have the same problem, only way to fix was adding all jar files to the -cp option
java -Xmx%MEMORY% -cp "lib\Jama.jar;lib\junit.jar;lib\meka-1.5.jar;lib\moa.jar;lib\mst.jar;lib\mulan.jar;lib\weka.jar;lib\weka-test.jar" %MAIN% %1
I have downloaded RoboMind (http://robomind.net) and try to make it run on a Linux Mint12
Knowing that Min12 is not the newest release, I still would like it to run...
When I use the .sh file that comes in the pack I get an error:
"Unable to access jarfile ..."
if I type the exact same command at the same prompt, in the same directory, it works:
here is a copy paste from the commanline:
magnus#martin-HP-625 ~/Downloads/RoboMind $ ./robomind.sh
Unable to access jarfile RoboMind.jar
magnus#martin-HP-625 ~/Downloads/RoboMind $ cat ./robomind.sh
java -jar -Djava.ext.dirs=lib -Dsun.java2d.ddscale=true -Dsun.java2d.noddraw=true RoboMind.jar
magnus#martin-HP-625 ~/Downloads/RoboMind $ java -jar -Djava.ext.dirs=lib -Dsun.java2d.ddscale=true -Dsun.java2d.noddraw=true RoboMind.jar
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1076)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1053)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1347)
at robo.RoboMind.startGui(RoboMind.java:168) ... <snip>
Now it works ... ?
Whats the difference?
I messed around with javapath etc. as suggested in other posts, but nothing makes any difference to the situation illustrated above.
Why can't the .sh script find the .jar file when the exact same command at the prompt have no problems?
I'll give you the "solution", and I will let you discover "why".
Just launch:
# dos2unix robomind.sh
..after then it will work. If you do not have dos2unix installed, apt-get install dos2unix
I made a program which runs fine on windows. When I moved it over to CentOS, I got this error:
Error: Could not find or load main class org.wbc.WBCController
This is the file setup and .sh on linux:
And this is the file setup and .bat on windows:
Does anybody know what the problem is, and how I can fix it?
Java will respond with this error even if it cannot find the file wbc.jar. I am guessing that that is your problem. You might want to see that your are executing the shell script from within the right working directory.
Check to see if you can run wbc.sh from the console or put this in wbc.sh to make sure it searches for the jar in the same directory as the shell script:
#!/bin/sh
java -cp `dirname $0`/wbc.jar org.wbc.WBCController