• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Code Fragment Inclusion

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just wondering if anyone could advise me on this topic, I�ll outline my scenario.

Developing a midp2 app within NetBeans 4.1 and in order to keep jar size down am trying to implement a minimal amount of classes, this obviously leads to whopping big java files

So in order to keep on top of the code i was looking say to put all Sprite associated functions within a separate file called Sprite.inc and then include this .inc file onto the bottom of the .java file

Now i know this needs to be done in preprocessing with //#include Sprite.inc but it's getting a preprocessor working within NetBeans to do that?

Some pointers to the build.xml bits I need to fiddle with to get a custom preprocessor working would be greatly appreciated.

Thanks,
Phil.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I highly recommend J2ME Polish for just this task. You will find that it will reduce the number of classes, and also provides lots of preprocessor stuff you can do. Plus a really nice GUI.

Have fun.

Mark
 
Phil Brumby
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the quick response Mark, as you've probably noticed from the amount of Polish questions i've posted here i am actually developing with it, and yes it does rock.

Here my prob though, i've tweaked my build so i can build a version of the app in Polish, with a swanky GUI etc for release but then when im developing the code i can also build a regular version in NetBeans so i can use it's step through debugger

If i use the polish //#include for my sprite.inc file, yes it works with my polish build, but i lose the ability to step through debug in my netbeans version cos it wont build.

Any thought?

Thanks,
Phil.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, yes, I totally forgot.

I thought there was a NetBeans plug-in for J2ME Polish.

OK taken from Apress's "Pro J2ME Polish", good reference book to have by the way.


For integrating with NetBeans 4, create a new project and copy the contents of ${polish.home}/samples/menu into your new project with a file maanger. Right-click build.xml and choose Run Target > j2mepolish for building the application or Run Target > emunlator for invoking the emulator.



Ok after typeing that word for word, I think that shows how to be able to build your projects with J2ME Polish directly in NetBeans, but I still think there is still an issue of being able to debug through the included code.

For testing purpposes, you could just copy your include code directly into your code, so you can step through it, then remove it when you want to actually "go live" or that might defeat the whole purpose.

Mark
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
#include is not supported in NetBeans. I know that many people actually use it however it would break debugging. If a fragment of code is included during build process, line numbers in editor don't match information received from the virtual machine.
 
Phil Brumby
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark alas for my inability to post clearly!

My working Polish version IS also built in NetBeans, set up via the method described in the manual (same as the one you posted).

I build it by right clicking the build.xml in the FILE tab and Run Target, but this means no step through debug for that build.

So I can also build a version by going to the PROJECTS tab and building the project, a "traditional" NetBeans build, which outputs a non-Polished GUI version but I can step through debug.

I guess it's large java files for me

....

Just taking the Preprocessor thing on a different slant which might provide a solution regarding something Martin said.

NetBeans does implement preprocessing through it's own supplied preprocessor, it has minimal functionality but does have code fragment stuff and you can still step through debug? So it must rebuild the java file before sending it to virtual machine!

This leads me to the question, can I replace/or run concurrently with the NetBeans Preprocessor my own which will bring greater preprocessing functionality?

Phil.
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic