errore: java.lang.reflect.invocationtarget

Csp85

Nuovo Utente
4 Mar 2013
7
0
0
salve, ho creato un'applicazione java con eclipse, questa funziona sia se la lancio da eclipse si esternamente, ora voglio integrarla in una pagina html, ma mi da questo errore:

java.lang.reflect.invocationtarget

come posso risolverlo??????

Grazie anticipatamente

Il Codice della mia applicazione è il seguente :
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.lang.reflect.InvocationTargetException;

import javax.swing.*;
//import javax.swing.JFileChooser;

import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.ontology.ProfileRegistry;
import com.hp.hpl.jena.ontology.Restriction;
import com.hp.hpl.jena.rdf.model.*;


public class CreaOnto extends JApplet {



public JFrame frame;
public JTextField textField;
public JTextField textField_2;
public JTextField textField_1;
public JTextField textField_3;
public JTextField textField_4;
public JLabel lblPrimaValore;
public JLabel lblSecondoValore_1;
public JButton btnChiudi;
private String fn;
private String sn;
/**
* Launch the application.
* @throws InterruptedException
* @throws InvocationTargetException
*/

public static void main(String[] args) throws InvocationTargetException, InterruptedException {
EventQueue.invokeAndWait( new Runnable() {
public void run() {
try {
CreaOnto window = new CreaOnto();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the application.
* @return
*/
public CreaOnto() {
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SpringLayout springLayout = new SpringLayout();
frame.getContentPane().setLayout(springLayout);

textField = new JTextField();
textField.setText(" ");
springLayout.putConstraint(SpringLayout.NORTH, textField, 10, SpringLayout.NORTH, frame.getContentPane());
springLayout.putConstraint(SpringLayout.EAST, textField, -85, SpringLayout.EAST, frame.getContentPane());
frame.getContentPane().add(textField);
textField.setColumns(10);

textField_2 = new JTextField();
textField_2.setText(" ");
springLayout.putConstraint(SpringLayout.NORTH, textField_2, 6, SpringLayout.SOUTH, textField);
springLayout.putConstraint(SpringLayout.EAST, textField_2, 0, SpringLayout.EAST, textField);
frame.getContentPane().add(textField_2);
textField_2.setColumns(10);

JLabel lblPrimoValore = new JLabel("Primo Valore");
springLayout.putConstraint(SpringLayout.NORTH, lblPrimoValore, 0, SpringLayout.NORTH, textField);
springLayout.putConstraint(SpringLayout.WEST, lblPrimoValore, 65, SpringLayout.WEST, frame.getContentPane());
frame.getContentPane().add(lblPrimoValore);

JLabel lblSecondoValore = new JLabel("Secondo Valore");
springLayout.putConstraint(SpringLayout.NORTH, lblSecondoValore, 0, SpringLayout.NORTH, textField_2);
springLayout.putConstraint(SpringLayout.EAST, lblSecondoValore, 0, SpringLayout.EAST, lblPrimoValore);
frame.getContentPane().add(lblSecondoValore);




textField_1 = new JTextField();
springLayout.putConstraint(SpringLayout.NORTH, textField_1, 20, SpringLayout.SOUTH, textField_2);
springLayout.putConstraint(SpringLayout.WEST, textField_1, 0, SpringLayout.WEST, textField);
frame.getContentPane().add(textField_1);
textField_1.setColumns(10);


JButton btnCrea = new JButton("Crea");
btnCrea.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

textField_1.setText("Ontologia creata");
textField_3.setText(textField.getText());

textField_4.setText(textField_2.getText());
}
});

springLayout.putConstraint(SpringLayout.NORTH, btnCrea, 20, SpringLayout.SOUTH, textField_2);
springLayout.putConstraint(SpringLayout.WEST, btnCrea, 149, SpringLayout.WEST, frame.getContentPane());
frame.getContentPane().add(btnCrea);

textField_3 = new JTextField();
springLayout.putConstraint(SpringLayout.NORTH, textField_3, 36, SpringLayout.SOUTH, btnCrea);
springLayout.putConstraint(SpringLayout.WEST, textField_3, 39, SpringLayout.WEST, frame.getContentPane());
frame.getContentPane().add(textField_3);
textField_3.setColumns(10);

textField_4 = new JTextField();
springLayout.putConstraint(SpringLayout.NORTH, textField_4, 0, SpringLayout.NORTH, textField_3);
springLayout.putConstraint(SpringLayout.EAST, textField_4, 0, SpringLayout.EAST, textField);
frame.getContentPane().add(textField_4);
textField_4.setColumns(10);

lblPrimaValore = new JLabel("prima valore");
springLayout.putConstraint(SpringLayout.NORTH, lblPrimaValore, 20, SpringLayout.SOUTH, textField_3);
springLayout.putConstraint(SpringLayout.EAST, lblPrimaValore, 0, SpringLayout.EAST, lblPrimoValore);
frame.getContentPane().add(lblPrimaValore);

lblSecondoValore_1 = new JLabel("secondo valore");
springLayout.putConstraint(SpringLayout.NORTH, lblSecondoValore_1, 0, SpringLayout.NORTH, lblPrimaValore);
springLayout.putConstraint(SpringLayout.EAST, lblSecondoValore_1, -112, SpringLayout.EAST, frame.getContentPane());
frame.getContentPane().add(lblSecondoValore_1);


btnChiudi = new JButton("chiudi");
btnChiudi.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
btnChiudi.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
System.exit(0);
}});

}
});
springLayout.putConstraint(SpringLayout.WEST, btnChiudi, 128, SpringLayout.WEST, frame.getContentPane());
springLayout.putConstraint(SpringLayout.SOUTH, btnChiudi, -10, SpringLayout.SOUTH, frame.getContentPane());
frame.getContentPane().add(btnChiudi);

// passo 1: creaiamo l���ontologia
OntModel m = ModelFactory.createOntologyModel (ProfileRegistry.OWL_DL_LANG);

// passo 2: definiamo il default namespace
String ns = "http://www.owl-ontologies.com/manager.owl#";
m.setNsPrefix("", ns);
fn = textField.getText().toString();
sn = textField_2.getText().toString();

// passo 3: definiamo alcune classi primitive
OntClass cBirra = m.createClass(ns + fn);
OntClass cPilsner = m.createClass(ns + sn);
OntClass cLievito = m.createClass(ns + "Lievito");
OntClass cLievitoBassaFermentazione = m.createClass(ns + "LievitoBassaFermentazione");

// passo 4: creiamo la tassonomia
cBirra.addSubClass(cPilsner); cLievito.addSubClass(cLievitoBassaFermentazione);
// passo 5: definiamo le disgiunzioni
cBirra.addDisjointWith(cLievito); cLievito.addDisjointWith(cBirra);
// passo 6: definiamo le proprieta��
OntProperty pHaIngrediente = m.createTransitiveProperty(ns + "haIngrediente");
OntProperty pHaLievito = m.createTransitiveProperty(ns + "haLievito");
// passo 7: definiamo la gerarchia delle proprieta��
pHaIngrediente.addSubProperty(pHaLievito);
// passo 8: definiamo dominio e range delle proprieta��
pHaIngrediente.addDomain(cBirra); pHaLievito.addRange(cLievito);
// passo 9: definiamo alcune restrizioni sulla classe Pilsner
Restriction cSomeBassaFermentazione = m.createSomeValuesFromRestriction(null, pHaLievito,
cLievitoBassaFermentazione);
Restriction cAllBassaFermentazione = m.createAllValuesFromRestriction(null, pHaLievito,
cLievitoBassaFermentazione); cPilsner.addSuperClass(cSomeBassaFermentazione);
cPilsner.addSuperClass(cAllBassaFermentazione);
// passo 10: aggiungiamo la classe definita Lager
// passo 11: definiamo alcuni individui
Individual iPilsnerUrquell = m.createIndividual(ns + "pilsnerUrquell", cPilsner);
Individual iLager = m.createIndividual(ns + "lager", cLievitoBassaFermentazione);
// passo 12: applichiamo le proprieta�� agli individui
iPilsnerUrquell.addProperty(pHaLievito, iLager);
// passo 13: salviamo l���ontologia try {
FileOutputStream fout = null;
try {


fout = new FileOutputStream("/Users/francio21/file personali/tesi/CreaOntoCreata.xml");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
m.write(fout);

}
}

estraggo il tutto salvandolo in jar:CreaOnto.jar
e questo è il codice html:
codice:

<applet archive="CreaOnto.jar" code="CreaOnto.class" width="188" height="188">

</applet>

Vorrei sapere dove sbaglio ?? Grazia a chi mi vorrà aiutare
 
Discussioni simili
Autore Titolo Forum Risposte Data
L [Java] Errore json conversione Java 0
booklisa [Javascript] Errore java Javascript 3
A [JAVA e MySql] Errore can't create table Java 3
codesurfer [Java] [JSP] errore in lettura XML (Content is not allowed in prolog.) Java 4
B errore codice java Javascript 0
K Inserimento query Errore 1366 PHP 4
F errore 1062 su campo nuovo MySQL 4
N Errore interno Access MS Access 2
R mi da errore dove inizia il while PHP 1
R Recupero di permalink di un sito che è stato eliminato per errore WordPress 5
R Yoast SEO errore semafori sempre rossi SEO e Posizionamento 0
S Visualizza l'errore di creazione in MSSQL Database 4
simgia Cordova errore quando cerco di emulare o creare la app Sviluppo app per Android 2
P Errore nell'indirizzo degli elementi HTML e CSS 2
Jensen Errore di sintassi con DELETE PHP 3
H Errore su array associativo PHP 1
FDF182 ERRORE 1292 PHP 4
P errore 404 con javascript Javascript 2
felino Windows 7: errore 80072EFE su Windows Update Windows e Software 1
A errore http://datatables.net/tn/7 PHP 4
M Errore visualizzazione meta tag title e description SEO e Posizionamento 1
A Errore durante il salvataggio Photoshop 0
M Errore configurazione motion detection nvr Hikvision DS-7616 IP Cam e Videosorveglianza 0
voldemort [c] Errore di segmentazione (core dump creato) C/C++ 1
T SSD - errore sistema Hardware 2
R Navigare sito con cURL, mi restituisce errore PHP 0
L File CSV con app inventor da errore Sviluppo app per Android 2
A Errore visualizzazione selezione testo Photoshop 0
I Postman 400 Errore di richiesta non valida Programmazione 0
S Errore PHP - Notice: Undefined index ... PHP 14
U Campo vuoto data errore Fatal error: PHP 2
R Errore UPDATE tabella mysql PHP 1
R W10 Segnalazione di errore su terminale USB Windows e Software 0
G non riesco a capire quale sia l'errore [SQL] MySQL 2
I Errore 80040220 nella newsletter con paginazione Classic ASP 0
E Errore di lettura php in html PHP 8
A php metodo post jquery non da mai errore jQuery 4
W Errore di run-time di Microsoft VBScript error '800a0035' Impossibile trovare il file Classic ASP 0
B Errore unexpected '$variabile' (T_VARIABLE) in your code on line PHP 2
M errore dopo passaggio Php 7.2 PHP 6
S -> Errore PHP 8
S Errore "ftp_put(): Can't open that file: Permission denied" PHP 1
P Errore telecamere hdcvi dahua IP Cam e Videosorveglianza 16
L form multipla php sql,errore in inserimento MySQL 0
M Errore JavaScript per php [objeto HTMLParagraphElement] PHP 0
F [PHP]Errore registrazione PHP 8
MarcoGrazia [PHP] Download di file con errore all'interno. PHP 1
V [ORACLE] Errore ora-06512 at sys.utl_file Oracle 0
A [WordPress] Errore Plugin WordPress 0
P [WordPress] Messaggio di errore in file style.css WordPress 0

Discussioni simili