🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.java
Article #153371

bsh

#153371
From: Wojciech Waga
Date: Sun, 08 Apr 2012 10:36
83 lines
3152 bytes
Jest program do ściągania map z różnych serwisów - MOBile Atlas Creator 
w postaci pliku *.jar.

Program ten pozwala na dodawanie własnych map w formacie bsh. Problem 
jest w tym, że pliki bsh są wczytywane jak MOBAC działa na Windows, 
natomiast pod Linuksem dostaję komunikat:

... Class: Scriptable not found in namespace ...

Zrobiłem minimalne wersje tych skryptów i wyglądają tak:

aa.bsh

addClassPath("/usr/share/java/js.jar");

import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;

name = "aa";

Scriptable f()
{
}

return;




bb.bsh

import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;

name = "bb";

Scriptable f()
{
}

return;


Co ciekawe jak wpiszę w bashu:

bsh aa.bsh to przechodzi bez problemu, MOBAC z kolei wypisuje dla tego 
pliku:

ERROR - Failed to load custom BeanShell map source "aa.bsh": Sourced 
file: inline evaluation of: ``addClassPath("/usr/share/java/js.jar"); 
import org.mozilla.javascript.Context;  . . . '' : Command not found: 
addClassPath( java.lang.String )
Sourced file: inline evaluation of: 
``addClassPath("/usr/share/java/js.jar");  import 
org.mozilla.javascript.Context;  . . . '' : Command not found: 
addClassPath( java.lang.String ) : at Line: 1 : in file: inline 
evaluation of: ``addClassPath("/usr/share/java/js.jar");  import 
org.mozilla.javascript.Context;  . . . '' : addClassPath ( 
"/usr/share/java/js.jar" )

Dla drugiego pliku (bez addClassPath) bsh i MOBAC pokazują to samo:

ERROR - Failed to load custom BeanShell map source "bb.bsh": Sourced 
file: inline evaluation of: ``import org.mozilla.javascript.Context; 
import org.mozilla.javascript.Scriptable; . . . '' : Class: Scriptable 
not found in namespace
Sourced file: inline evaluation of: ``import 
org.mozilla.javascript.Context; import 
org.mozilla.javascript.Scriptable; . . . '' : Class: Scriptable not 
found in namespace : at Line: 6 : in file: inline evaluation of: 
``import org.mozilla.javascript.Context; import 
org.mozilla.javascript.Scriptable; . . . '' : Scriptable


Plik jar dostarczający klasę Scriptable jest w bieżącym katalogu i 
dodatkowo w katalogu z klasami systemowymi. Ustawienie CLASSPATH na 
niego zarówno w Shellu jak i java -cp ./js.jar -jat Mobac.jar też nie 
pomaga.

Czy ktoś ma jakiś pomysł jak to poprawić?

pozdr.
w.
Technical Details
Message-ID: <jlrpnp$inh$1@news.icm.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!.POSTED!not-for-mail
From: Wojciech Waga <na@drzewo.pl>
Newsgroups: pl.comp.lang.java
Subject: bsh
Date: Sun, 08 Apr 2012 12:36:41 +0200
Organization: ICM, Uniwersytet Warszawski
Lines: 83
Message-ID: <jlrpnp$inh$1@news.icm.edu.pl>
NNTP-Posting-Host: 77-254-115-181.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: news.icm.edu.pl 1333881401 19185 77.254.115.181 (8 Apr 2012 10:36:41 GMT)
X-Complaints-To: usenet@news.icm.edu.pl
NNTP-Posting-Date: Sun, 8 Apr 2012 10:36:41 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit