How to use Jason with JEdit on Mac - java

I'm just starting out with Jason (agent-oriented language) and having problems running some code. It gives me the following error:
I'm pretty new to this so not really sure what to do next. This is the path information from Jason:
I can tell the problem is related to the path of the Java Home, but I don't know what to change it to. I'm using Mac by the way.
Any help is appreciated!

Regarding the problem of "The path to the jason.jar file (...) was not correctly set:...", in "Plugins -> Plugins Options -> Jason", you have to set the path to "jason-X.Y.jar" location. You pointed it to "jedit.jar", just change it to "/libs/jason-2.4.jar".
You also may be asked to fix ant path. In this case, point it to the folder "/libs".

Related

To which file path should I set my JAVA_HOME path?

I have two files in my 'usr/lib/jvm/' path namely "/usr/lib/jvm/java-1.8.0-openjdk-amd64" and "/usr/lib/jvm/java-8-openjdk-amd64". The icon on the "/usr/lib/jvm/java-1.8.0-openjdk-amd64" file is a folder with a black downward curving arrow. When I look at the properties of the "/usrlib/jvm/java-1.8.0-openjdk-amd64" file it says its 'Link target' is "/usr/lib/jvm/java-8-openjdk-amd64". What does that mean?
The reason I am asking is because I want to try to solve the KeyError: 'JAVA_HOME' I receive when importing jnius, which means I have to try the solution given at https://github.com/kivy/pyjnius/issues/209. The solution is to set the right path for 'JAVA_HOME'.
Tried
I noticed when I checked the -version of java in the terminal it only gave "/usrlib/jvm/java-1.8.0-openjdk-amd64". Does that mean that the 'JAVA_HOME' is this path or the other.
Which of the two file paths above is 'JAVA_HOME'?
You have found a symbolic link, which is usually shortened to "symlink".
If you're familiar with Windows, it's equivalent to a "shortcut". It's a tiny file that simply points to another file or directory.
You can run man ln in a terminal to read more about links (both symlinks and hard links).
Regarding your final question: they should be functionally equivalent at this point. I would recommend the shorter one (the symlink). That way, you won't have to update your environment variable if you install another jdk8 version (e.g. upgrade to 1.8.1, or choose another implementation with update-java-alternatives) in the future.

Matlab doesn't see .jar file

Ok, I'm stumped here. I'm using Matlab version 2013b with a Java RTE of 1.7.0_11 and I'm trying to run a simple piece of code to see if Matlab is able to read the .jar file and nothing seems to be working.
Here is the Java code, which is compiled to a .jar named JavaOCT.jar, which is placed in the Matlab working directory:
package VTK;
public class vtkVolumeView{
public int Test(){
return 10;
}
}
That is it, no other dependencies, nothing fancy. In Matlab, I try:
javaaddpath('\JavaOCT.jar'); %<-Directory and name are 100% correct
import VTK.*; %<-Package name from above
methodsview VTK.vtkVolumeView; %<-Can't find the class, argh!
Matlab kicks back that it can't find the class.
Things I've done to try and solve the problem:
Reverted to the exact same JDK as the Matlab RTE
Tried an older 1.6 JDK
Done lots of stack overflow research to try and solve it 1 2 3 4
Tried used javaclasspath and pointing to the compiled class instead
Read the Matlab documentation 5
Using clear -java after the javaaddpath
Any help would be appreciated, it is driving me nuts!
Update: Daniel R suggested just javaaddpath('JavaOCT.jar') which doesn't work either.
Final update: It finally works! I wasn't building the .jar properly. In IntelliJ, click on the project and hit F4. This brings up the Project Structure, then go to Artifacts and click the green + button and add DirectoryContent and then point to the out\production. Once this is done, as mentioned by others, it should show up in Matlab as an expandable .jar.
I don't know which operating system you are using, but the ./ seems invalid.
Try javaaddpath('JavaOCT.jar'); or javaaddpath(fullfile(pwd,'JavaOCT.jar'));.
What does exist(fullfile(pwd,'JavaOCT.jar')) return?
Some things to try:
Add the class file. When using a package, you need to add the class file in at the host of the package. For example, if your code is here:
\\full\path\to\code\VTK\vtkVolumeView.class
Then use:
javaaddpath('\\full\path\to\code')
I'm still suspicious of your *.jar path. You should usually use absolute paths when adding jar files. Try adding the results of which('JavaOCT.jar')
How did you make your jar file? Does it contain the appropriate directory structure implied by your package declaration?

