11 Replies - 2688 Views - Last Post: 01 December 2011 - 01:27 PM Rate Topic: -----

#1 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Applet not initialized

Posted 28 November 2011 - 12:41 PM

Hi all
I have a strange error while developing my latest applet. It just runs fine from Eclipse but when I load it in my browser I get the following error:
java.lang.RuntimeException: java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file org/ejml/simple/SimpleBase
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file org/ejml/simple/SimpleBase
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.RuntimeException: java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file org/ejml/simple/SimpleBase

Any idea why the applet runs without any problems in Eclipse but not in the browser?
Cheers

Is This A Good Question/Topic? 0
  • +

Replies To: Applet not initialized

#2 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Applet not initialized

Posted 28 November 2011 - 03:46 PM

Eclipse and most IDEs have their own Applet Viewers that do the housekeeping and preparation necessary to display an Applet in what looks like a JFrame. Applets are not "runnable" from the command line, but they can be shown or run in HTML pages. This link provides the basics for how to do that, but you can find much more info on the web.

You can also write source code so that it can be run either as an application or used as an Applet on an HTML page or in an Applet Viewer. Remember, applications must have a main() method of the correct signature. You may be able to add a main() method to your current Applet code that does what the Applet's init() method does, making it possible to run it as an application. Once you add the main() method, you'll see the option to run it as either an Applet or as an application in the source code's run menu. You can also find simple examples of how to write classes that can be run as applications or used as Applets on the web and (I believe) here on DIC.
Was This Post Helpful? 0
  • +
  • -

#3 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Re: Applet not initialized

Posted 29 November 2011 - 04:24 AM

Hi Greg
Thank you for your answer. I am fully aware of how to run an applet and how to include it in HTML. Done that many times before.
The strange thing is, that this applet (which is build the same way like many applets before) does not run when I try to load it in my browser, but it compiles and runs without any problems from Eclipse. It doesn´t matter whether I upload it to my webspace or if I run it from my local Apache server. That really drives me mad...
Cheers
Was This Post Helpful? 0
  • +
  • -

#4 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Applet not initialized

Posted 29 November 2011 - 04:55 AM

Not much more anyone can do without the code.

Good luck!
Was This Post Helpful? 0
  • +
  • -

#5 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Re: Applet not initialized

Posted 29 November 2011 - 05:31 AM

View PostGregBrannon, on 29 November 2011 - 12:55 PM, said:

Not much more anyone can do without the code.

Good luck!


Will upload the code later...
Was This Post Helpful? 0
  • +
  • -

#6 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2687
  • View blog
  • Posts: 11,349
  • Joined: 20-September 08

Re: Applet not initialized

Posted 29 November 2011 - 06:27 AM

The error is not in 'your' code, but in EJML. I don't know where the official distribution is, but get it and recompile it. With any luck your error should vanish

http://www.java2s.co...adejml07jar.htm
Was This Post Helpful? 0
  • +
  • -

#7 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Re: Applet not initialized

Posted 29 November 2011 - 10:19 AM

View Postg00se, on 29 November 2011 - 02:27 PM, said:

The error is not in 'your' code, but in EJML. I don't know where the official distribution is, but get it and recompile it. With any luck your error should vanish

http://www.java2s.co...adejml07jar.htm


Hi g00se
Thank you for your comment. Very much appreciated. I actually had the same idea yesterday, but unfortunately it did not help. I downloaded a new JAR and the source code from http://code.google.c...atrix-library/. As the JAR did not solve it, I built a new JAR from the source - still no success.
Here is my code:
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;

import org.ejml.simple.SimpleMatrix;


public class jOptimizer extends JApplet implements ActionListener{
   
	//Initialize the components and variables
	JButton calculateButton; 
	
    JTextField vol_A_TF;
    JTextField vol_B_TF;
    JTextField vol_C_TF;
    JTextField vol_D_TF;
    
    JTextField anteil_A_TF;
    JTextField anteil_B_TF;
    JTextField anteil_C_TF;
    JTextField anteil_D_TF;
    
