Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1166
  • Last Modified:

SIP in J2ME

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
arsonselwerd
Asked:
arsonselwerd
  • 6
  • 6
  • 5
2 Solutions
 
girionisCommented:
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
 
CEHJCommented:
You surely just need to place the jars into the classpath? You don't need the source
0
 
arsonselwerdAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
girionisCommented:
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
 
CEHJCommented:
>>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
 
CEHJCommented:
This decompiling/disassembling is almost certainly a 'red herring' ;-)

You can use the classpath parameter when preverifying too
0
 
arsonselwerdAuthor Commented:
> 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
 
girionisCommented:
Do you get any error messages? It might not be a classpath problem after all.
0
 
CEHJCommented:
>>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
 
arsonselwerdAuthor Commented:
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
 
girionisCommented:
Can you tell us how you set your classpath? And in what file the SipServerConnectionNotifier resides?
0
 
arsonselwerdAuthor Commented:
>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
 
girionisCommented:
> 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
 
arsonselwerdAuthor Commented:
>> 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
 
girionisCommented:
>  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
 
CEHJCommented:
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
 
CEHJCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now