Skip to main content

What considerations need to be account for using jdk7 ?

7 replies [Last post]
jlover2010
Offline
Joined: 2010-01-15

Hello everyone,
recently i downloaded jdk7 b91 to use its wonderful nio2 features i learned from "The Java Tutorials" in my application.(actually i want to start a new project uses new I/O enhancements...)

Now the question(s):
Do i need to remove the prevoius version (6u17 in my machine)? if no, what will happen If install the new one?

Does my previous applications run with new JRE? (in the jdk), i wonder that the new version has the previous libraries (of course i know it enhances some classes and adds new classes, but is it complete? or a complete platform)

Sorry if my questions are silly and thank you in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jlover2010
Offline
Joined: 2010-01-15

Yes, you are right.
after your last reply, i checked the IDE more precisely and see that every project coul have its own Java Platform.

So the last questions:

I will start my new project using jdk7, any class that with no change come into new jdk from previous, will be be usable ?
(I think this is not any problem, just asked to ensure ;) )
And when i made my application using jdk7, how could it run off the IDE ?

Best Regards

Message was edited by: jlover2010

caclark
Offline
Joined: 2005-02-24

> Yes, you are right.
> after your last reply, i checked the IDE more
> precisely and see that every project coul have its
> own Java Platform.
>
>
> So the last questions:
>
> I will start my new project using jdk7, any class
> that with no change come into new jdk from previous,
> will be be usable ?
> (I think this is not any problem, just asked to
> ensure ;) )

That should be no problem - JDK 6 compiled classes should be forward compatible with JDK 7.

> And when i made my application using jdk7, how could
> it run off the IDE ?
>
> Best Regards
>
> Message was edited by: jlover2010

If you configure your project to use JDK 7, then when launching it from the IDE, I would expect a JDK 7 java process to be forked to run your code, not JDK 6. The definition of what JDK you want to use in your project by default will affect all tooling - not just compilation, but also running.

Kind regards,

Chris

jlover2010
Offline
Joined: 2010-01-15

> > And when i made my application using jdk7, how could it run off the IDE ?
>
> If you configure your project to use JDK 7, then when
> launching it from the IDE, I would expect a JDK 7
> java process to be forked to run your code, not JDK
> 6. The definition of what JDK you want to use in your
> project by default will affect all tooling - not just
> compilation, but also running.
>
> Kind regards,
>
> Chris
I said "off the IDE", i meant for example i build the jar file, and so that would be a standalone application that NOT running from the IDE, and the public JRE is not seven, so what could it be possible? Is Java looks forward to private JRE (7), when the public one (6) caould not run this specific app?

Regards

caclark
Offline
Joined: 2005-02-24

> I said "off the IDE", i meant for example i build the
> jar file, and so that would be a standalone
> application that NOT running from the IDE, and the
> public JRE is not seven, so what could it be
> possible? Is Java looks forward to private JRE (7),
> when the public one (6) caould not run this specific
> app?
>
> Regards

I'm not sure about your OS, but if I'm assuming Windows, you could make a simple command:

e.g.

/bin/java -cp

And if you went as far as to create a manifest entry to point to the main class you wish to launch, you could end up with this configuration:

/bin/java -jar

The most important thing is that you can specify (via launcher scripts) which path to the java.exe (or in Linux/Unix/whatever java) executable you wish to use. In windows, of course, you can (with the explicit installation of a JRE), get the option to double-click on a JAR file to run it - but then, that would be the JVM of the [b]public[/b] JRE that would be launching that JAR file (assuming you had configured a main class without dependencies)

Basically, try the following:

/bin/java -cp

and see how it goes....

HTH

jlover2010
Offline
Joined: 2010-01-15

Thank you,
I always wanted to know what is public/private JRE, and now searched about that, so this cleared to me.

I will install jdk7 without public jre, but another regarded question will be:
in my IDE (NetBeans), which one will be used? I know i can specify the Java platform i want, but won't there be any conflict!?

Sincerely

caclark
Offline
Joined: 2005-02-24

You should be able to specify the java environment you want for each project - I am not an expert regarding netbeans (which is an IDE which I have full praise for, regarding mobile development), but I mainly use Eclipse for my enterprise purposes, and I know that for each Eclipse project (in a workspace) you can specify different JDKs/JREs. I am sure the same holds for Netbeans (different projects with different JDKs/JREs).

Of course, both Netbeans and Eclipse need Java to run, but this is considered the runtime environment, and for project work, you should be able to configure whatever Java you have installed.

Regards,

Chris

caclark
Offline
Joined: 2005-02-24

If you install JDK 7, and specify that you [b]do not[/b] want the public JRE installed, this should be fine (it will not affect your JDK/JRE from Java 6).

Regards