Solved

SIP in J2ME

Posted on 2004-08-12
20
1,152 Views
Last Modified: 2013-11-23
Hello!

Currently i'm developing a SIP application for MIDp. I'm using the nokia sipa_midp package and configured te sun WTK to use the package while compiling. I'm running the midlets using the Nokia S60 SIP enabled emulator. I want to either include the package into WTK so that i can run the midlets in the sun emulator or include the SIP class files into the Jar file so that i can run the midlets on my Nokia 6600.

My guess is that for my convenience i will need the source code to do both of these things. But there is a catch, I tried decompiling the code, but some clkasses couldn't be decompiled (the decompiler returned JVM code). So now i'm looking for a way to include the package during compilation, or add them manualy to the Jar files.

Can anyone help me!?

Erik

0
Comment
Question by:arsonselwerd
  • 6
  • 6
  • 5
20 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11781943
Where are the SIP classes? Can you not jar them all together (SIP class and other classes you are using) into a jar file and use that?

BTW what do you mean that you got JVM code from decompiling?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11781955
You surely just need to place the jars into the classpath? You don't need the source
0
 

Author Comment

by:arsonselwerd
ID: 11782020
This is what the decompiler returns in some of the classes:
        if(l <= 0L) goto _L2; else goto _L1
_L4:
        l = a(l);
        if(l <= 0L && B.isEmpty())
            return false;
_L1:
        if(B.isEmpty()) goto _L4; else goto _L3
_L2:
        if(!B.isEmpty()) goto _L3; else goto _L5
_L5:
        false;
        s1;
        JVM INSTR monitorexit ;
        return;
_L3:
        this.l = (a)B.firstElement();
 

personaly i think it's kind of gibrish (teh goto's make sence but the JVM monitor doesn't..)

puttingth classes into the classpath doesn't help because for some reason the WTK doesn't support this. The WTK only uses it's own jar files of classes so i extended these with the SIP classes. This works for the compilation but doesn't work runtime.
I tried putting all the classes into the same dir. as the other clasa files (meantaining the package structure of course) but the emulator just ignores them. Even when i manualy copy the class files into the jar the emulator ignores them. This is (as i'm told) because the classes need to be preferified and to do this you need the source code.

0
 
LVL 35

Accepted Solution

by:
girionis earned 100 total points
ID: 11782062
It returns the bytecode, you didn't decompile them, you disasambled them.

> This works for the compilation but doesn't work runtime.

Are you getting any error messages?

If you really need a decompiler here are some:

http://aolca.com.com/3000-2417-10146169.html?tag=list
http://kpdus.tripod.com/jad.html

And here is some info about preverifying midlets: http://www.segi.org/Java/midp/HelloMIDlet.en.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11782070
>>because for some reason the WTK doesn't support this.

That I find difficult to believe - as that would imply a monolithic platform, to which you could not add classes, which would hardly be very useful ...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11782122
This decompiling/disassembling is almost certainly a 'red herring' ;-)

You can use the classpath parameter when preverifying too
0
 

Author Comment

by:arsonselwerd
ID: 11782132
> It returns the bytecode,
 ah!

>you didn't decompile them, you disasambled them
no, i didn't. Thanks for the links, but those where the decopilers i used including a few others.

>>>because for some reason the WTK doesn't support this.

>That I find difficult to believe - as that would imply a monolithic platform, to which you could not add classes, which  >would hardly be very useful ...

EXACTLY!  that's what i thougth as well. So my question remains => how to include the package!?

tha classpath didn't seem to work. The project the WTK made inclides a lib dir. witch according to me should hold external packages they just aren't included during compilation let alone used during runtime.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11782155
Do you get any error messages? It might not be a classpath problem after all.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 86

Expert Comment

by:CEHJ
ID: 11782165
>>tha classpath didn't seem to work

Are you specifying it properly? Don't forget, jar and zip files need to be included in full (i.e. they won't be picked up by specifying directory alone)
0
 

Author Comment