    JTextField ret_A_TF;
    JTextField ret_B_TF;
    JTextField ret_C_TF;
    JTextField ret_D_TF;
    
    JTextField corr_AB_TF;
    JTextField corr_AC_TF;
    JTextField corr_AD_TF;
    JTextField corr_BC_TF;
    JTextField corr_BD_TF;
    JTextField corr_CD_TF;
    
    JTextField ret_PF_TF;
    JTextField vol_PF_TF;
    
    JTextField mvp_A_TF;
    JTextField mvp_B_TF;
    JTextField mvp_C_TF;
    JTextField mvp_D_TF;
    JTextField mvp_ret_TF;
    JTextField mvp_vol_TF;
    
    JLabel vol_A_Lab;
    JLabel vol_B_Lab;
    JLabel vol_C_Lab;
    JLabel vol_D_Lab;
    
    JLabel anteil_A_Lab;
    JLabel anteil_B_Lab;
    JLabel anteil_C_Lab;
    JLabel anteil_D_Lab;
   
    JLabel ret_A_Lab;
    JLabel ret_B_Lab;
    JLabel ret_C_Lab;
    JLabel ret_D_Lab;
    
    JLabel corr_AB_Lab;
    JLabel corr_AC_Lab;
    JLabel corr_AD_Lab;
    JLabel corr_BC_Lab;
    JLabel corr_BD_Lab;
    JLabel corr_CD_Lab;
    
    JLabel ret_PF_Lab;
    JLabel vol_PF_Lab;
    
    JLabel mvp_A_Lab;
    JLabel mvp_B_Lab;
    JLabel mvp_C_Lab;
    JLabel mvp_D_Lab;
    JLabel mvp_ret_Lab;
    JLabel mvp_vol_Lab;
    
    String vol_A_st;
    String vol_B_st;
    String vol_C_st;
    String vol_D_st;
    
    String ret_A_st;
    String ret_B_st;
    String ret_C_st;
    String ret_D_st;
    
    String corr_AB_st;
    String corr_AC_st;
    String corr_AD_st;
    String corr_BC_st;
    String corr_BD_st;
    String corr_CD_st;
    
    String anteil_A_st;
    String anteil_B_st;
    String anteil_C_st;
    String anteil_D_st;
    
    JPanel retpanel;
    JPanel volpanel;
    JPanel corrpanel;
    JPanel anteilpanel;
    JPanel outpanel;
    JPanel mvppanel;
    JPanel bpanel;
    
    SimpleMatrix Cov;
    SimpleMatrix MVP_Vol;
    SimpleMatrix MVP_Return;
    SimpleMatrix MVP_Vektor;
    SimpleMatrix CovTP;
    SimpleMatrix Ret;
    SimpleMatrix Allot;
    SimpleMatrix PF_ret;
    SimpleMatrix PF_vol;
    SimpleMatrix CovInv;
    SimpleMatrix TP1;
    SimpleMatrix TP1_vol;
    SimpleMatrix TP1_Allot;
    SimpleMatrix TP2;
    SimpleMatrix TP2_Allot;
    SimpleMatrix TP2_vol;
    SimpleMatrix Rf;
    SimpleMatrix Ret_Rf;
    
    
 
