View unanswered posts | View active topics It is currently Mon Apr 15, 2024 11:30 pm



Reply to topic  [ 11 posts ] 
 WeaponM Script Locations? 
Author Message
Civilian

Joined: Sat Mar 02, 2013 4:01 am
Posts: 0
Unread post WeaponM Script Locations?
I would like to start using Weapon M, but it seems that it is unable to find the scripts folder. I've included a screenshot below. I assume since Weapon M is suppose to sense which directory it is running, that it is unable to do that on my system for some reason. Any ideals?

Screenshot:
https://docs.google.com/file/d/0B5DtADt ... sp=sharing


OS Version:
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal


Java version:
Package: openjdk-7-jre
Status: install ok installed
Priority: optional
Section: java
Installed-Size: 690
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: openjdk-7
Version: 7u15-2.3.7-0ubuntu1~12.10


Sat Mar 02, 2013 4:14 am
Profile
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: WeaponM Script Locations?
Weapon M has a somewhat hidden config file. Where it is depends on where Java preferences files are stored on your particular OS. Wherever it is, it will be a text file that you can edit. The default script location is a relative path, so it's relative to the working directory when you start the program. But you can change it to an absolute path. In fact, if the classloader builder from the javautil library works the way I think it does, the script location should work like a classpath. You could have multiple script directories, or even scripts inside jar files.

I really need to make a UI for those settings. I finally had a chance to fix a few things this weekend, so hopefully I can fit that in today.

_________________
Suddenly you're Busted!


Sun Mar 03, 2013 11:42 am
Profile WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: WeaponM Script Locations?
Here's where it is on Linux, and what it contains:

Code:
kevin@aphrodite:~$ cat .java/.userPrefs/krum/weaponm/prefs.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<map MAP_XML_VERSION="1.0">
  <entry key="AutoLoadScripts" value=""/>
  <entry key="BufferLines" value="10000"/>
  <entry key="GiantFont" value="false"/>
  <entry key="LookAndFeel" value="Nimbus"/>
  <entry key="ScriptClasspath" value="./scripts"/>
</map>

_________________
Suddenly you're Busted!


Sun Mar 03, 2013 11:45 am
Profile WWW
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: WeaponM Script Locations?
I've been playing with your version of weapon-m mongoose. and built it using eclipse. I found that when i loaded the jar i built initially and loaded a database. the scripts in the directory show up that I placed in there. however when i press reload scripts. they all disappear.

on another note. i've tried to run WeaponM in eclipse and find that it tells me that this:

Code:
18:39:32.753 [AWT-EventQueue-0] INFO  krum.weaponm.WeaponM - Weapon M started Tue Mar 05 18:39:32 PST 2013
18:39:32.919 [AWT-EventQueue-0] INFO  krum.weaponm.script.ScriptManager - searching for scripts in /Users/jamesgoudie/.weaponm/scripts
java.lang.UnsupportedClassVersionError: tweety/data/FindPorts : Unsupported major.minor version 51.0
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
   at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
   at krum.weaponm.script.ScriptManager.findScriptClasses(ScriptManager.java:471)
   at krum.weaponm.script.ScriptManager.<init>(ScriptManager.java:67)
   at krum.weaponm.WeaponM.<init>(WeaponM.java:42)
   at krum.weaponm.WeaponM$1.run(WeaponM.java:72)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:708)
   at java.awt.EventQueue.access$400(EventQueue.java:82)
   at java.awt.EventQueue$2.run(EventQueue.java:669)
   at java.awt.EventQueue$2.run(EventQueue.java:667)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:678)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


which i don't quite understand. since the scripts are built using the weaponm project and others brought in from svn. i have the projects added in project settings for my tradewars scripts project. so you would think that it would compile with the latest versions and be compatible. i even rand clean all projects to rebuild them all. and removed the old class files.


Tue Mar 05, 2013 9:42 pm
Profile
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: WeaponM Script Locations?
That seems to indicate that your scripts were compiled with a newer version of Java than you're currently running. Version 51 is Java 7. When you say you cleaned and rebuilt everything, did that include your scripts?

_________________
Suddenly you're Busted!


Tue Mar 05, 2013 10:08 pm
Profile WWW
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: WeaponM Script Locations?
yeah, scripts were rebuilt too.

james-goudies-imac:~ jamesgoudie$ javac -version
javac 1.7.0_10
james-goudies-imac:~ jamesgoudie$ java -version
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
james-goudies-imac:~ jamesgoudie$


Tue Mar 05, 2013 11:09 pm
Profile
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: WeaponM Script Locations?
I fixed the script reload problem.

Eclipse may be running in a different JVM than the one you get on the command line. Open Help > About Eclipse Platform, click the Installation Details button, and then the Configuration tab. Look for the "eclipse.vm" and "java.version" properties.

_________________
Suddenly you're Busted!


Wed Mar 06, 2013 1:10 am
Profile WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: WeaponM Script Locations?
The more I think about it, the more I think that's probably the issue. See http://stackoverflow.com/questions/1642 ... only-a-jre.

If you can confirm that this is the problem, I'll update my building document to warn people about it and recommend always compiling scripts to target 1.6, especially if they are to be shared. I should also handle that UnsupportedClassVersionError more gracefully. Perhaps I can even do like SWATH does and compile scripts in-app.

Thanks for the bug reports!

_________________
Suddenly you're Busted!


Wed Mar 06, 2013 10:03 am
Profile WWW
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: WeaponM Script Locations?
alright. you guys were right

I found I was building in 1.7

and then noticed that i was running it in 1.6 environment.

so i changed some settings in my properties as such:

in Java properties in Eclipse i set compiler compliance level to 1.7.
rebuilt all projects.

I also right clicked the weaponm project and went to run as... selected run configurations, selected the JRE tab and changed runtime JRE to execution environment: Java SE 7 (MacOS X default)

so that made it run using jdk1.7.0_09.jdk instead of 1.6 jdk


Wed Mar 06, 2013 7:03 pm
Profile
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: WeaponM Script Locations?
Glad you got it sorted. Anyway, you exposed something that I need to handle and document better, which is great.

_________________
Suddenly you're Busted!


Wed Mar 06, 2013 8:56 pm
Profile WWW
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: WeaponM Script Locations?
on my mac the Java preferences are located at:

/Users/username/Library/Preferences/com.apple.java.util.prefs.plist

where username is your logged in user name.. you then just open up the plist file. i use xcode to view it. i then select krum and then edit the AutoLoadScripts section. make sure you put the whole package description such as:

tweety.general.Online

which would load my Online script ever time a database is loaded into the script manager. and its where the scripts directory is specified.


Thu Mar 07, 2013 1:35 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.