by:arsonselwerd
ID: 11782198
when running the midlet in the WTK (witch will largely reflect what will happen on a mobile device) a get:
 "Uncaught exception java/lang/NoClassDefFoundError: SipServer: javax/microedition/sip/SipServerConnectionNotifier ."

This SipConnectionNotifier is an interface so there is nothing to catch..
0
 
LVL 35

Expert Comment

by:girionis
ID: 11782213
Can you tell us how you set your classpath? And in what file the SipServerConnectionNotifier resides?
0
 

Author Comment

by:arsonselwerd
ID: 11782240
>Are you specifying it properly? Don't forget, jar and zip files need to be included in full (i.e. they won't be picked up by specifying directory alone)

i  that is my question: how to do this?
the only configuring i did besides adding the sip package to the MIDP2_0.jar from the wtk was altering  the system.config file to include the line:

microedition.sip.version: 1.0

this enabled the WTK to just compile the code.

0
 
LVL 35

Expert Comment

by:girionis
ID: 11782264
> the only configuring i did besides adding the sip package to the MIDP2_0.jar from the wtk

How did you do that? Did you open the file and added the sip jar file there?

> this enabled the WTK to just compile the code.

I'd assume then that it also should find the classes during runtime since compiling and running are the same thing with regards to the classpath.
0
 

Author Comment

by:arsonselwerd
ID: 11782323
>> the only configuring i did besides adding the sip package to the MIDP2_0.jar from the wtk

>How did you do that? Did you open the file and added the sip jar file there?

i opened both midp2_0.jar and sipa1_0.jar and copied all the files in the sip jar to the midp jar

>> this enabled the WTK to just compile the code.

>I'd assume then that it also should find the classes during runtime since compiling and running are the same thing >with regards to the classpath.

me too. In the SIP readme.txt provided by nokia it is stated that the sun WTK doesn't support the sip api in any way. So i want to include the SIP class files in the sipa1_2.jar into .jar of my own midlet. This sould solve the classpath problem.
BUT, howto? copying the file like i did with the midp jar just isn't gonna work, they need to be compiled as source code together with the other .java files to be proberly included. And the thing is: i don't have the source code because i can't decompile the classes or work at nokia.
Is there a way to do this manualy or force the compiler to include them as well?
0
 
LVL 35

Expert Comment

by:girionis
ID: 11782366
>  In the SIP readme.txt provided by nokia it is stated that the sun WTK doesn't support the sip api in any way.

If it is stated officially you might not be able to do it then.

> So i want to include the SIP class files in the sipa1_2.jar into .jar of my own midlet.

Have you tried unjaring the sipa1_2.jar and get all classes in your jar file?
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 100 total points
ID: 11782402
I can't imagine how you can be compiling and running ...

From

http://jan.netcomp.monash.edu.au/internetdevices/wireless/midp.html

(you will have to allow for the fact that the following is Unix-oriented [ask if you're not sure])

>>
Assume you have unpacked the J2ME wireless toolkit into a directory such as WTK=/usr/local/personaljava/WTK2.0

Compile by javac -bootclasspath $WTK/lib/midpapi.zip Shell.java
Preverify by $WTK/bin/preverify -classpath .:$WTK/lib/midpapi.zip -d classes Shell
Run by $WTK/bin/emulator -cp classes:$WTK/lib/midpapi.zip Shell
Different emulators may be chosen using the -Xdevice:device option, where device is one of DefaultColorPhone, DefaultGrayPhone, MediaControlSkin or QwertyDevice
>>

-----------------------------------------------------------------------------------------------------

>>Uncaught exception java/lang/NoClassDefFoundError: SipServer: javax/microedition/sip/SipServerConnectionNotifier

also looks like a classpath problem btw
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11782447
Just to reiterate, the following should be unnecessary:

a. decompiling/disassembling
b. merging jars

>>  In the SIP readme.txt provided by nokia it is stated that the sun WTK doesn't support the sip api in any way.

Let's find that out in due course - at the moment, it's not even *trying* to support it
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now