    public void init()
    {
 	   
 	   //Build the GUI
    		
	  
 	   retpanel = new JPanel();
 	   Border b1 = BorderFactory.createTitledBorder("Expected Returns");
 	   retpanel.setBorder(b1);
 	   retpanel.setLayout(new GridLayout(4, 2));
 	   
 	   volpanel = new JPanel();
	   Border b2 = BorderFactory.createTitledBorder("Expected Volatilities");
	   volpanel.setBorder(b2);
	   volpanel.setLayout(new GridLayout(4, 2));
	   
	   corrpanel = new JPanel();
 	   Border b3 = BorderFactory.createTitledBorder("Expected Correlations");
 	   corrpanel.setBorder(b3);
 	   corrpanel.setLayout(new GridLayout(6, 2));
 	   
 	   anteilpanel = new JPanel();
	   Border b4 = BorderFactory.createTitledBorder("Asset Allocation");
	   anteilpanel.setBorder(b4);
	   anteilpanel.setLayout(new GridLayout(4, 2));
 	   	   
 	   outpanel = new JPanel();
 	   Border b5 = BorderFactory.createTitledBorder("Your chosen portfolio");
 	   outpanel.setBorder(b5);
 	   outpanel.setLayout(new GridLayout(2, 2));
 	   
 	   mvppanel = new JPanel();
	   Border b6 = BorderFactory.createTitledBorder("Minimum-Variance-Portfolio");
	   mvppanel.setBorder(b6);
	   mvppanel.setLayout(new GridLayout(6, 2));
	   	   
	   bpanel = new JPanel();
	   bpanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
	   
	   calculateButton = new JButton("Calculate");
	   
	    vol_A_TF = new JTextField(5);
	    vol_A_TF.setText("0.29");
	    vol_B_TF = new JTextField(5);
	    vol_B_TF.setText("0.09");
	    vol_C_TF = new JTextField(5);
	    vol_C_TF.setText("0.23");
	    vol_D_TF = new JTextField(5);
	    vol_D_TF.setText("0.28");
	    
	    ret_A_TF = new JTextField(5);
	    ret_A_TF.setText("0.08");
	    ret_B_TF = new JTextField(5);
	    ret_B_TF.setText("0.05");
	    ret_C_TF = new JTextField(5);
	    ret_C_TF.setText("0.06");
	    ret_D_TF = new JTextField(5);
	    ret_D_TF.setText("0.12");
	    
	    corr_AB_TF = new JTextField(5);
	    corr_AB_TF.setText("0.3");
	    corr_AC_TF = new JTextField(5);
	    corr_AC_TF.setText("-0.15");
	    corr_AD_TF = new JTextField(5);
	    corr_AD_TF.setText("0.5");
	    corr_BC_TF = new JTextField(5);
	    corr_BC_TF.setText("0.25");
	    corr_BD_TF = new JTextField(5);
	    corr_BD_TF.setText("0.9");
	    corr_CD_TF = new JTextField(5);
	    corr_CD_TF.setText("-0.8");
	    
	    anteil_A_TF = new JTextField(5);
	    anteil_A_TF.setText("0.25");
	    anteil_B_TF = new JTextField(5);
	    anteil_B_TF.setText("0.25");
	    anteil_C_TF = new JTextField(5);
	    anteil_C_TF.setText("0.25");
	    anteil_D_TF = new JTextField(5);
	    anteil_D_TF.setText("0.25");
	    
	    ret_PF_TF = new JTextField(5);
	    ret_PF_TF.setEditable(false);
	    vol_PF_TF = new JTextField(5);
	    vol_PF_TF.setEditable(false);
	    
	    mvp_A_TF = new JTextField(5);
	    mvp_A_TF.setEditable(false);
	    mvp_B_TF = new JTextField(5);
	    mvp_B_TF.setEditable(false);
	    mvp_C_TF = new JTextField(5);
	    mvp_C_TF.setEditable(false);
	    mvp_D_TF = new JTextField(5);
	    mvp_D_TF.setEditable(false);
	    
	    mvp_ret_TF = new JTextField(5);
	    mvp_ret_TF.setEditable(false);
	    mvp_vol_TF = new JTextField(5);
	    mvp_vol_TF.setEditable(false);
	   
	    vol_A_Lab = new JLabel("Equities:");
	    vol_B_Lab = new JLabel("Bonds:");
	    vol_C_Lab = new JLabel("Commodities:");
	    vol_D_Lab = new JLabel("Hedge Funds:");
	   
	    ret_A_Lab = new JLabel("Equities:");
	    ret_B_Lab = new JLabel("Bonds:");
	    ret_C_Lab = new JLabel("Commodities:");
	    ret_D_Lab = new JLabel("Hedge Funds:");
	    
	    corr_AB_Lab = new JLabel("Equities/Bonds:");
	    corr_AC_Lab = new JLabel("Equities/Commodities:");
	    corr_AD_Lab = new JLabel("Equities/Hedge Funds:");
	    corr_BC_Lab = new JLabel("Bonds/Commodities:");
	    corr_BD_Lab = new JLabel("Bonds/Hedge Funds:");
	    corr_CD_Lab = new JLabel("Commodities/Hedge Funds:");
	    
	    anteil_A_Lab = new JLabel("Allotment Equities:");
	    anteil_B_Lab = new JLabel("Allotment Bonds:");
	    anteil_C_Lab = new JLabel("Allotment Commodities:");
	    anteil_D_Lab = new JLabel("Allotment Hedge Funds:");
	    
	    ret_PF_Lab = new JLabel("Expected Return:");
	    vol_PF_Lab = new JLabel("Expected Volatility:");
	    
	    mvp_A_Lab = new JLabel("Allotment Equities:");
	    mvp_B_Lab = new JLabel("Allotment Bonds:");
	    mvp_C_Lab = new JLabel("Allotment Commodities:");
	    mvp_D_Lab = new JLabel("Allotment Hedge Funds:");
	    mvp_ret_Lab = new JLabel("Expected Return:");
	    mvp_vol_Lab = new JLabel("Expected Volatility:");	    
	    
	    retpanel.add(ret_A_Lab);
	    retpanel.add(ret_A_TF);
	    retpanel.add(ret_B_Lab);
	    retpanel.add(ret_B_TF);
	    retpanel.add(ret_C_Lab);
	    retpanel.add(ret_C_TF);
	    retpanel.add(ret_D_Lab);
	    retpanel.add(ret_D_TF);
	   
	    
	    volpanel.add(vol_A_Lab);
	    volpanel.add(vol_A_TF);	   
	    volpanel.add(vol_B_Lab);
	    volpanel.add(vol_B_TF);	    
	    volpanel.add(vol_C_Lab);
	    volpanel.add(vol_C_TF);	 
	    volpanel.add(vol_D_Lab);
	    volpanel.add(vol_D_TF);
	    
	    corrpanel.add(corr_AB_Lab);
	    corrpanel.add(corr_AB_TF);
	    corrpanel.add(corr_AC_Lab);
	    corrpanel.add(corr_AC_TF);
	    corrpanel.add(corr_AD_Lab);
	    corrpanel.add(corr_AD_TF);
	    
	    corrpanel.add(corr_BC_Lab);
	    corrpanel.add(corr_BC_TF);
	    
	    corrpanel.add(corr_BD_Lab);
	    corrpanel.add(corr_BD_TF);
	    
	    corrpanel.add(corr_CD_Lab);
	    corrpanel.add(corr_CD_TF);
	    
	    anteilpanel.add(anteil_A_Lab);
	    anteilpanel.add(anteil_A_TF);	   
	    anteilpanel.add(anteil_B_Lab);
	    anteilpanel.add(anteil_B_TF);	    
	    anteilpanel.add(anteil_C_Lab);
	    anteilpanel.add(anteil_C_TF);	 
	    anteilpanel.add(anteil_D_Lab);
	    anteilpanel.add(anteil_D_TF);
	    
	    outpanel.add(ret_PF_Lab);
	    outpanel.add(ret_PF_TF);
	    outpanel.add(vol_PF_Lab);
	    outpanel.add(vol_PF_TF);
	    
	    mvppanel.add(mvp_A_Lab);
	    mvppanel.add(mvp_A_TF);
	    mvppanel.add(mvp_B_Lab);
	    mvppanel.add(mvp_B_TF);
	    mvppanel.add(mvp_C_Lab);
	    mvppanel.add(mvp_C_TF);
	    mvppanel.add(mvp_D_Lab);
	    mvppanel.add(mvp_D_TF);
	    mvppanel.add(mvp_ret_Lab);
	    mvppanel.add(mvp_ret_TF);
	    mvppanel.add(mvp_vol_Lab);
	    mvppanel.add(mvp_vol_TF);

	    bpanel.add(calculateButton);
		
	    Container con = getContentPane();
	    con.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
		con.add(retpanel);
		con.add(volpanel);
		con.add(corrpanel);
		con.add(anteilpanel);
		con.add(outpanel);
		con.add(mvppanel);
		con.add(bpanel);
		   
		calculateButton.addActionListener(this); 
    }
    