An issue when trying to launch and deploy Jetty

I have an issue whenever I am trying to deploy Jetty on a specific machine (works with others), the machine is a non-English Windows machine.
[2013-02-15 04:14:05.894] [ERROR] Thread-39
System.err
java.lang.IllegalStateException: Cannot create tmp dir in
C:\Windows\system32\config\systemprofile\AppData\Local\Temp\ for
context o.e.j.w.WebAppContext{/spdy,null},C:\Program
Files\server\work\tmp\my-app\webapps\spdy.war
[2013-02-15 04:14:05.894] [ERROR] Thread-39
System.err
java.io.IOException: Žw’肳‚ꂽƒpƒX‚ªŒ©‚‚©‚è‚Ü‚¹‚ñB
I tried to see if this is an issue related to admin rights but it is not, I am launching the process with admin rights.
Any suggestions are really appreciated.
Thanks!
Was able to find the issue out. Jetty does not create the TEMP folder if it doesn't exist so you have to check yourself and create the temp folder if it is not there.
In this instance, it ended up being that:
C:\Windows\system32\config\systemprofile\AppData\Local\Temp\ does not exist although C:\Windows\system32\config\systemprofile\AppData\Local\ does and TEMP=C:\Windows\system32\config\systemprofile\AppData\Local\Temp\
Creating "Temp" directory in C:\Windows\system32\config\systemprofile\AppData\Local\ solved the issue!
This is pretty old post, but recently I had just the same problem, so I want to share my experience too.
Parts of the code causing the problem can be found here:
http://download.eclipse.org/jetty/stable-8/xref/org/eclipse/jetty/webapp/WebInfConfiguration.html#225, resolveTempDirectory (WebAppContext context) method (check last lines of the method, third case explained in the comments). So, another workaround for the problem can be also changing default java.io.tmpdir folder to point to an existing one.
I have already checked on some systems and C:\Windows\system32\config\systemprofile\AppData\Local\Temp folder doesn't exist on Windows: 7, 2008, 2012.

:: simple-jndi and relative path to config doesn'T work

My setting:
Environment
Ubuntu Linux 12.04 LTS
Eclipse Helios
GWT 2.4
Maven 2
simple-jndi
Project
dialoguemaps-domain (Java project folder)
-> src/main/resources/jndi.properties (simple-jndi configuration)
-> config/dialoguemaps.properties (data source configuration)
My problem:
If i use an absolute path in my jndi.properties file - it work's fine:
org.osjava.sj.root=/home/arno/.workspaces/dialoguemaps-trunk/dialoguemaps-domain/config/
But if i use a relative path it doesn't work:
org.osjava.sj.root=config/
I have to use an relative path, but how - what is the problem?
Thank you!
The problem is likely that your relative path isn't relative to what you think it is.
You don't show your error message, but it may contain the absolute path that simple-jndi was trying to resolve.
I think that you're going to have to determine what the absolute path really is, and configure that.
I know its 7 years past since the question is asked but I'm gonna answer it because I also had problem with configuration similar like yours. The best way to deal it it is to put a "." (dot) before "config". Something like:
org.osjava.sj.root=./config/
Console would alert you that it was unable to load class and then would write a path that it tried to load class something like:
[ERROR] ... Unable to load: C:\Users\name.surname\Desktop\appdirectory1\appdirectory2\appdirectory3\.\config
Then you just have to put a directories that are missing. For example I put:
#org.osjava.sj.root=./src/main/resources
and it works just fine.

