• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Can I Load and *NOT* Execute?

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to display data on various terminal types has been a challenge to me. Because many terminals have different pixel settings, (1920 X 1024) for example, I came up with a formula for figuring this out. It works OK but now I want add the functionality of letting the user set what he thinks it should be, and not the Java classes. To that end I have to rewrite a lot of current code. This causes me to reach beyond my class training and so I have some Q's I hope you answer.

Q1: ClassM Extends ClassU, and because ClassU executes first it needs some of the new pixel massaging code I just mentioned. I really don't want to have ClassU do any extensive new work, just the minimum. The only way I can think to do this is to have ClassU execute a new class (ClassL) who's sole function is to load (and not execute) all of the classes I need for later pixel massaging. Can I do this? Load a class and not execute it, a la "MYCLASS my = new MYCLASS()"? I would want to keep all of the "my" object pointers (many of them) in order to access code inside of these guys  to use their getters/setters (set now, get later).

Q2: If the above isn't doable then is there a way for ClassU to access code inside ClassM? I'm still early in deciding how to do this.

Thank you!
 
Saloon Keeper
Posts: 9735
80
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q2: You already have an answer to this question in the previous topic you started.

Q1: Your question is so hypothetical I find it hard to follow. Why don't you give the classes some actual names and provide some pseudo code as to how you imagine it might work. That would give us a starting point.
 
Sheriff
Posts: 27451
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well... loading a class is one thing. And creating an instance of that class is another thing. But from the way your post is written it seems that you don't understand the difference between a class and an object. (Hint: You don't "execute" a class. For that matter you don't execute an object either.) If that's the case then it's going to be very hard for you to achieve what you want to do.

But perhaps it's just the terminology which you aren't using properly. It might help if you went back to review what you've learned so far about classes and objects.

Anyway I'm in agreeance with Carey, real class names would be much easier to talk about, and a description of what you want to do would help too. And that could help us clear up your misunderstandings.
 
Robert Houston
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My thanks to the both of you for responding. To build the scenario is pseudo code would be more than I want to do because there are several classes in play. I will do some work on this and take my time.
 
Paul Clapham
Sheriff
Posts: 27451
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let us know if you need more help when you get farther along, then. We're always here for that.
 
Saloon Keeper
Posts: 26285
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Class.forName() method invokes the classloader to cause a class to be brought into memory. It's sometimes used, for example, to determine if a particular named class is actually in the classpath, but it can be used any time you want to fetch a class and prep it for use and/or introspection. It used to be used by JDBC before JDBC got smarter.

I don't see much point in letting users guess screen size, though. Pretty much any graphics system has a method that can be used to query screen sizes. Trusting users can get you into big trouble.

 
Robert Houston
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim. I hope you are doing well.
I used to work with you at CPI. Don't let my pseudonym fool you.
Bob G.
 
Tim Holloway
Saloon Keeper
Posts: 26285
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well! Small world! Are you pursuing a new career path here or just personal enrichment?

As you can see, I've been on the Ranch for a long time now. My actual primary focus is more Internet of Things than Java these days - designing and programming evil little gadgets, But I try to keep up.
 
Robert Houston
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim. I retired several years ago and found that none of my M/F background helped much in the PC world (except Regina REXX, and it has no GUI). I took the 1st course in Object oriented JAVA just for kicks. I was the oldest person in the class, by far - older than the prof who is an ex-IBMer. So after I finished I wrote a password handling "system" and it worked well until I ported it over to my wife's laptop, where all of the fonts were teeny tiny. I fixed that but it's still klugey (sp?) so I ask questions about stuff I never had to deal with before and I'll eventually get there.  I am *NOT* a heavy duty Java guy and never will be; it's all for fun.
You still in town?
Bob
 
Tim Holloway
Saloon Keeper
Posts: 26285
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still looking for core dumps?

Actually, when I got back to CPI/ALLTEL, I made the mistake of ordering a full dump. Once. They delivered it laser-printed, double-sided on a float.

I don't think I ever managed to use ReXX on the mainframe at CPI, although maybe once at a client site. I did use it briefly under OS/2 in my second incarnation (ALLTEL) there before switching to Perl. And ReXX was the system scripting language for the Amiga PC, so I used it a lot there.

We have a forum here on the Ranch just for GUI's - more than one, in fact. Probably the biggest things that almost everyone struggles with are that most modern GUI systems don't like you laying things out in absolute positions or using raw pixel co-ordinates. So to avoid pain, you have to learn to ask for fonts in relative sizes and master layout managers and packing. And, of course, every GUI is a little different even though they're so much alike. Knowing the functions and terms for Android will help if you design for Swing or SWT, but it won't be a painless conversion.

Incidentally, on the Unix/Linux platform, there's a GUI framework called "Tk". It was originally designed to work in conjunction with a scripting enchancement called Tcl (the Tool Control Language), but Regina Rexx can use it too. And like Java, it too has layout managers and GUI packing.

And if you ever get to feeling Mainframe Withdrawal Syndrome, there's an IBM emulator that can handle most System/360 models right up to recent z/Series models. Unfortunately, since IBM went OCO about the time that MVS went 32-bit, the most recent OS options you can get (for free, anyway) are OS/MVS 3.8j (which was what we were running when I originally left CPI), DOS/MVS 38 (give or take), and similar. You can do command-line TSO, but since ISPF, CICS and ROSCOE were all commercial, no luck on them either, although there's a pretty decent ISPF alternative in the Hercules "tape" archives. Hercules runs on Windows, Linux, and the Raspberry Pi (and presumably MacOS, and other platforms I can't recall).

I like the Raspberry Pi. Credit-card sized PC for about $35. And the latest model does a decent job of replacing the average desktop PC.

Oh, and yes, I'm still in town. They got me to leave once, back in the late 1980's, but never again.

 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic