• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Running program written in Java 6 in JRE 1.4.2 Environment

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I wrote a program for a friend of mine to help him out with repeated similar database searches, however he is unable to run this program. I wrote the program in Java 6 (The latest version of Netbeans), but he can only use JRE 1.4.2 due to other programs that he has to use at work.

When he tries to run the JAR file, he is getting an error that says: “Could not find main class. Program will exit.”

I rebuilt the program making sure that main was selected as the default class and the program runs perfectly on other computers (all of which have the latest verison of Java on them), but it still does not work for him. I am assuming that him running 1.4.2 is the problem since it works fine in other places and the main class was set as default.

Any ideas on how to fix this so that he can run it?


Thanks!
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Any ideas on how to fix this so that he can run it?



Java is not forward compatible. You will have to recompile your program for Java 1.4.2. And of course, this also mean that you can't use any feature or API that doesn't exist in Java 1.4.

Henry
 
Ranch Hand
Posts: 686
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:

Any ideas on how to fix this so that he can run it?



Java is not forward compatible. You will have to recompile your program for Java 1.4.2. And of course, this also mean that you can't use any feature or API that doesn't exist in Java 1.4.

Henry



hmmm Seems kind of odd that the OP's friend would restricted to an older version of the JRE because of backwards compatibility problems. Is that unusual? Of course, when your computer is owned by the company that employs you, then you have to play by the rules.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AFAIK retroweaver only does 1.5=>1.4 (same with retrotranslator), although it might still work... but it *is* possible to "backport" binaries.

Depending on the app you might also need concurrent-utils.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Fred Hamilton wrote:Seems kind of odd that the OP's friend would restricted to an older version of the JRE because of backwards compatibility problems. Is that unusual?



It is not so unusual. A lot of times code written to Java 1.4 may have specific work-arounds for bugs or behaviors in Java 1.4. Then Java 5 comes along and fixes the bug or changes the behavior and the application doesn't work the same. It is often hard to predict what the differences between versions will mean, but specifically between Java 1.4 -> 5 there was a lot of changes with the memory model. So the easiest thing to do is tell people that they only can use this one version of Java which the program was coded and verified on.

Another solution is to package a Java 6 Run Time with the application and use a batch file which launches the application with the target JRE.


I am not sure how much of the JRE install you actually have to copy. Maybe all maybe not. Your batch file / script could call something like:

Perhaps with some fooling around with the classpath if you need to add libraries etc... You could also probably have the script check the installed Java Run Time, and if it isn't 6+ then use the included one, otherwise use the built-in one.

As a note, I haven't actually ever done this myself, so it is all conjecture. But I have run applications that do this, like ImageJ for example.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic