Results 1 to 20 of 23
- 09-11-2010, 03:11 AM #1
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
- 09-11-2010, 03:19 AM #2
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 12
I am no expert but from my basic java skills I am thinking
Java Code:ImplementationVersion();
- 09-11-2010, 03:31 AM #3
The API on getImplementationVersion should tell you why it's returning null. You will probably want to add in your code a case where this is null and return a custom value instead.
Oddly, some versions of Java seem to have a bug in them; you can read more from my Google search here.
PS: One of these two links should help in the case that you are just searching for the Java version.
- 09-11-2010, 03:36 AM #4
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 12
null is returned if it is not known.
is Package implemented correctly?
- 09-11-2010, 03:42 AM #5
His method should work. However, he could loop through all known packages instead...
Java Code:Package[] localPackages = Package.getPackages(); for (int i = 0; i < localPackages.length; i++) { // ... }
- 09-11-2010, 03:42 AM #6
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Q: is Package implemented correctly?
A: I am not sure with the question..
I just run it from NetBeans (6.9) IDE..
my project -> Source Packages -> (default package)
- 09-11-2010, 03:49 AM #7
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Hi Zack,
What I meant here is my application version (major.minor.revision) ..
- 09-11-2010, 04:11 AM #8
Try the loop in my second post, checking localPackages[i] for its implementation version. I'm not sure exactly how you've set your application version in the package itself.
- 09-11-2010, 04:40 AM #9
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Did not find my application package name
- 09-11-2010, 05:22 AM #10
What's your output if you run this?
Java Code:Package[] localPackages = Package.getPackages(); String[] packageNames = new String[localPackages.length]; for (int i = 0; i < localPackages.length; i++) { packageNames[i] = localPackages[i].toString(); } Arrays.sort(packageNames); for (int i = 0; i < packageNames.length; i++) { if (!packageNames[i].contains("Java Platform API")) System.out.println(packageNames[i]); }
Last edited by Zack; 09-11-2010 at 05:29 AM.
- 09-11-2010, 05:29 AM #11
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
it only returns:
package com.mysql.jdbc
package com.mysql.jdbc.exceptions
package com.mysql.jdbc.log
package com.mysql.jdbc.util
package com.sun.mail.util, JavaMail(TM) API Design Specification, version 1.4
package gnu.io
package javax.mail, JavaMail(TM) API Design Specification, version 1.4
package javax.mail.internet, JavaMail(TM) API Design Specification, version 1.4
package org.netbeans.lib.awtextra
- 09-11-2010, 05:30 AM #12
It's not even finding your package at all...
Alright, let's take a look at something else. How are you setting the version number that you want to appear?
- 09-11-2010, 05:35 AM #13
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Hi.. I didnot find manifest.mf file.. does it cause this problem?
My NetBeans 6.9 .. does not automatically generate it when it rebuilt
- 09-11-2010, 05:43 AM #14
Are you sure there's no manifest.mf file? Where are you looking?
- 09-11-2010, 05:50 AM #15
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
yes, I did not find manifest.mf file ..
I look into \dist folder..
Netbeans does not automatically generate it..
any idea?
- 09-11-2010, 05:53 AM #16
The manifest.mf file won't be in the \dist\ directory. It should be the one above it, the one that is named after your project. (The folder that contains build, dist, src, and so on.)
- 09-11-2010, 05:57 AM #17
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
yes, I also have searched in \src \build\ .. and I did not find it..
- 09-11-2010, 06:11 AM #18
I think I'd best let Norm or Fubarable or another senior member take this thread over from me. If there's no manifest file I'm not sure how to force-generate it (except to create it yourself, which you could do if you follow this little documentation).
- 09-11-2010, 07:10 AM #19
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Hi Zack,
Ok, it seems like my project was corrupted, I recreate the project and I found manifest.mf now!..
I tried your codes.. and now I found my package name..
but I still unable to get the version information..
my manifest.mf ..contained:
Java Code:Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build
- 09-11-2010, 08:04 AM #20
Give this documentation a try, it's the full official docs on setting up a manifest file for Package Versioning.
Similar Threads
-
.DAY_OF_WEEK always returns 7
By shurgs in forum New To JavaReplies: 2Last Post: 08-20-2010, 03:32 PM -
Lucene highlighter returns null fragments always
By zee in forum LuceneReplies: 1Last Post: 08-20-2010, 12:30 PM -
helpset findHelpSet returns null
By kmm1977 in forum AWT / SwingReplies: 23Last Post: 06-22-2010, 04:53 PM -
Carriage Returns in JTEXTAREA
By AJArmstron@aol.com in forum Advanced JavaReplies: 8Last Post: 04-17-2010, 08:34 PM -
What's the need for co-variant returns ?
By ajeeb in forum New To JavaReplies: 0Last Post: 03-23-2009, 10:56 AM
Bookmarks