MINERVA + Gui + Java Library + Own Library as Standalone and Applet...
Move to
=> <=
Darueber Spitze
See also
HelloWorld
Use Parameters
Directives
Debugger
Arithmetic
Constraints
File From Server
AppletLoadsFile
GetURL
Client-Server with Sockets
Date
ExecProcess
ExecProcess_2
GUI
GuiEvents
Gui Image
Interactive
JavaToMinerva_1
JavaToMinerva_2
JavaToMinerva_3
JavaToMinerva_4
JavaToMinerva_5
JavaToMinerva_6
Java Applet Uses Minerva
JavaArrays
MinervaToJava
MinervaToJavaScript
MinervaToJava_1
MinervaToJava_2
MinervaToJava_3
MinervaToJava_4
Reflection
Servlet
JDBC
Internationalization
StartupArchive
IF Computer > MINERVA > Example Programs > MINERVA Features > MinervaToJava_4

MinervaToJava_4

MINERVA + Gui + Java Library + Own Library as Standalone and Applet

This example shows

  • how to extend MINERVA including GUI with both Java internal classes and your own programs

  • how to produce library packages for MINERVA
  • how to compile and statically link the extensions
  • how to execute this as standalone and applet
  • how to handle security exceptions
  • how to use 'catch/3'

The declaration of the extension for the Java library is property.mxt

The declaration of the extension for the own library is mystuff.mxt

The applet wrapper is wrap.html

The top level MINERVA source program is example4.min

Refer to 'Compile', 'Go' and the other files of this directory for details.

Questions? Problems? Feedback? Please let us know! mailto:support@ifcomputer.com

% MINERVA (c) IF Computer 1996,97

% http://www.ifcomputer.com/MINERVA mailto:support@ifcomputer.com % file: example1.min

:- package(gui). :- package(mystuff). :- package(property).

main(Applet, Args) :- textArea_create(16, 60, OutputWindow), textComponent_setEditable(OutputWindow,false), container_add(Applet, 'Center', OutputWindow), textArea_getOutputStream(OutputWindow, Output), set_output(Output), set_error(Output), run_add3, property(Args).

run_add3 :- write('add3(10,11,12) returned: '), add3(10,11,12,X), writeq(X), nl, flush_output.

property(Args) :- write(Args),nl,flush_output, p(system_getProperties(_)), p(system_getProperty('my.parameter',unknownParam,_)), p(system_getProperty('java.version',_)), p(system_getProperty('java.vendor',_)), p(system_getProperty('java.vendor.url',_)), p(system_getProperty('java.home',_)), p(system_getProperty('java.class.version',_)), p(system_getProperty('java.class.path',_)), p(system_getProperty('os.name',_)), p(system_getProperty('os.arch',_)), p(system_getProperty('os.version',_)), p(system_getProperty('file.separator',_)), p(system_getProperty('path.separator',_)), p(system_getProperty('line.separator',_)), p(system_getProperty('user.name',_)), p(system_getProperty('user.home',_)), p(system_getProperty('user.dir',_)), !.

p(Goal) :- catch(Goal,AnyError,sorry(Goal,AnyError)), writeq(Goal), nl, flush_output, !.

sorry(Goal,AnyError) :- println(['Oooops: ', quoted(Goal)]), println(['caused: ', quoted(AnyError)]), flush_output.

#!/bin/sh

CLASSPATH=.:$MINERVA_HOME:$CLASSPATH export CLASSPATH

mjavac AddTest.java minervax -gui -f MinervaGuiExtended -c PackageProperty property minervax -f Dummy -c PackageMystuff mystuff

mjavac PackageProperty.java mjavac PackageMystuff.java

rm tmp.java mv MinervaGuiExtended.java tmp.java

minervac extend minerva -l extend tmp.java MinervaGuiExtended.java

rm tmp.java

mjavac MinervaGuiExtended.java

cp -p MinervaGuiExtended.class $MINERVA_HOME/userclasses cp -p PackageProperty.class $MINERVA_HOME/userclasses cp -p PackageMystuff.class $MINERVA_HOME/userclasses cp -p add3.class $MINERVA_HOME/userclasses

minervac example4

% MINERVA (c) IF Computer 1996,97 % http://www.ifcomputer.com/MINERVA mailto:support@ifcomputer.com

% add3(+Integer,+Integer,+Integer,-Integer) <- java_predicates('AddTest', [ add3 = add3(int,int,int) ]).

// add3 adds three integers and returns the result public class AddTest { public static int add3(int a, int b, int c) { return a + b + c; } }

% MINERVA (c) IF Computer 1996,97 % http://www.ifcomputer.com/MINERVA mailto:support@ifcomputer.com

% PropertyExtension--------------------------------------------

java_predicates('java.util.Properties', [ create_properties = 'Properties', properties_getProperty = getProperty(string,string), properties_getProperty = getProperty(string), properties_propertyNames = propertyNames, system_getProperty = getProperty(string,string) ]).

java_predicates('java.lang.System', [ system_getProperty = getProperty(string), system_getProperties = getProperties ]).

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Sprache
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/ExamplePrograms/MinervaFeatures/MinervaToJava_4/home_de.html
published 2008/9/1 update 2001/3/22 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS