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