JPL/SWI Prolog configuration failure

I'm configuring the JPL right now, and wanna work with swi-prolog using java.
I downloaded the newest stable version of SWI-Prolog, which is 6.2.0, and installed in D:\swipl
First, I added the following path to the PATH virable: D:\swipl\bin, which should include all dll files needed.
Then, I added the following path to the CLASSPATH virable: D:swipl\lib\jpl.jar, which should be the jar file needed.
When I tried to run the versions example provided, I got the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: jpl.fli.Prolog.thread_self()I
at jpl.fli.Prolog.thread_self(Native Method)
at jpl.Query.open(Query.java:286)
at jpl.Util.textToTerm(Util.java:162)
at jpl.Query.Query1(Query.java:183)
at jpl.Query.<init>(Query.java:176)
at Versions.main(Versions.java:11)
After searching online, I found that many people just get java.lang.UnsatisfiedLinkError: no jpl in java.library.path which is because of the setting for the PATH variable, rather than the error I get here: java.lang.UnsatisfiedLinkError: jpl.fli.Prolog.thread_self()I (and yes, there is a "I" at the end of the line).
Has anyone gotten this error before? I've tried several previous version of SWI-Prolog, but also got other kinds of errors. I'm using Eclipse IDE for Java development -- have I missed anything?
I've sent the problem to the official mailing list (swi-prolog#lists.iai.uni-bonn.de) provided by swi-prolog.org, and luckily someone helped me to prove that there are some problems in the version 6.2.0. We then both tried the version 6.0.2, and it works perfectly. He mentioned that (and I noticed that) there is no swipl.dll in the bin folder of the version 6.2.0, which MAY causes the issue.
I've already reported the issue to the staff via Email, and at least for now, I suggest that people who want to configure JPL should download the version 6.0.2. Three things to remember:
add a new variable SWI_HOME_DIR under system variables in environment variables, and set the path to the place where you installed the SWI-Prolog (Mine is D:\swipl);
Add the path %SWI_HOME_DIR%\bin to your PATH variable, rather than use something like "D:\swipl\bin". (Otherwise [FATAL ERROR: Could not find system resources] will occur)
Add the path %SWI_HOME_DIR%\lib\jpl.jar to your PATH variable, rather than use something like "D:\swipl\lib\jpl.jar". (Otherwise [FATAL ERROR: Could not find system resources] will occur)
If you are using Eclipse for Java development, it seems that you DO NOT need to configure in your IDE. As long as you follow the 3 steps above and add the correct jar file as an external library, it should be fine.
I'm not sure whether the temporary solution works for everyone, but definitely, everyone who has the issue should try this method first. As long as the issue in the version 6.2.0 has been figured out, I'll add some comments here.
BTW, as far as I know, until now, people who have the issue are using 32-bit Windows.
Try adding your path to java.library.path via Run > Run Configuration > [project name] and add the following under "VM Arguments" tab.
-Djava.library.path="D:\swipl\bin;."
Furthermore, under the "Environment" tab, add the following:
VARIABLE: PATH
VALUE: D:\swipl\bin;${env_var:PATH}
After that, go to Project > Properties > Java Build Path, select "Libraries" tab.
Click "Add External JARS.." and find your jpl.jar.
Great Great Great, second answer is the solution
create SWI_HOME_DIR variable to set the swi prolog instalation directory
SWI_HOME_DIR ------- C:\Program Files\swipl
set PATH to point to the library and bin like this
PATH ------ %SWI_HOME_DIR%\bin;%SWI_HOME_DIR%\lib\jpl.jar
This fix my problem "Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpl in java.library.path windows" it is a little bit rare but it works find.
I had the same problem. In addition to set the PATH, you need to verify if the installed SWI program has the same architecture (32 or 64) of your JVM.

Categories

Resources