    public void actionPerformed(ActionEvent evt) 
    { 
    	//Read the input from the JTextField and convert the String to Double
 	    String vol_A_st = vol_A_TF.getText();
    	double vol_A = Double.parseDouble(vol_A_st);    	
    	String vol_B_st = vol_B_TF.getText();
     	double vol_B = Double.parseDouble(vol_B_st);        
     	String vol_C_st = vol_C_TF.getText();
     	double vol_C = Double.parseDouble(vol_C_st);     	
     	String vol_D_st = vol_D_TF.getText();
     	double vol_D = Double.parseDouble(vol_D_st);
     	
     	String ret_A_st = ret_A_TF.getText();
      	double ret_A = Double.parseDouble(ret_A_st);      	
      	String ret_B_st = ret_B_TF.getText();
      	double ret_B = Double.parseDouble(ret_B_st);      	
      	String ret_C_st = ret_C_TF.getText();
      	double ret_C = Double.parseDouble(ret_C_st);      	
      	String ret_D_st = ret_D_TF.getText();
      	double ret_D = Double.parseDouble(ret_D_st);
      	
      	String corr_AB_st = corr_AB_TF.getText();
      	double corr_AB = Double.parseDouble(corr_AB_st);         	
      	String corr_AC_st = corr_AC_TF.getText();
      	double corr_AC = Double.parseDouble(corr_AC_st);        	
      	String corr_AD_st = corr_AD_TF.getText();
      	double corr_AD = Double.parseDouble(corr_AD_st);         
      	String corr_BC_st = corr_BC_TF.getText();
      	double corr_BC = Double.parseDouble(corr_BC_st);
      	String corr_BD_st = corr_BD_TF.getText();
      	double corr_BD = Double.parseDouble(corr_BD_st);
      	String corr_CD_st = corr_CD_TF.getText();
      	double corr_CD = Double.parseDouble(corr_CD_st);
      	
      	String anteil_A_st = anteil_A_TF.getText();
      	double anteil_A = Double.parseDouble(anteil_A_st);      	
      	String anteil_B_st = anteil_B_TF.getText();
      	double anteil_B = Double.parseDouble(anteil_B_st);
      	String anteil_C_st = anteil_C_TF.getText();
      	double anteil_C = Double.parseDouble(anteil_C_st);
      	String anteil_D_st = anteil_D_TF.getText();
      	double anteil_D = Double.parseDouble(anteil_D_st);
      	        
        //Correlation to Covar
      	double covar_AA = Math.pow(vol_A, 2);
      	double covar_AB = vol_A * vol_B * corr_AB;
      	double covar_AC = vol_A * vol_C * corr_AC;
      	double covar_AD = vol_A * vol_D * corr_AD;        
      	double covar_BB = Math.pow(vol_B, 2);
      	double covar_BC = vol_B * vol_C * corr_BC;
      	double covar_BD = vol_B * vol_D * corr_BD;        
      	double covar_CC = Math.pow(vol_C, 2);   
      	double covar_CD = vol_C * vol_D * corr_CD;
      	double covar_DD = Math.pow(vol_D, 2);
        
        //Covar Matrix
    	Cov = new SimpleMatrix(4,4,true,covar_AA,covar_AB,covar_AC,covar_AD,
    			covar_AB,covar_BB,covar_BC,covar_BD,
    			covar_AC,covar_BC,covar_CC,covar_CD,
    			covar_AD,covar_BD,covar_CD,covar_DD);
    	
    	//Return Vector
        Ret = new SimpleMatrix(4,1,true,ret_A,ret_B,ret_C,ret_D);
         
        //Allotment Vector
        Allot = new SimpleMatrix(4,1,true,anteil_A,anteil_B,anteil_C,anteil_D);
   
        //Calculate Portfolio Return
        PF_ret = new SimpleMatrix(Allot.transpose().mult(Ret));
        double PF_ret_db = PF_ret.get(0);
        double PF_ret_r = PF_ret_db * 1000;	   
        PF_ret_r = Math.round(PF_ret_r);
        PF_ret_r = PF_ret_r / 1000;
        ret_PF_TF.setText(Double.toString(PF_ret_r));
        
        //Calculate Portfolio Volatility
        PF_vol = new SimpleMatrix(Allot.transpose().mult(Cov.mult(Allot)));
        double PF_vola = Math.sqrt(PF_vol.get(0));
        double PF_vola_r = PF_vola * 1000;	   
        PF_vola_r = Math.round(PF_vola_r);
        PF_vola_r = PF_vola_r / 1000;
        vol_PF_TF.setText(Double.toString(PF_vola_r));
        
        CovInv = new SimpleMatrix(Cov.invert());
                      
        TP1 = new SimpleMatrix(CovInv.mult(Ret));
        
        double sum1 = TP1.get(0) + TP1.get(1) + TP1.get(2) + TP1.get(3);
        double Z1 = TP1.get(0) / sum1;
        double Z2 = TP1.get(1) / sum1;
        double Z3 = TP1.get(2) / sum1;
        double Z4 = TP1.get(3) / sum1;
               
        TP1_Allot = new SimpleMatrix(4,1,true,Z1,Z2,Z3,Z4);
        TP1_vol = new SimpleMatrix(TP1_Allot.transpose().mult(Cov.mult(TP1_Allot)));
        double TP1_var = TP1_vol.get(0);
        
        
        Rf = new SimpleMatrix(4,1,true,0.03,0.03,0.03,0.03);
        Ret_Rf = new SimpleMatrix(Ret.minus(Rf));
        
        TP2 = new SimpleMatrix(CovInv.mult(Ret_Rf));
        
        double sum2 = (TP2.get(0) + TP2.get(1) + TP2.get(2) + TP2.get(3));
        double Z12 = (TP2.get(0) / sum2);
        double Z22 = (TP2.get(1) / sum2);
        double Z32 = (TP2.get(2) / sum2);
        double Z42 = (TP2.get(3) / sum2);   
        
        TP2_Allot = new SimpleMatrix(4,1,true,Z12,Z22,Z32,Z42);
        TP2_vol = new SimpleMatrix(TP2_Allot.transpose().mult(Cov.mult(TP2_Allot)));
        double TP2_var = TP2_vol.get(0);
        
        CovTP = new SimpleMatrix(TP1_Allot.transpose().mult(Cov.mult(TP2_Allot)));
        double TP_covar = CovTP.get(0);
        
        double W_TP1 = (TP2_var - TP_covar) / (TP2_var + TP1_var - 2*TP_covar);
        double W_TP2 = 1-W_TP1;
        
                      
        double MVP_anteil_A = Z1 * W_TP1 + Z12 * W_TP2;    	
        double MVP_anteil_B = Z2 * W_TP1 + Z22 * W_TP2;
        double MVP_anteil_C = Z3 * W_TP1 + Z32 * W_TP2;
        double MVP_anteil_D = Z4 * W_TP1 + Z42 * W_TP2;
        
        double MVP_A_r = MVP_anteil_A * 1000;	   
        MVP_A_r = Math.round(MVP_A_r);
        MVP_A_r = MVP_A_r / 1000;
        
        double MVP_B_r = MVP_anteil_B * 1000;	   
        MVP_B_r = Math.round(MVP_B_r);
        MVP_B_r = MVP_B_r / 1000;
        
        double MVP_C_r = MVP_anteil_C * 1000;	   
        MVP_C_r = Math.round(MVP_C_r);
        MVP_C_r = MVP_C_r / 1000;
        
        double MVP_D_r = MVP_anteil_D * 1000;	   
        MVP_D_r = Math.round(MVP_D_r);
        MVP_D_r = MVP_D_r / 1000;
        
        mvp_A_TF.setText(Double.toString(MVP_A_r));
        mvp_B_TF.setText(Double.toString(MVP_B_r));
        mvp_C_TF.setText(Double.toString(MVP_C_r));
        mvp_D_TF.setText(Double.toString(MVP_D_r));
        
        MVP_Vektor = new SimpleMatrix(4,1,true,MVP_anteil_A,MVP_anteil_B,MVP_anteil_C,MVP_anteil_D);
        MVP_Return = new SimpleMatrix(MVP_Vektor.transpose().mult(Ret));
        double MVP_Afkast = MVP_Return.get(0);
        double MVP_Afkast_r = MVP_Afkast * 1000;	   
        MVP_Afkast_r = Math.round(MVP_Afkast_r);
        MVP_Afkast_r = MVP_Afkast_r / 1000;
        mvp_ret_TF.setText(Double.toString(MVP_Afkast_r));
        
        MVP_Vol = new SimpleMatrix(MVP_Vektor.transpose().mult(Cov.mult(MVP_Vektor)));
        double MVP_StdDev = Math.sqrt(MVP_Vol.get(0));
        double MVP_StdDev_r = MVP_StdDev * 1000;	   
        MVP_StdDev_r = Math.round(MVP_StdDev_r);
        MVP_StdDev_r = MVP_StdDev_r / 1000;
        mvp_vol_TF.setText(Double.toString(MVP_StdDev_r));
        
        
    }
}


Was This Post Helpful? 0
  • +
  • -

#8 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2687
  • View blog
  • Posts: 11,349
  • Joined: 20-September 08

Re: Applet not initialized

Posted 29 November 2011 - 10:32 AM

Quote

I built a new JAR from the source - still no success.


That's strange. What Java version do you have for your Eclipse build target?
Was This Post Helpful? 0
  • +
  • -

#9 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2687
  • View blog
  • Posts: 11,349
  • Joined: 20-September 08

Re: Applet not initialized

Posted 29 November 2011 - 10:38 AM

You're probably seeing the Applet Console (your first post suggests as much), so use it to delete the cache. Why? See

http://stackoverflow...alue-1008813135
Was This Post Helpful? 0
  • +
  • -

#10 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Re: Applet not initialized

Posted 29 November 2011 - 11:20 AM

View Postg00se, on 29 November 2011 - 06:32 PM, said:

Quote

I built a new JAR from the source - still no success.


That's strange. What Java version do you have for your Eclipse build target?

That's what "java -version" in the bash terminal tells me:
Java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (suse-4.2.1-i386)
OpenJDK Server VM (build 20.0-b11, mixed mode)

View Postg00se, on 29 November 2011 - 06:38 PM, said:

You're probably seeing the Applet Console (your first post suggests as much), so use it to delete the cache. Why? See

http://stackoverflow...alue-1008813135


Unfortunately not. The console output was from a friend of mine.

This post has been edited by Strandi: 29 November 2011 - 01:50 PM

Was This Post Helpful? 0
  • +
  • -

#11 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Re: Applet not initialized

Posted 29 November 2011 - 11:34 AM

View Postg00se, on 29 November 2011 - 06:38 PM, said:

You're probably seeing the Applet Console (your first post suggests as much), so use it to delete the cache. Why? See

http://stackoverflow...alue-1008813135


I just cleaned the java cache - still no success :sad2:
Was This Post Helpful? 0
  • +
  • -

#12 Strandi  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 63
  • Joined: 08-July 09

Re: Applet not initialized

Posted 01 December 2011 - 01:27 PM

Ok, after all this issue got solved.
1. I had to export the project to a jar file
2. I had to use the "archive" attribute when including the jar in the HTML
:crazy:
Note to myself: when using an external library, including the .class with the simple applet tag is not sufficient ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1