Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 10th, 2008, 9:43 PM   #1
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1 JD-Salinger is on a distinguished road
can u embed j2me application in a j2se application

i am working on embedding a j2me application to be embedded in a j2se application, ca i do that? any tips? is that possible? can you point me to a link on how can i do that?

Ive read that j2me is a subclass of j2se(do i understand it correctly), if it is, then it's is possible to embed or use the classes of j2me to be used in a j2se application, im experimenting on doing these since i am interested in connecting my cellphone to my application in my pc and input some data in my pc to be redirected to my cellphone. for example the code below when compiled using the SUN WIRELESS TOOLKIT (J2ME) produces errors, saying that the java.awt.Container is not included in the library

Java Syntax (Toggle Plain Text)
  1.  
  2. import java.awt.Container;
  3. import javax.swing.*;
  4.  
  5. class HelloButton
  6. {
  7. public static void main(String[] args)
  8. {
  9. JFrame frame = new JFrame("HelloButton");
  10. Container pane = frame.getContentPane();
  11. JButton hello = new JButton("Hello,world!");
  12. pane.add(hello);
  13. frame.pack();
  14. frame.setVisible(true);
  15. }
  16.  
  17. }


or when i compile the code below in j2se produces same errors above

java Syntax (Toggle Plain Text)
  1. import javax.microedition.midlet.*;
  2. import javax.microedition.io.*;
  3. import javax.wireless.messageing.*;
  4.  
  5. public class SMS extends MIDlet
  6. {
  7. String text = "SMS example test";
  8. String address = "sms://+123456789";
  9. MessageConnection clientConn;
  10. public void startApp()
  11. {
  12. try
  13. {
  14. clientConn = (MessageConnection)Connector.open(address);
  15. TextMessage Tmsg=(TexMessage)clientConn.newMessage(MessageConnection.TEXT_MESSAGE);
  16. Tmsg.setPayloadText(text);
  17. }
  18. catch(Exception EX)
  19. {
  20. System.out.println("Error:"+EX);
  21. }
  22. }
  23. public void pauseApp() {}
  24. public void destroyApp(boolean unconditional) {}
  25. }

what i have in mind is this
java Syntax (Toggle Plain Text)
  1. import java.awt.Container;
  2. import javax.swing.*;
  3. import javax.microedition.midlet.*;
  4. import javax.microedition.io.*;
  5. import javax.wireless.messaging.*;
  6.  
  7.  
  8. class HelloButton
  9. {
  10. public static void main(String[] args)
  11. {
  12. JFrame frame = new JFrame("HelloButton");
  13. Container pane = frame.getContentPane();
  14. JButton hello = new JButton("Hello,world!");
  15. pane.add(hello);
  16. frame.pack();
  17. frame.setVisible(true);
  18. startApp() // this is from j2me
  19. }
  20. //
  21. // Embedding the classes and compiling in j2se
  22. //
  23. public void startApp()
  24. {
  25. try
  26. {
  27. clientConn = (MessageConnection)Connector.open(address);
  28. TextMessage Tmsg=(TexMessage)clientConn.newMessage(MessageConnection.TEXT_MESSAGE);
  29. Tmsg.setPayloadText(text);
  30. }
  31. catch(Exception EX)
  32. {
  33. System.out.println("Error:"+EX);
  34. }
  35. }
  36.  
  37. }

So is this possible? thank you for your replies
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote
Old Jul 10th, 2008, 11:25 PM   #2
Jabo
Not a user?
 
Join Date: Sep 2007
Posts: 272
Rep Power: 2 Jabo is on a distinguished road
Re: can u embed j2me application in a j2se application

Since you say j2me is a subset of j2se, I would think not all functionality would be compatible. It's been said that C++ is a subset of C, and most of the members of C will work in C++, but I'm sure there's some that don't.

As far as java.AWT, it's an old library, and wasn't very stable from what I'm told. I think the industry is trying to get away from using it.

Last edited by Jabo; Jul 10th, 2008 at 11:37 PM.
Jabo is offline   Reply With Quote
Old Jul 10th, 2008, 11:48 PM   #3
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1 JD-Salinger is on a distinguished road
Re: can u embed j2me application in a j2se application

but what im concerned of is only the data that is delivered by a certain API of J2ME, what i mean is that there is a modularity between the two... the J2SE serves as the shell and j2me will be on the data...
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
running a console application .jar file by double clicking cwl157 Java 3 May 22nd, 2008 1:22 PM
PC application with bluetooth urip Java 5 Feb 13th, 2008 12:15 PM
Help deploying my Application bigguy Visual Basic .NET 1 Nov 21st, 2006 7:36 PM
creating an application that stands between the browser and the serve ronias Visual Basic 5 Oct 30th, 2005 4:22 PM
"Not Responding" Message in Windows Form Application G_Zola C# 1 Apr 29th, 2005 10:15 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC