I received the CD with ?Symbian Crystal SDK for Java 6.0? from Nokia and installed the software on my PC (Pentium-III 800 MHz, 512 MB of RAM), running Windows98.
I placed all Emulator?s files to the local disk F: and in the autoexec.bat there are 2 strings :
SET EPOCROOT=\Symb_6\NokiaJavaPATH F:\Symb_6\Shared\epoc32\tools;F:\Symb_6\Shared\epoc32\gcc\bin
I use the following EPOC Emulator?s drive mapping in file ?epoc.ini? :
_epoc_drive_s E:\JPrj
Then I create very simple java application (analogous "Hello" example from QUICK START section of Crystal SDK documentation). See source code below :
import java.awt.*;
import java.awt.event.*;
public class EpocMain extends Frame implements ActionListener, WindowListener {
public EpocMain() {
super( "FrameExample" );
addWindowListener( this );
setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) );
Button but = new Button( "Example" );
but.addActionListener( this );
add( but );
setSize( getPreferredSize() );
setVisible(true);
}
public static void main(String[] args) { new EpocMain(); }
public void paint( Graphics Gr ) {
Gr.setColor( Color.red );
Gr.drawRect( 5, 50, getSize().width-15,
getSize().height-60 );
System.out.println( "paint() done" );
}
public Dimension getPreferredSize() { return new Dimension( 150, 100 ); }
public void actionPerformed( ActionEvent e ) {
System.out.println("Event");
dispatchEvent( new WindowEvent( this, WindowEvent.WINDOW_CLOSING ) );
}
public void windowClosing( WindowEvent e ) {
System.out.println("Goodbye");
System.exit( 0 );
}
public void windowClosed( WindowEvent e ) {}
public void windowOpened( WindowEvent e ) {}
public void windowIconified( WindowEvent e ) {}
public void windowDeiconified( WindowEvent e ) {}
public void windowActivated( WindowEvent e ) {}
public void windowDeactivated( WindowEvent e ) {}
}
I tried running my application using the following ?.bat?-file :
set CLASSPATH=
F:
cd \Symb_6\NokiaJava\Epoc32\Release\wins\urel
pjava -cp s:\EpocEmulator\classes; EpocMain
This application starts successfully, because in console-window appears appropriate output
(see method paint() ), but no frame shows on Emulator?s screen. And only in about 2 min icons of Extras-group are displayed on Emulator?s screen.
And in the folder C:\WIN98\TEMP I can see files :
ATRA0000.BIN,
ATRA1000.BIN and
EPOCWIND.OUT, that contains the output :
Can't load ELOCL0.DLL
Can't load EKDATA0.DLL
Can't load Enos.LDD
Can't load FBUSMEDIA.PMM
Can't load TESTMEDIA.PMM
CPhoneModel::ConstructLCSSIndicatorMonitor::Start create data store ...
I can launch my application only like that :
open Emulator?s File Manager, select file ?EpocMain.class? and press ?Enter?.
Then my application?s frame is displayed on Emulator?s screen.
Why can?t I start my java-application using ?pjava...? ?
Posted by Alex Petrov, pal@lens.spb.ru
on January 07, 2002 at 19:05
Posted by Juergen Bocklage, juergen.bocklage@gmx.net
on January 07, 2002 at 19:37
Several things to say.
1. You should use the CFrame class. This hides the titlebar from the frame to save screen space.
2. The Application does start most probably it hides just after the shell. Press the close button of the starting application, then you should see your app.
The problem is, that the java frame starts up, but the emulator starts also up the shell. A racing condition. Best is, you let the java app wait like 5-15 secs in the main method, before starting up.